Rasa: How to add buttons


(KerenStoller) #1

Hello My friend and I are trying to built a bot, using the Rasa platform, for the first time! :slight_smile: We are trying to add a button, but we got stuck… :confused: 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! :slight_smile:

(Srikar) #2


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:

  - text: "Hey! How can I help you?"
    - title: "What can you do?"
      payload: '/bot_functions'
  - text: "Hello! What can I do for you?"
    - title: "What can you do?"
      payload: '/bot_functions'
  - text: "Hi! What's up?"
    - 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

(Ajinkz) #3

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

(Srikar) #4

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’?

(Ajinkz) #5

Yes, I was asking about content only :nerd_face:

(Srikar) #6

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