# Include an ID for each bot message

**URL:** <https://forum.rasa.com/t/include-an-id-for-each-bot-message/62808>\
**Category:** Rasa Open Source\
**Created:** [July 28, 2024, 7:06am UTC](https://forum.rasa.com/t/include-an-id-for-each-bot-message/62808 "2024-07-28T07:06:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sutgeorge](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sutgeorge/32/23921_2.png) [@sutgeorge](https://forum.rasa.com/u/sutgeorge)\
**Post date:** [July 28, 2024, 7:06am UTC](https://forum.rasa.com/t/include-an-id-for-each-bot-message/62808/1 "2024-07-28T07:06:13Z")

</div>

Hello! I am trying to include a unique ID for each bot message. The reason why I need this ID is because I want to implement a user feedback/rating feature for all of the bot answers. Currently, I can’t match the front-end bot message with the event saved in the tracker store.

To do this, I implemented a custom connector channel that was supposed to include a unique ID in the message sent through the output channel. However, I don’t know how I should save that message together with the generated unique ID in the tracker store. Even if I implement a custom tracker store, there is basically no way to save the unique ID to the tracker store from the output channel.

I am very confused as to why there is no simple way to include additional fields to the bot messages. One could do this using custom actions, but it is a really ugly solution.

Other people have asked this question as well:

- [UniqueID for Bot Response in MongoTrackerStore](https://forum.rasa.com/t/uniqueid-for-bot-response-in-mongotrackerstore/40000)
- [Getting feedback for the bot through the bot](https://forum.rasa.com/t/getting-feedback-for-the-bot-through-the-bot/6390)
- [Rasa bot answer id like user message\_id does](https://forum.rasa.com/t/rasa-bot-answer-id-like-user-message-id-does/62315)

---

<div class="post-metadata">

**Author:** ![sutgeorge](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sutgeorge/32/23921_2.png) [@sutgeorge](https://forum.rasa.com/u/sutgeorge)\
**Post date:** [July 28, 2024, 7:50am UTC](https://forum.rasa.com/t/include-an-id-for-each-bot-message/62808/2 "2024-07-28T07:50:53Z")

</div>

I found out a “primitive” solution: one can basically send the timestamp of the bot reply by implementing a custom output channel. The timestamp and the user ID will be the unique identification data for a message on the front-end. These two fields will be sent as part of the feedback/rating request to the back-end, where a SQL query will find the matching event in the “events” table (tracker store) if the following conditions are fulfilled:

1. `sender_id == user_id` (where the user ID is sent from the front-end)
2. `MAX(timestamp) <= rated_message_timestamp`, where `rated_message_timestamp` is the timestamp that was initially sent through the custom output channel. The reason why I need the `MAX` is because I noticed that the event timestamps saved in the tracker store (the “events” table) are always smaller than the timestamp generated by using `datetime` (the one that was sent through the output channel to the front-end).

After finding the matching event, I can store the user feedback and the rating in a separate table. This is the only way to uniquely identify bot messages and support the user feedback feature for now. It is incredibly hacky and not a pretty solution at all. I wish someone would implement this feature, since it’s ubiquitous in most chatbots.
