# How to use action\_back?

**URL:** <https://forum.rasa.com/t/how-to-use-action-back/45268>\
**Category:** Rasa Open Source\
**Created:** [July 1, 2021, 9:28am UTC](https://forum.rasa.com/t/how-to-use-action-back/45268 "2021-07-01T09:28:54Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ronankff](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@ronankff](https://forum.rasa.com/u/ronankff)\
**Post date:** [July 1, 2021, 9:28am UTC](https://forum.rasa.com/t/how-to-use-action-back/45268/1 "2021-07-01T09:28:54Z")

</div>

I’ve attempted to use action\_back, I saw it referenced here: [Default Actions](https://rasa.com/docs/rasa/default-actions/)

Is there a guide available on how to trigger it?

I tried just entering /back into the command line and nothing was picked up. Then I created an intent called /back, trained it, and triggered it but nothing happened there either.

Any help would be much appreciated

Is this feature still supported?

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [July 1, 2021, 11:37am UTC](https://forum.rasa.com/t/how-to-use-action-back/45268/2 "2021-07-01T11:37:32Z")

</div>

@ronankff Hi. I will suggest make an intent like `go_back`, and then trigger like this

```auto
    go_back:
        triggers: action_back

```

```
    actions:
       - action_back
```

---

<div class="post-metadata">

**Author:** ![ronankff](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@ronankff](https://forum.rasa.com/u/ronankff)\
**Post date:** [July 1, 2021, 11:49am UTC](https://forum.rasa.com/t/how-to-use-action-back/45268/3 "2021-07-01T11:49:40Z")

</div>

Thanks for the reply @nik202, I’ll give that a shot

---

<div class="post-metadata">

**Author:** ![ronankff](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@ronankff](https://forum.rasa.com/u/ronankff)\
**Post date:** [July 1, 2021, 1:58pm UTC](https://forum.rasa.com/t/how-to-use-action-back/45268/4 "2021-07-01T13:58:03Z")

</div>

Hey @nik202, I set up the bot as you said. Can you confirm for me that this is the way the back function works:

![output](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/6/61e51b12d77242931807fed9d5e76ee8652959c2.png)

Story is as follows:

![output2](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/f/f70b22d2584555dcfe7674b89a2cd761669de467.png)

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [July 1, 2021, 3:24pm UTC](https://forum.rasa.com/t/how-to-use-action-back/45268/5 "2021-07-01T15:24:01Z")

</div>

@ronankff have you updated config.yml file

**action\_back** ([Default Actions](https://rasa.com/docs/rasa/default-actions#action_back))

This action undoes the last user-bot interaction. It can be triggered by the user by sending a “/back” message to the assistant if the [RulePolicy](https://rasa.com/docs/rasa/policies#rule-policy) is configured.

```
policies:
  - name: "RulePolicy"
    core_fallback_threshold: 0.3
    core_fallback_action_name: action_default_fallback
    enable_fallback_prediction: true
    restrict_rules: true
    check_for_contradictions: true

```

In your stories, you not mention action?

I guess you using Rasa 1.X ? Right? If you are using Rasa Open Source please updated to Rasa 2.7.1 or 2.6.2

---

<div class="post-metadata">

**Author:** ![ronankff](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@ronankff](https://forum.rasa.com/u/ronankff)\
**Post date:** [July 1, 2021, 4:21pm UTC](https://forum.rasa.com/t/how-to-use-action-back/45268/6 "2021-07-01T16:21:01Z")

</div>

I am using 1.x, apologies I forgot to even mention that.

Unfortunately we’re not in the position to upgrade versions right now. According to the Legacy docs the correct policy for this action is MappingPolicy, which I have included

 ![config](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/2/28b61dbd9d9e2c3185aaa3d6595f1b2ce83ba22f.png)

Good spot with the stories file too, I changed it.

 ![newstory](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/7/7505782c8267002738f07238075cd48f25d9636b.png)

Running with the above setup gets me this error:

I’m a bit confused because as far as I can tell action\_back doesn’t need to be initialised in the actions file.

 ![error](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/5/53fcee88d3f3c116577465df2bc052c1ac6555d1.png)

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [July 1, 2021, 4:33pm UTC](https://forum.rasa.com/t/how-to-use-action-back/45268/8 "2021-07-01T16:33:43Z")

</div>

@ronankff

did you mention this in domain.yml?

```
    actions:
       - action_back

```

Is your action\_back is a function in action.py with trigger utterance?

An alternative solution, if you want to go back to the previous menu. In that, I can help if you want? For Rasa Ver 1.X

**For example:**

**Bot:** How are you doing? or some menu Rasa | Rasa X

**User:** I’m fine

Button: previous menu

**User:** user select previous menu

**Bot:** How are you doing? or some menu Rasa | Rasa X

and so on.

I am sorry, a lot have change from Rasa 1.x to Rasa 2.7.1. It’ bit confusing for me also 😛 But, I honestly want to assist you @ronankff

---

<div class="post-metadata">

**Author:** ![ronankff](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@ronankff](https://forum.rasa.com/u/ronankff)\
**Post date:** [July 1, 2021, 5:09pm UTC](https://forum.rasa.com/t/how-to-use-action-back/45268/9 "2021-07-01T17:09:15Z")

</div>

Yes, I have the action registered in the domain. My action\_back is not a function in action.py yet. I thought that it would be built into Rasa as it’s a default action. Do I have to create it myself? If so, what code do I need?

Thank you for offering an alternative but I the product owner wanted something that would take you back in the conversation. For example:

- User - Hello
- Bot - Hello, how can I help?
- User - See menu
- Bot - _menu options_
- User - /back
- Bot - Hello, how can I help?

Does that make sense to you?

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [July 1, 2021, 5:11pm UTC](https://forum.rasa.com/t/how-to-use-action-back/45268/10 "2021-07-01T17:11:01Z")

</div>

@ronankff Yes.It fine customer is always right! Mean while if you can share your all files it will be great to test. Thanks.

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [July 1, 2021, 5:42pm UTC](https://forum.rasa.com/t/how-to-use-action-back/45268/12 "2021-07-01T17:42:17Z")

</div>

@ronankff python version? can you create the requirement file for me

`pip freeze > requirements.txt`

---

<div class="post-metadata">

**Author:** ![ronankff](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@ronankff](https://forum.rasa.com/u/ronankff)\
**Post date:** [July 1, 2021, 5:47pm UTC](https://forum.rasa.com/t/how-to-use-action-back/45268/13 "2021-07-01T17:47:20Z")

</div>

Python 3.9.5

[REMOVED]

Was the original command I used to set that up.

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [July 1, 2021, 5:51pm UTC](https://forum.rasa.com/t/how-to-use-action-back/45268/14 "2021-07-01T17:51:30Z")

</div>

@ronankff using rasa-x?

Hope you aware of this You can install Rasa Open Source using pip (requires Python 3.6, 3.7 or 3.8).

Its fine if your rasa x is running on python 3.9

---

<div class="post-metadata">

**Author:** ![ronankff](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@ronankff](https://forum.rasa.com/u/ronankff)\
**Post date:** [July 1, 2021, 6:06pm UTC](https://forum.rasa.com/t/how-to-use-action-back/45268/15 "2021-07-01T18:06:47Z")

</div>

I’m not using rasa x for this particular task. I’m just trying to make a small demonstration of the back button working and then we’ll add it to the larger project once we know it works.

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [July 1, 2021, 10:29pm UTC](https://forum.rasa.com/t/how-to-use-action-back/45268/16 "2021-07-01T22:29:28Z")

</div>

@ronankff You want something like this? Sorry for late reply was busy in office work and deadlines.

 ![Screenshot 2021-07-01 at 11.25.07 PM](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/c/c98ae7f800ef3109e098bb729b8aae5efc6e1a89.png) ![Screenshot 2021-07-01 at 11.27.07 PM](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/b/bf840ca0d339511022557d17b93f3af3d563aa3f.png)

OR

you want to go back to the previous step/stage every time? When you say “go back”, “back”, "put me back "

Please consider this (back option) process (dialogue conversation) based on the project. Can I ask what’s are your project objective?

I have taken this thread [How to use action\_back? - #9 by ronankff](http://forum.rasa.com/t/how-to-use-action-back/45268/9) as a example and checked and fixed your code.

Please give me more example(as shown in above thread) so that I can help you more. Thanks.

---

<div class="post-metadata">

**Author:** ![ronankff](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@ronankff](https://forum.rasa.com/u/ronankff)\
**Post date:** [July 1, 2021, 10:48pm UTC](https://forum.rasa.com/t/how-to-use-action-back/45268/17 "2021-07-01T22:48:49Z")

</div>

Oh no problem man, I appreciate the help.

Ideally what they want is that the bot goes back to the previous step. That’s why I’m trying to get action\_back working.

The project has a lot of conversations and sometimes people press the wrong button or whatever and want to go back and hit the right button.

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [July 1, 2021, 10:50pm UTC](https://forum.rasa.com/t/how-to-use-action-back/45268/18 "2021-07-01T22:50:27Z")

</div>

@ronankff Oh my bad, I see the example and based on that trying to fix. I will see much more tomorrow. Its late now in UK. Will find solution 🙂

---

<div class="post-metadata">

**Author:** ![ronankff](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@ronankff](https://forum.rasa.com/u/ronankff)\
**Post date:** [July 3, 2021, 11:53am UTC](https://forum.rasa.com/t/how-to-use-action-back/45268/19 "2021-07-03T11:53:45Z")

</div>

Hi @nik202, any luck?

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [July 3, 2021, 11:57am UTC](https://forum.rasa.com/t/how-to-use-action-back/45268/20 "2021-07-03T11:57:42Z")

</div>

@ronankff I have seen some example, everyone using action\_back function. But nothing is working as they have suggested. Do you have any links which I can see and try to fix your code.

---

<div class="post-metadata">

**Author:** ![ronankff](https://avatars.discourse-cdn.com/v4/letter/r/48db29/32.png) [@ronankff](https://forum.rasa.com/u/ronankff)\
**Post date:** [July 3, 2021, 12:50pm UTC](https://forum.rasa.com/t/how-to-use-action-back/45268/21 "2021-07-03T12:50:25Z")

</div>

Would you mind sharing these examples? I can try implement them myself, it’s just hard to find anything on it.

---

<div class="post-metadata">

**Author:** ![nik202](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/nik202/32/16098_2.png) [@nik202](https://forum.rasa.com/u/nik202)\
**Post date:** [July 3, 2021, 12:51pm UTC](https://forum.rasa.com/t/how-to-use-action-back/45268/22 "2021-07-03T12:51:46Z")

</div>

@ronankff Sure Please.

> [@Back to the question before if the user were wrong](http://forum.rasa.com/t/back-to-the-question-before-if-the-user-were-wrong/11310/16):
>
> @erohmensing Hi, Here is an example of my code. In a FormAction, I would like for the user to be able to correct his answer and go back to the former question. For example, the bot will ask for the name (“nom”) and the user will write it. The bot will then ask for the surname. At that moment, if the user write “retour”, the bot should ask again for the name (and put the right value in the slot). action.py Class CreateForm(FormAction): “”“Example of a custom form action”"" def name(self): …

@ronankff

> [@Rasa 1.0 Mapping Policy](http://forum.rasa.com/t/rasa-1-0-mapping-policy/10893/6):
>
> OK, in case anyone is still struggling with the Mapping Policy of Rasa 1.0, this is what I did to make it work: Put this in endpoints.yml action\_endpoint: url: "http://localhost:5055/webhook" Create an actions.py in your working folder with your custom action. For me, this was: from rasa\_sdk import Action from rasa\_sdk.events import UserUtteranceReverted class FaqEnrollment(Action): """Revertible mapped action for utter\_faq\_enrollment""" def name(self): return "action\_fa…

@ronankff

> <https://github.com/RasaHQ/rasa/blob/main/rasa/core/actions/action.py>

@ronankff

> **[Default Actions](https://rasa.com/docs/rasa/default-actions/#action_back)**

@ronankff Honestly, I have seen so many examples, and want to provide at-most help. But, some process is hard to implement, so as a developer we found the atternative. If I found any more links or even solution; I will post here. Cheers!

[Next page](https://forum.rasa.com/t/how-to-use-action-back/45268.md?page=2)
