# Tracking the latest utter/action of chatbot

**URL:** <https://forum.rasa.com/t/tracking-the-latest-utter-action-of-chatbot/48630>\
**Category:** Rasa Open Source\
**Created:** [October 21, 2021, 3:48am UTC](https://forum.rasa.com/t/tracking-the-latest-utter-action-of-chatbot/48630 "2021-10-21T03:48:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![miner](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@miner](https://forum.rasa.com/u/miner)\
**Post date:** [October 21, 2021, 3:48am UTC](https://forum.rasa.com/t/tracking-the-latest-utter-action-of-chatbot/48630/1 "2021-10-21T03:48:46Z")

</div>

Hi,

As described in [https://rasa.com/docs/action-server/sdk-tracker](https://rasa.com/docs/action-server/sdk-tracker), we can use Tracker to recall the latest user’s intent/entity/message, but what about getting the bot’s latest utter/action? Please take a look at this story.

```auto
- story: Cognitive Behavioral Therapy (dealing with blaming)
  steps:
  - intent: feel_sad_due_to_someone
  - action: utter_empathy
  - action: ask_scale_sadness
  - intent: scale_sadness
  - action: ask_why_sad_due_to_someone
  - intent: nlu_fallback
  - action: action_dealwith_wildcard_fallback
  - action: utter_medidation_for_being_independent

```

> “action\_dealwith\_wildcard\_fallback” should result in “utter\_rephrase” or “utter\_emotion\_is\_from\_you” depending on the latest action.

As you can see, I will use “nlu\_fallback” as a wildcard intent, and it is really important for “action\_dealwith\_wildcard\_fallback” to get “ask\_why\_sad\_due\_to\_someone” to respond properly. Please let me know if there is a way for this. Thanks!

---

<div class="post-metadata">

**Author:** ![ChrisRahme](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chrisrahme/32/15572_2.png) [@ChrisRahme](https://forum.rasa.com/u/ChrisRahme)\
**Post date:** [October 21, 2021, 5:48am UTC](https://forum.rasa.com/t/tracking-the-latest-utter-action-of-chatbot/48630/2 "2021-10-21T05:48:02Z")

</div>

Hello!

You could set a slot when `action_dealwith_wildcard_fallback` is executed. In `action_dealwith_wildcard_fallback`, you can check if that slot is set and do your thing. Don’t forget to unset the slot after that.

Or, take a look at [`tracker.events_after_latest_restart`](https://rasa.com/docs/action-server/sdk-tracker#trackerevents_after_latest_restart).

---

<div class="post-metadata">

**Author:** ![miner](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@miner](https://forum.rasa.com/u/miner)\
**Post date:** [October 21, 2021, 6:01am UTC](https://forum.rasa.com/t/tracking-the-latest-utter-action-of-chatbot/48630/3 "2021-10-21T06:01:11Z")

</div>

Setting a slot when `action_dealwith_wildcard_fallback` is executed cannot give any clue for whether the bot has to say `utter_rephrase` or `utter_emotion_is_from_you`. If we can set a slot for `ask_why_sad_due_to_someone`, it sounds plausible. Can we set a special slot for the bot’s response as well? I guess it is for NLU only.

---

<div class="post-metadata">

**Author:** ![miner](https://avatars.discourse-cdn.com/v4/letter/m/c67d28/32.png) [@miner](https://forum.rasa.com/u/miner)\
**Post date:** [October 21, 2021, 6:07am UTC](https://forum.rasa.com/t/tracking-the-latest-utter-action-of-chatbot/48630/4 "2021-10-21T06:07:41Z")

</div>

Seems the solution from [Getting last executed action(not action\_listen)](http://forum.rasa.com/t/getting-last-executed-action-not-action-listen/9580) can be an answer. Thank you all!

---

<div class="post-metadata">

**Author:** ![ChrisRahme](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chrisrahme/32/15572_2.png) [@ChrisRahme](https://forum.rasa.com/u/ChrisRahme)\
**Post date:** [October 21, 2021, 8:55am UTC](https://forum.rasa.com/t/tracking-the-latest-utter-action-of-chatbot/48630/5 "2021-10-21T08:55:40Z")

</div>

> [@miner](#):
>
> If we can set a slot for `ask_why_sad_due_to_someone`, it sounds plausible

I probably misunderstood what you want to check exactly, but the general idea is still the same 🙂

Glad you solved it anyway!

If I’m correct, the proposed solution [there](http://forum.rasa.com/t/getting-last-executed-action-not-action-listen/9580), using `tracker.events`, is in essence the same as the one I proposed using `tracker.events_after_latest_restart`.
