How to get bot uttered message


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