# How to get the last message uttered by bot

**URL:** <https://forum.rasa.com/t/how-to-get-the-last-message-uttered-by-bot/9105>\
**Category:** Rasa Open Source\
**Created:** [April 29, 2019, 6:35am UTC](https://forum.rasa.com/t/how-to-get-the-last-message-uttered-by-bot/9105 "2019-04-29T06:35:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![shubhamm](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@shubhamm](https://forum.rasa.com/u/shubhamm)\
**Post date:** [April 29, 2019, 6:35am UTC](https://forum.rasa.com/t/how-to-get-the-last-message-uttered-by-bot/9105/1 "2019-04-29T06:35:53Z")

</div>

Hi All, I want to use the bot message for the flow but didn’t get access to it. Do help me to get the last message uttered by bot. Thanks.

---

<div class="post-metadata">

**Author:** ![Nishet](https://avatars.discourse-cdn.com/v4/letter/n/b487fb/32.png) [@Nishet](https://forum.rasa.com/u/Nishet)\
**Post date:** [April 29, 2019, 9:39am UTC](https://forum.rasa.com/t/how-to-get-the-last-message-uttered-by-bot/9105/2 "2019-04-29T09:39:06Z")

</div>

@shubhamm try this.

message = tracker.latest\_message.text

---

<div class="post-metadata">

**Author:** ![srikar\_1996](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@srikar\_1996](https://forum.rasa.com/u/srikar_1996)\
**Post date:** [April 29, 2019, 12:04pm UTC](https://forum.rasa.com/t/how-to-get-the-last-message-uttered-by-bot/9105/3 "2019-04-29T12:04:09Z")

</div>

I believe this would give the users last message, not the bot utterance.

---

<div class="post-metadata">

**Author:** ![shubhamm](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@shubhamm](https://forum.rasa.com/u/shubhamm)\
**Post date:** [April 29, 2019, 12:04pm UTC](https://forum.rasa.com/t/how-to-get-the-last-message-uttered-by-bot/9105/4 "2019-04-29T12:04:46Z")

</div>

thanks for your response. But the tracker.latest\_message.text provides the messages provided by user only it doesn’t provide the messages uttered by bot/question asked. thanks

---

<div class="post-metadata">

**Author:** ![shubhamm](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@shubhamm](https://forum.rasa.com/u/shubhamm)\
**Post date:** [April 29, 2019, 12:05pm UTC](https://forum.rasa.com/t/how-to-get-the-last-message-uttered-by-bot/9105/5 "2019-04-29T12:05:25Z")

</div>

I too think that . Do you know the way to get it.

---

<div class="post-metadata">

**Author:** ![srikar\_1996](https://avatars.discourse-cdn.com/v4/letter/s/e274bd/32.png) [@srikar\_1996](https://forum.rasa.com/u/srikar_1996)\
**Post date:** [April 29, 2019, 12:11pm UTC](https://forum.rasa.com/t/how-to-get-the-last-message-uttered-by-bot/9105/6 "2019-04-29T12:11:24Z")

</div>

I’m not sure if it’s possible.

How would the latest bot message help you? It is picking up the responses from the domain file or actions anyway. The user message will be more helpful or the intent classification of the user message.

---

<div class="post-metadata">

**Author:** ![shubhamm](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@shubhamm](https://forum.rasa.com/u/shubhamm)\
**Post date:** [May 1, 2019, 6:04am UTC](https://forum.rasa.com/t/how-to-get-the-last-message-uttered-by-bot/9105/7 "2019-05-01T06:04:05Z")

</div>

Actually my values are conflicting b/w the two slots so in order to validate them correctly I want to do that.

---

<div class="post-metadata">

**Author:** ![liho](https://avatars.discourse-cdn.com/v4/letter/l/c37758/32.png) [@liho](https://forum.rasa.com/u/liho)\
**Post date:** [June 27, 2019, 1:59pm UTC](https://forum.rasa.com/t/how-to-get-the-last-message-uttered-by-bot/9105/8 "2019-06-27T13:59:27Z")

</div>

Hi, maybe this helps you:

```
from rasa_sdk import Action, Tracker
text = ''
for event in tracker.events:
    if (event.get("event") == "bot") and (event.get("event") is not None):
        text = event.get("text")
```
