# Using buttons and selecting them in Interactive learning

**URL:** <https://forum.rasa.com/t/using-buttons-and-selecting-them-in-interactive-learning/3920>\
**Category:** Rasa Open Source\
**Created:** [December 29, 2018, 4:10am UTC](https://forum.rasa.com/t/using-buttons-and-selecting-them-in-interactive-learning/3920 "2018-12-29T04:10:07Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arunkumar0258](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/arunkumar0258/32/1268_2.png) [@Arunkumar0258](https://forum.rasa.com/u/Arunkumar0258)\
**Post date:** [December 29, 2018, 4:10am UTC](https://forum.rasa.com/t/using-buttons-and-selecting-them-in-interactive-learning/3920/1 "2018-12-29T04:10:07Z")

</div>

I have some buttons which will be used in my bot to answer certain questions? But when I am doing interactive learning I am not able to choose between the buttons so that I can easily build up a story which my bot desires.

I am currently using Facebook as my main dialouge channel but when I choose a button, its not able to catch the correct intent. It can do it right if I have better stories, as it would be easier with interactive learning.

@akelad @abhishakskilrock Can you help you please?

---

<div class="post-metadata">

**Author:** ![abhishakskilrock](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/abhishakskilrock/32/4039_2.png) [@abhishakskilrock](https://forum.rasa.com/u/abhishakskilrock)\
**Post date:** [December 31, 2018, 4:32am UTC](https://forum.rasa.com/t/using-buttons-and-selecting-them-in-interactive-learning/3920/2 "2018-12-31T04:32:24Z")

</div>

Which version of rasa\_core are you using?

---

<div class="post-metadata">

**Author:** ![Arunkumar0258](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/arunkumar0258/32/1268_2.png) [@Arunkumar0258](https://forum.rasa.com/u/Arunkumar0258)\
**Post date:** [December 31, 2018, 5:16am UTC](https://forum.rasa.com/t/using-buttons-and-selecting-them-in-interactive-learning/3920/3 "2018-12-31T05:16:45Z")

</div>

@abhishakskilrock I am using rasa\_core v0.12.3

---

<div class="post-metadata">

**Author:** ![abhishakskilrock](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/abhishakskilrock/32/4039_2.png) [@abhishakskilrock](https://forum.rasa.com/u/abhishakskilrock)\
**Post date:** [December 31, 2018, 5:29am UTC](https://forum.rasa.com/t/using-buttons-and-selecting-them-in-interactive-learning/3920/4 "2018-12-31T05:29:12Z")

</div>

I think it should show buttons during interactive learning. Can you show me your actions logs and data you got during interactive learning?

---

<div class="post-metadata">

**Author:** ![Arunkumar0258](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/arunkumar0258/32/1268_2.png) [@Arunkumar0258](https://forum.rasa.com/u/Arunkumar0258)\
**Post date:** [December 31, 2018, 5:57am UTC](https://forum.rasa.com/t/using-buttons-and-selecting-them-in-interactive-learning/3920/5 "2018-12-31T05:57:15Z")

</div>

@abhishakskilrock Below are the screenshots for when I am running interactive learning in rasa core

 ![Screenshot%20from%202018-12-31%2011-17-55](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/c/ca8c516d55fe9ca09957666fddaac1c7ebe9e5ef.png)

It shows the buttons correctly (ignore the payload for now). But there is no option for selecting any one of them. It directly goes for action\_listen. But I want to be able to select any one of them so that I can continue the story.

Here is the actions log

 ![Screenshot%20from%202018-12-31%2011-18-42](https://europe1.discourse-cdn.com/flex013/uploads/rasa/original/2X/e/e6f7eb439107bdaa0edbe1316d923c4c275e4775.png)

Here is my actions.py code

> **[from \_\_future\_\_ import absolute\_importfrom \_\_future\_\_ import divisionfrom \_\_...](https://pastebin.com/LzAgP6Qw)**
>
> Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

Here is my train\_interactive.py code

> **[from \_\_future\_\_ import absolute\_importfrom \_\_future\_\_ import divisionfrom \_\_...](https://pastebin.com/eNazrdXs)**
>
> Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

---

<div class="post-metadata">

**Author:** ![oldmonkABA](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/oldmonkaba/32/698_2.png) [@oldmonkABA](https://forum.rasa.com/u/oldmonkABA)\
**Post date:** [December 31, 2018, 7:57am UTC](https://forum.rasa.com/t/using-buttons-and-selecting-them-in-interactive-learning/3920/6 "2018-12-31T07:57:41Z")

</div>

you have to type the payload value after action\_listen … See this [Using Slots](https://rasa.com/docs/core/slots/)

---

<div class="post-metadata">

**Author:** ![abhishakskilrock](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/abhishakskilrock/32/4039_2.png) [@abhishakskilrock](https://forum.rasa.com/u/abhishakskilrock)\
**Post date:** [December 31, 2018, 9:22am UTC](https://forum.rasa.com/t/using-buttons-and-selecting-them-in-interactive-learning/3920/7 "2018-12-31T09:22:46Z")

</div>

Hey, You can’t select buttons there you have to type the value(which shows on buttons). It will write stories based on your slots. BTW what do you want it should perform as I can see that you want to perform three actions based on your headache symptom if that’s the situation I think it will be better if you provide symptom slot to categorical whose values are **Moderate, Mild, Severe** and then make single custom\_action rather than three different custom\_action where I use `if-else` check based on slot value and give results based on that slots.

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [January 8, 2019, 10:47am UTC](https://forum.rasa.com/t/using-buttons-and-selecting-them-in-interactive-learning/3920/8 "2019-01-08T10:47:03Z")

</div>

@Arunkumar0258 yeah the way “selecting” buttons on the command line works is by copying the payload and sending it. Action\_listen just means the bot is waiting for your input, which is correct behaviour

---

<div class="post-metadata">

**Author:** ![Arunkumar0258](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/arunkumar0258/32/1268_2.png) [@Arunkumar0258](https://forum.rasa.com/u/Arunkumar0258)\
**Post date:** [January 8, 2019, 1:36pm UTC](https://forum.rasa.com/t/using-buttons-and-selecting-them-in-interactive-learning/3920/9 "2019-01-08T13:36:07Z")

</div>

@abhishakskilrock @akelad Thanks for clarifying that. But I another question. Actually three!!

1. What does the payload actually do? What’s it requirement? I am running the bot in Facebook chat, and when I am selecting a button, I don’t see the payload text as output. It outputs just my selection.

2. Can I get the value of payload in a variable after I select the button, and use it in my next iteration of action\_medicine.

3. Also, I want to access the text I write in action\_listen for intent action\_medicine as a variable so that I can use it in actions.py. How to do that?

Please can you help me? Thanks a lot

---

<div class="post-metadata">

**Author:** ![abhishakskilrock](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/abhishakskilrock/32/4039_2.png) [@abhishakskilrock](https://forum.rasa.com/u/abhishakskilrock)\
**Post date:** [January 9, 2019, 5:08am UTC](https://forum.rasa.com/t/using-buttons-and-selecting-them-in-interactive-learning/3920/10 "2019-01-09T05:08:26Z")

</div>

Hi @Arunkumar0258, I think it will be better if you fetch button from custom\_action rather than domain.yml file because you want to set you buttons dynamic(variable) so it will be easy if you use custom\_action for calling buttons. I think it will help to answer all of your questions.

---

<div class="post-metadata">

**Author:** ![Arunkumar0258](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/arunkumar0258/32/1268_2.png) [@Arunkumar0258](https://forum.rasa.com/u/Arunkumar0258)\
**Post date:** [January 9, 2019, 8:09am UTC](https://forum.rasa.com/t/using-buttons-and-selecting-them-in-interactive-learning/3920/11 "2019-01-09T08:09:03Z")

</div>

@abhishakskilrock I am currently creating dynamic buttons only, not using them from domain.yml. I have created a custom action named action\_medicine through which I am dispatching the button for selection. Can you help in getting the text in a variable which triggered that custom action.

Also is it possible to get the value of payload after I select the button?

---

<div class="post-metadata">

**Author:** ![abhishakskilrock](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/abhishakskilrock/32/4039_2.png) [@abhishakskilrock](https://forum.rasa.com/u/abhishakskilrock)\
**Post date:** [January 9, 2019, 9:18am UTC](https://forum.rasa.com/t/using-buttons-and-selecting-them-in-interactive-learning/3920/12 "2019-01-09T09:18:31Z")

</div>

I think you want to do it something like if fever is a then medicine button is Ma, fever is b medicine button is Mb. If so you can do it by creating a dictionary in config and call it using slots or utter\_latest\_message() or else if it’s not your problem then can you give me your test case so that I can understand it properly.

---

<div class="post-metadata">

**Author:** ![Arunkumar0258](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/arunkumar0258/32/1268_2.png) [@Arunkumar0258](https://forum.rasa.com/u/Arunkumar0258)\
**Post date:** [January 9, 2019, 9:40am UTC](https://forum.rasa.com/t/using-buttons-and-selecting-them-in-interactive-learning/3920/13 "2019-01-09T09:40:19Z")

</div>

@abhishakskilrock

It’s like I ask a question to the bot “I have a headache” The bot responds with : “How strong is your headache?” (from API) and gives three options

1. Mild
2. Moderate
3. Severe

Each of these has a follow-up question when I select them (given by API). I want the follow up question to show as a message. But in Facebook if I select the button Mild, I just get the text Mild written. I want to avoid Mind and write the actual follow-up question for the bot to answer.

Example of follow-up question (if selected Severe): “Do you have any physical injuries or anxiety?” (want this to show up as answer instead of Severe)

---

<div class="post-metadata">

**Author:** ![red-frog](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/red-frog/32/2293_2.png) [@red-frog](https://forum.rasa.com/u/red-frog)\
**Post date:** [March 27, 2019, 6:27am UTC](https://forum.rasa.com/t/using-buttons-and-selecting-them-in-interactive-learning/3920/14 "2019-03-27T06:27:08Z")

</div>

@Arunkumar0258I have suffer the same question, yet, are you solve it? Thanks!

---

<div class="post-metadata">

**Author:** ![Arunkumar0258](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/arunkumar0258/32/1268_2.png) [@Arunkumar0258](https://forum.rasa.com/u/Arunkumar0258)\
**Post date:** [March 27, 2019, 6:51am UTC](https://forum.rasa.com/t/using-buttons-and-selecting-them-in-interactive-learning/3920/15 "2019-03-27T06:51:55Z")

</div>

@red-frog If you are asking about selecting buttons for interactive learning in command line. See the comments above by @abhishakskilrock and @akelad

But I haven’t been able to solve my last problem of showing text other than payload in Facebook unfortunately!

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [March 29, 2019, 1:07pm UTC](https://forum.rasa.com/t/using-buttons-and-selecting-them-in-interactive-learning/3920/16 "2019-03-29T13:07:18Z")

</div>

But the bot will just respond with “Do you have any physical injuries or anxiety?” to what the user selected. Is that not fine?

Otherwise I think you may want to try quick replies, or a different channel

---

<div class="post-metadata">

**Author:** ![aniket](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@aniket](https://forum.rasa.com/u/aniket)\
**Post date:** [February 19, 2020, 4:12pm UTC](https://forum.rasa.com/t/using-buttons-and-selecting-them-in-interactive-learning/3920/17 "2020-02-19T16:12:10Z")

</div>

Is dynamic buttons working for you in custom actions?
