How to save bot conversation on mongodb?


(Neerajb1) #1

Hi , I am new to rasa and currenlty completed a facebook bot using rasa core:.10.4. I want to save the conversation on mongodb. Could you please provide the detail how to save it.

Logging a Bot
(Neerajb1) #2

I just stored the tracker in mongodb but it stored only sender id and tracker id. I want to store chat conversasion on mongo. Please help me to get i.

(Souvik Ghosh) #3

(Souvik Ghosh) #4

take a look tracker_store. there is a MongoDB Tracker store that you can pass to your agent on creation. It will save the conversation history

(Neerajb1) #5

Hi souvik , Thanks for response. I am able to store tracker on mongo and from tracker i am able to get the data but i want to store data in chat format and currently i am getting like

Dialogue with name ‘1813498192019988’ and turns:

ActionExecuted(action: action_listen)

    UserUttered(text: Hi, intent: {'name': 'greet', 'confidence': 0.9587802290916443}, entities: [])

    ActionExecuted(action: utter_greet)

    BotUttered(text: Hello, how can I help you?, data: null)

Also how i can track new conversation and update on mongo db

(Abhishak Varshney) #6

(post withdrawn by author, will be automatically deleted in 24 hours unless flagged)

(Ajay Kumar Prajapati) #9

Hello friend,Could you please tell me how are you fetching specific details from the tracker store. Elaborating my doubt below:

in my (socketIO class) i have used mongotracker like this-

db = MongoTrackerStore(domain=“d.yml”,host=‘host ip’, db=‘xyz’, username=“x”,password=“x”,collection=“x”,event_broker=None)

agent = Agent.load(‘models/dialogue’, interpreter=‘models/current/nlu’,action_endpoint = action_endpoint,tracker_store=db)

now i want to fetch some data like db.sender_id or db.event. the reason of doing it is to store it column wise on my mongodb.Please help me solving this problem.

(Abhishak Varshney) #10

Hi @ajaxwini Can you explain the term column-wise like how you wanna store data on mongodb?

(Ajay Kumar Prajapati) #11

Hi Abhi,

I want to store sender id in one col and then respective start time of the chat and end time and then all conversation in other table for respective sender where sender id will act as a foreign key.