How to get the last message uttered by bot

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.

@shubhamm try this.

message = tracker.latest_message.text

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

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

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

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.

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

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")