Rasa continue conversation after closing window

Hi everyone,

I want the chatbot to continue the conversation after the same user has closed and reopened the chatbot window within the session expiration time. How do I retrieve the history of chat session to redisplay it and also set the conversation session to the point where the user has last left it at.

Thanks all for your help.

I could be wrong since I’m not that advanced with Rasa, but as far as I understand, the conversation is not gone before timeout even if you close the window. You can reuse the same sender_id and Rasa should pick up where it left (in the middle of a form, ect). You could add your own slot where you append the message history if you need to re-render it, but that sounds more like a frontend-related issue to approach.

hmm yeah, i think you’re right, its more of a front-end related issue. I was looking around and I found that I can retrieve the conversation logs with this api call. http://localhost:5005/conversations/{conversation_id}/tracker

Thanks anyway!

Ah, cool! I’m not sure the entire history is stored inside the tracker though. I think what you’re looking for might be http://localhost:5005/conversations/{conversation_id}/story. This keeps hold of user utterances and replays everything as a story. I guess one issue here is that Rasa’s exact utterances may vary because it is able to choose one random uttrance among many available options.

1 Like

Hi! You should be able to get all the texts (bot and user) from the events in the tracker. This will look something like this:

tracker.events

for which an event looks like:

{'event': 'bot', 'timestamp': 1613556910.4163609, 'text': 'Hello World!'....}

for a bot, or:

{'event': 'user', 'timestamp': 1613556910.41068, 'text': 'hungry', 'parse_data': ...}

for a user.

Feel free to ping me if you get stuck on this, but it sound like you have the right idea :slight_smile:

1 Like