Store User Conversation on Database

Hi, Guys, I am able to store user conversation on cloud but I want to store this conversation on my own database like SQL(preferrably MySQL) or NoSQL(MongoDB preferrably). How can I do this?

I am also need to store user conversation on my own database. In specific bot reply default responses need to capture that questions. How can i do this?

You can use some predefined tracker_stores like Redis. But is there actually any difference if I use another not predefined Store? I think rasa is customised for stores like Redis such that conversation is automatically restored in a case, right? Or how would I implement a SQL Store with same functionality like Redis?

What if my client wants to store that data on MongoDB or some other Database system?

Thats the question I asked too.

This PR was merged recently: https://github.com/RasaHQ/rasa_core/pull/902

Is that what you’re looking for?

No it just track the user conversation and after executing action it update the conversation. I want to store the conversation for long time that means I want to add or insert the user conversation in the previous conversation based on their id.

For mongodb use mongodb tracker. It will save all conversation. To get conversation history use pickler to decrypt data

Yeah this is exactly what the MongoTrackerStore does

Hi Akelad,

I have a query regarding MongoTrackerStore store. I am able to get the conversation using script but i don’t want to run the script each time to get the latest conversation. I want something that it will save the data in mongo once user start conversation. It’s should store conversation in real time like saving in tracker. Is there any way or documentation please let me know. Thank you :slight_smile:

What script do you mean? The MongoTrackerStore should do what you’re asking for

1 Like

Actually i used MongoTrackerStore to store the tracker in mongo, but data is in incrypted format and i want to save data in mongo as conversation format like bot and user talking. I am able to save the conversation in that format but it is asynchronous . i have to run the code to save the data. Is there is any way to save data on each input and output in mongo as it is saving in tracker

what do you mean in an encrypted format? it should be saving as a dictionary like this rasa_core/trackers.py at master · RasaHQ/rasa_core · GitHub

Hi, I want to store user conversations where senderID of MongoDB collection should be equal to UserId which is already provided to the user. Can you guide me how to do it?

Could you explain it a bit more , it would really helpful :slight_smile:

Hi @abhishakskilrock I’m stuck in the same problem. Did you find a solution that could be used in production. I have a sender_id that i’m passing in my rest call and according to that getting results. So I wanted to similarly store this conversation for particular user and maybe analyse it find some wrong answers given by bot. We need these conversation to even track if someone is misbehaving with bot ! xD. Hey this bot is like my child! :slight_smile::slight_smile: You gotta take care of them

Hi @Akshit I apologise for being late. Did you implemented storage tracker successfully? I am assuming yes. Now you have to write a code which fetch conversation from storage tracker below your required accuracy(You can define it in that code rather than taking text(user request) below fallback) and try to improve your model by fetching those text in interactive learning.

P.S. I did the same, so I can surely say it will be easiest way to improve your model and track someone who is misbehaving with your bot.

One more thing for predicting which user is misbehaving you have to modify rasa-source code according to your need like mapping or update sender_id with your user_id or client_id. For that you have to do monkey patching.