# How can I go back to previous menu in a story using buttons

**URL:** <https://forum.rasa.com/t/how-can-i-go-back-to-previous-menu-in-a-story-using-buttons/42996>\
**Category:** Rasa Open Source\
**Created:** [April 28, 2021, 9:10pm UTC](https://forum.rasa.com/t/how-can-i-go-back-to-previous-menu-in-a-story-using-buttons/42996 "2021-04-28T21:10:11Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ayantika1](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ayantika1/32/10216_2.png) [@Ayantika1](https://forum.rasa.com/u/Ayantika1)\
**Post date:** [April 28, 2021, 9:10pm UTC](https://forum.rasa.com/t/how-can-i-go-back-to-previous-menu-in-a-story-using-buttons/42996/1 "2021-04-28T21:10:11Z")

</div>

I want to go back to previous menu in my rasa story using button but I don’t know how

---

<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:** [April 29, 2021, 2:36pm UTC](https://forum.rasa.com/t/how-can-i-go-back-to-previous-menu-in-a-story-using-buttons/42996/2 "2021-04-29T14:36:31Z")

</div>

Buttons have payloads representing intents. Write a rule saying when that intents get detected, do a certain action (show the menu).

---

<div class="post-metadata">

**Author:** ![Ayantika1](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ayantika1/32/10216_2.png) [@Ayantika1](https://forum.rasa.com/u/Ayantika1)\
**Post date:** [April 29, 2021, 5:30pm UTC](https://forum.rasa.com/t/how-can-i-go-back-to-previous-menu-in-a-story-using-buttons/42996/3 "2021-04-29T17:30:51Z")

</div>

can you please help me with the action the current action I wrote calls the same menu options again but not the previous one and I need to write go back for each step in my rasa story so that the user can keep going back

---

<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:** [April 30, 2021, 11:25am UTC](https://forum.rasa.com/t/how-can-i-go-back-to-previous-menu-in-a-story-using-buttons/42996/4 "2021-04-30T11:25:15Z")

</div>

Let’s say what brings out the second menu is the intent `menu_two`.

As a response to `menu_two`, the bot will do `action_two`. You link the intent `menu_two` to the response `action_two` using rules.

Whether it is a custom action or a response, `action_two` should have a button to go back with payload `/menu_two`. So, according to the rule, `menu_two` will get detected and `action_two` will be executed again.

---

<div class="post-metadata">

**Author:** ![Ayantika1](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ayantika1/32/10216_2.png) [@Ayantika1](https://forum.rasa.com/u/Ayantika1)\
**Post date:** [May 2, 2021, 8:12am UTC](https://forum.rasa.com/t/how-can-i-go-back-to-previous-menu-in-a-story-using-buttons/42996/5 "2021-05-02T08:12:37Z")

</div>

I know this what I was asking is that can we go back to each step in a story like the way we move forward in a story

---

<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:** [May 2, 2021, 8:31pm UTC](https://forum.rasa.com/t/how-can-i-go-back-to-previous-menu-in-a-story-using-buttons/42996/6 "2021-05-02T20:31:39Z")

</div>

No need to create a new story just for it. It could even confuse the model.

Just one rule that says "when you detect intent `menu_two`, execute `action_two`".

So, when the back button is pressed, it will trigger `menu_two` which will in turn trigger `action_two` thanks to that rule.

---

<div class="post-metadata">

**Author:** ![Ayantika1](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ayantika1/32/10216_2.png) [@Ayantika1](https://forum.rasa.com/u/Ayantika1)\
**Post date:** [May 5, 2021, 3:39am UTC](https://forum.rasa.com/t/how-can-i-go-back-to-previous-menu-in-a-story-using-buttons/42996/7 "2021-05-05T03:39:11Z")

</div>

No no you don’t understand what I am saying. With thing I can go back to menu\_two only and not menu\_one and menu\_three…like a go back button for each step

---

<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:** [May 5, 2021, 6:43am UTC](https://forum.rasa.com/t/how-can-i-go-back-to-previous-menu-in-a-story-using-buttons/42996/8 "2021-05-05T06:43:28Z")

</div>

Yes, I understood. You’ll need to do that for every button/menu.

For each button, you put as payload the intent that leads to it.

---

<div class="post-metadata">

**Author:** ![Ayantika1](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ayantika1/32/10216_2.png) [@Ayantika1](https://forum.rasa.com/u/Ayantika1)\
**Post date:** [May 6, 2021, 11:45am UTC](https://forum.rasa.com/t/how-can-i-go-back-to-previous-menu-in-a-story-using-buttons/42996/9 "2021-05-06T11:45:27Z")

</div>

but then the back button will be different for each step… won’t that become messy

---

<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:** [May 6, 2021, 1:09pm UTC](https://forum.rasa.com/t/how-can-i-go-back-to-previous-menu-in-a-story-using-buttons/42996/10 "2021-05-06T13:09:14Z")

</div>

Not really, I don’t think so. I’ve done messier things haha

---

<div class="post-metadata">

**Author:** ![Ullas](https://avatars.discourse-cdn.com/v4/letter/u/c68b51/32.png) [@Ullas](https://forum.rasa.com/u/Ullas)\
**Post date:** [February 28, 2024, 8:20am UTC](https://forum.rasa.com/t/how-can-i-go-back-to-previous-menu-in-a-story-using-buttons/42996/11 "2024-02-28T08:20:53Z")

</div>

You just create a intent “back” and when send it as the payload of the button. When that button is clicked you delete the actions and last intent detected in the tracker. After that execute last action
