Rakhi Mittal
Rakhi Mittal

Reputation: 103

How to store and retrieve the chat history of the dialogflow?

I want to redirect the chat from Google dialogflow to a human. For this, I want to get the history of the conversation made by the user. Is there any platform where the history is being stored? If yes, how to access it. If not, how to achieve this functionality..

Upvotes: 10

Views: 8086

Answers (1)

Marcos Casagrande
Marcos Casagrande

Reputation: 40404

There's no current API to retrieve session history. The only alternative is to save the history yourself.

You can use any database you're familiar with, MySQL, MongoDB, or even a cloud hosted database such as Firebase Realtime Database

The code won't be too hard, everytime the user sends a new message and every time the bot answers, you will have to save that message to the database, with the right timestamp and chat ID.

When the user is redirected, you will get all the messages from that session using the chat ID, sort them by timestamp, and you will have your complete chat history available.

Some answers/tutorials that might help you:

Upvotes: 5

Related Questions