How to get bot uttered message

Hi,

Is there any way to get bot’s last uttered message. like when i do this dispatcher.utter_message(json_message=json_message). I need to get that last message

Not sure if that’s the best way, but on each utter_message(msg) you can set msg inside a slot.

msg = "This is an example"
dispatcher.utter_message(msg)
return [SlotSet("last_message", msg)]

And then if you need to get the last message:

last_message = tracker.get_slot("last_message")

Thank @ChrisRahme for your response.

Yes, this is one way. But i was looking for something that does not require the use of slots.

Look at Tracker.events_after_latest_restart, is it good enough?