Get the last utter message from the bot

Hi everyone, I’m wondering how can if it’s possible to get the last utter message from the bot in RASA ? thank you !

Hi @Ahmed,

can you describe a bit more detailed in which context you want to access this message? Basically you can get that via - the question is, in which environment you want to access it!?


Thank’s @JulianGerhard,

In, I’d like to access to the last bot utterance in a FormAction.



that should be possible in every method that implements

tracker: Tracker

as an argument. If so, you could iterate over events:

for event in
    <do what you like>

Feel free to ask if help is needed.

I’m not able to extract the last utterance using the loop.

Which version you are using. Try: value = tracker.latest_message.get(‘text’)

1 Like
for slot, value in slot_values.items():
       ##goes back through the list of events and finds
       #the last utter_action
       for event in
           if event.get("event") == "bot":
                   print("event : ", event.get("text"))

I’m able to get all utterances. Thank’s for your help.