Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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..

like image 553
Rakhi Mittal Avatar asked Apr 05 '18 06:04

Rakhi Mittal


People also ask

How can I view the conversation history in Dialogflow?

Here, you can review statistics relevant to the specific agent. Dialogflow does not provide any API to retrieve conversation history directly. You will have to log conversations to Google Cloud and retrieve from there.

Where are Dialogflow logs stored?

Now your Dialogflow logs are in Google Stackdriver. You can either store these logs in cloud itself or export the logs to a third party server. To enable this you will have to configure a Log Router. According to Google cloud documentation,

How to get the chat conversation history of a bot?

romungi-MSFT answered • Jan 27 2021 at 11:19 PM | LauraHuico-1534 commented • Jan 28 2021 at 12:20 PMACCEPTED ANSWER @LauraHuico-1534 For a bot created using bot framework you need to enable storage of the conversations to a database like cosmos DB or blob storage to get the chat conversation history.

How do I write Dialogflow logs to Google Stackdriver?

This will write Dialogflow logs to Google Stackdriver. Under Google Project, click the id of the project you wish to work on. The Google Cloud console will open. To view logs from the cloud console, go to Logs View. The dialog flow logs will be displayed, and you can filter them based on your queries.


1 Answers

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:

  • Best way to store chat messages in a database?
  • Storing chat messages inside a MySql table
  • Firebase Web chat tutorial
like image 50
Marcos Casagrande Avatar answered Sep 23 '22 14:09

Marcos Casagrande