10

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

Prometheus
  • 886
  • 11
  • 18
Rakhi Mittal
  • 103
  • 1
  • 5

1 Answers1

5

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:

Marcos Casagrande
  • 29,440
  • 5
  • 62
  • 77
  • but that would require that the user send the message to my REST api, then the rest api sends the message to dialogflow right ? Also, what about social media integrations ? – Wassim Seifeddine Jun 20 '19 at 16:03
  • Use webhooks, or integrate social media into your webserver. `Any Entrypoint <> your server <> Dialogflow` – Marcos Casagrande Dec 10 '19 at 14:58