Set slot and entity with Rasa buttons


I want to set an entity with a button:

  - text: "Hey! Would you like to purchase motor or home insurance?"
    - title: "Motor insurance"
      payload: '/inform{{"insurance":"motor"}}'
    - title: "Home insurance"
      payload: '/inform{{"insurance":"home"}}'

If I understand it correctly, the logic works as following:


My questions:

  1. Do I need this: ' ?
  2. Do I have to define the entities motor and home in the nlu.yml file? I don’t see why, because the entity should automatically be set by the button. In other words: the entity is hard coded. There is no NLU involed (according to my undestanding).
  3. Is there a way to directly set a slot with a button? Something like this for example:


That’s correct. Though you use single brackets inside Custom Actions.

You don’t necessarily need to use quotes around the payload.

Look at this example.

You’re correct. With the payload, you are forcing the bot to take this value as an entity.

I would still recommend adding the values in your examples though, just in case the user decides to types instead of clicking a button - unless you want to disable the text input when there are buttons.

The current way to set a slot via a payload is by setting its entity and having auto-fill.

1 Like

@ChrisRahme Thank you very much. Your response was very helpful to me! :100: :white_check_mark:

1 Like

Glad to know :slight_smile: Don’t hesitate to ask for more detail if something isn’t clear.

Could you please mark my reply as the solution so that future readers see the thread as resolved?

1 Like