Rasa: How to add buttons - Rasa Open Source - Rasa Community Forum

👋 Introducing the Rasa Playground

Rasa: How to add buttons

post by KerenStoller on Feb 10, 2019

Hello My friend and I are trying to built a bot, using the Rasa platform, for the first time! We are trying to add a button, but we got stuck… We don’t know where we need to add the necessary ‘things’, to make the button work… We started by creating a button in the Domain file under the right template… But in the payload part, we got a little bit confused… Can someone help us understand how to continue? if this isn’t clear enough we can give more info!

post by srikar_1996 on Feb 10, 2019

Hey,

So buttons are used to give suggestions or possibly give the next set of actions which the user might ask while in conversation.

Here is an example:

templates:
  utter_greet:
  - text: "Hey! How can I help you?"
    buttons:
    - title: "What can you do?"
      payload: '/bot_functions'
  - text: "Hello! What can I do for you?"
    buttons:
    - title: "What can you do?"
      payload: '/bot_functions'
  - text: "Hi! What's up?"
    buttons:
    - title: "What can you do?"
      payload: '/bot_functions'
  - text: "Hey! How are you doing today?"

Here the utter_greet is the action taken by the bot under, for example, the greet intent. When the user says “Hey” the bot will respond with “Hey! How can I help you?”. These buttons would be sent along with the responses. So the “What can you do?” will be a text suggestion, but the intent /bot_functions will be sent to your bot when the user selects this option. So the /bot_function is the intent and you’re bypassing the interpreter and directly send the intent to the bot.

Here is a link to the docs: buttons

post by Ajinkz on Feb 11, 2019

It is necessary or optional to use quotes ''``"" while writing text, title, payload ???

post by srikar_1996 on Feb 11, 2019

Quotes are not required, just normal text. I’ve never tried adding quotes though. Are you asking about the content of text, title, payload or the ‘text’, ‘title’, ‘payload’?

post by Ajinkz on Feb 11, 2019

Yes, I was asking about content only

post by srikar_1996 on Feb 11, 2019

So I just tried it out without the quotes, and it works. Seems like the quotes are optional after-all.

post by luofanghao on Jun 25, 2019

is there a way to allow user to select button, or type text?

post by srikar_1996 on Jun 30, 2019

The buttons will be displayed below (or however you configure them if it’s a custom UI). The user can select the buttons or type text.

post by luofanghao on Jul 1, 2019

Oh okay now I understand. Button works just as type a special string. Though in Rasa Shell UI, it only accept to select from button, user cannot type anything.

post by vb2vish on Jul 5, 2019

Telegram => How to inactive or invisible buttons after click one of them. ?

post by Danny on Sep 10, 2019

on desktop, is there a method to allow the user to select a button using the keyboard, instead of using the mouse.

post by pausali.biswas on Oct 11, 2019

Can anyone help me with the same type of issues, if we are asking two different options via buttons and on selection of each there will be different set of utter actions, how can we put this in the story

post by sadque on Nov 6, 2019

- text: "Hi! What's up?"
    buttons:
    - title: "Text 1"
      payload: '/<intent 1>'
    - title: "Text 2"
      payload: '/<intent 2>'

You can add multiple buttons as shown above, As per the intent mentioned in the payload and story, bot will pick the response

post by touqeer on Feb 19, 2020

Can anyone please provide any example story for using buttons?

post by jonathanpwheat on Jun 23, 2020

The Rasa Financial Bot uses some yes/no buttons, starting around line 153 (at least the version that exists at this time)

post by neel_rasa on Nov 27, 2020

1)How do I create multiple buttons. Like for example. I created a button user, got multiple options, and again from those multiple options. How do I do that? 2)Under the same intent I have lots of questions. How do I create corresponding answers to each of those questions .

post by samvatsar on Jan 12, 2021

Can you explain with an example?

post by Amey-Naysathe on Apr 26, 2022

can we add only buttons without text message?