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

蹲街弑〆低调 提交于 2019-12-09 15:53:52

问题


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


回答1:


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


来源:https://stackoverflow.com/questions/49665510/how-to-store-and-retrieve-the-chat-history-of-the-dialogflow

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!