# How to save bot conversation on mongodb?

**URL:** <https://forum.rasa.com/t/how-to-save-bot-conversation-on-mongodb/1018>\
**Category:** Rasa Open Source\
**Created:** [September 11, 2018, 6:32am UTC](https://forum.rasa.com/t/how-to-save-bot-conversation-on-mongodb/1018 "2018-09-11T06:32:36Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![neerajb1](https://avatars.discourse-cdn.com/v4/letter/n/90ced4/32.png) [@neerajb1](https://forum.rasa.com/u/neerajb1)\
**Post date:** [September 11, 2018, 6:32am UTC](https://forum.rasa.com/t/how-to-save-bot-conversation-on-mongodb/1018/1 "2018-09-11T06:32:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![neerajb1](https://avatars.discourse-cdn.com/v4/letter/n/90ced4/32.png) [@neerajb1](https://forum.rasa.com/u/neerajb1)\
**Post date:** [September 11, 2018, 11:09am UTC](https://forum.rasa.com/t/how-to-save-bot-conversation-on-mongodb/1018/2 "2018-09-11T11:09:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![souvikg10](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/souvikg10/32/93_2.png) [@souvikg10](https://forum.rasa.com/u/souvikg10)\
**Post date:** [September 11, 2018, 7:26pm UTC](https://forum.rasa.com/t/how-to-save-bot-conversation-on-mongodb/1018/3 "2018-09-11T19:26:43Z")

</div>

> <https://github.com/RasaHQ/rasa_core/blob/master/rasa_core/tracker_store.py>

---

<div class="post-metadata">

**Author:** ![souvikg10](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/souvikg10/32/93_2.png) [@souvikg10](https://forum.rasa.com/u/souvikg10)\
**Post date:** [September 11, 2018, 7:27pm UTC](https://forum.rasa.com/t/how-to-save-bot-conversation-on-mongodb/1018/4 "2018-09-11T19:27:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![neerajb1](https://avatars.discourse-cdn.com/v4/letter/n/90ced4/32.png) [@neerajb1](https://forum.rasa.com/u/neerajb1)\
**Post date:** [September 12, 2018, 4:07am UTC](https://forum.rasa.com/t/how-to-save-bot-conversation-on-mongodb/1018/5 "2018-09-12T04:07:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![abhishakskilrock](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/abhishakskilrock/32/4039_2.png) [@abhishakskilrock](https://forum.rasa.com/u/abhishakskilrock)\
**Post date:** [October 9, 2018, 6:09am UTC](https://forum.rasa.com/t/how-to-save-bot-conversation-on-mongodb/1018/6 "2018-10-09T06:09:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ajaxwini](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ajaxwini/32/2162_2.png) [@ajaxwini](https://forum.rasa.com/u/ajaxwini)\
**Post date:** [March 14, 2019, 12:54am UTC](https://forum.rasa.com/t/how-to-save-bot-conversation-on-mongodb/1018/9 "2019-03-14T00:54:37Z")

</div>

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

in my run\_app.py (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.

---

<div class="post-metadata">

**Author:** ![abhishakskilrock](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/abhishakskilrock/32/4039_2.png) [@abhishakskilrock](https://forum.rasa.com/u/abhishakskilrock)\
**Post date:** [March 14, 2019, 4:48am UTC](https://forum.rasa.com/t/how-to-save-bot-conversation-on-mongodb/1018/10 "2019-03-14T04:48:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ajaxwini](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ajaxwini/32/2162_2.png) [@ajaxwini](https://forum.rasa.com/u/ajaxwini)\
**Post date:** [March 15, 2019, 7:34pm UTC](https://forum.rasa.com/t/how-to-save-bot-conversation-on-mongodb/1018/11 "2019-03-15T19:34:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![AnkitSingh21](https://avatars.discourse-cdn.com/v4/letter/a/c77e96/32.png) [@AnkitSingh21](https://forum.rasa.com/u/AnkitSingh21)\
**Post date:** [August 8, 2019, 12:27pm UTC](https://forum.rasa.com/t/how-to-save-bot-conversation-on-mongodb/1018/12 "2019-08-08T12:27:30Z")

</div>

Hi,

Did you get the answer for how to fetch the data from tracker store ?

Ankit

---

<div class="post-metadata">

**Author:** ![rahma](https://avatars.discourse-cdn.com/v4/letter/r/ee59a6/32.png) [@rahma](https://forum.rasa.com/u/rahma)\
**Post date:** [May 31, 2021, 2:31pm UTC](https://forum.rasa.com/t/how-to-save-bot-conversation-on-mongodb/1018/13 "2021-05-31T14:31:38Z")

</div>

hi , can someone please tell me how to save all conversation on mongodb ? i’m new to rasa and i’m confused , you said to use mongotrackerstore, but i don’t know how to do that , o where to put that code ! there aren’t really a lot of resources out there !! thank u in advance

---

<div class="post-metadata">

**Author:** ![rahma](https://avatars.discourse-cdn.com/v4/letter/r/ee59a6/32.png) [@rahma](https://forum.rasa.com/u/rahma)\
**Post date:** [May 31, 2021, 6:47pm UTC](https://forum.rasa.com/t/how-to-save-bot-conversation-on-mongodb/1018/14 "2021-05-31T18:47:13Z")

</div>

how did you store tracker on mongo plz ,?

---

<div class="post-metadata">

**Author:** ![Aciel](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/aciel/32/12939_2.png) [@Aciel](https://forum.rasa.com/u/Aciel)\
**Post date:** [June 3, 2021, 5:42pm UTC](https://forum.rasa.com/t/how-to-save-bot-conversation-on-mongodb/1018/15 "2021-06-03T17:42:56Z")

</div>

Welcome to the forum @rahma!

Please take a look at the documentation for doing this: [MongoTrackerStore](https://rasa.com/docs/rasa/tracker-stores#mongotrackerstore)

If you have further questions please let us know!

Aciel
