Set entities with buttons

Hi, there I would like to set an entity by using a button I used this code

  utter_orientation:
  - text: "Please, choose your orientation"
  - buttons:
    - title: "Teacher directed"
      payload: /arguments{"orientation":"teacher directed"}
    - title: "Learner directed"     
      payload: /arguments{"orientation":"learner directed"}

but I have this error

YamlValidationException: Failed to validate 'C:\Users\Crypto\Documents\Rasa proj\domain.yml'. Please make sure the file is correct and all mandatory parameters are specified. Here are the errors found during validation:
  in C:\Users\Crypto\Documents\Rasa proj\domain.yml:417:
      <SchemaError: error code 2: Missing 'text' or 'custom' key in response or null 'text' value in response.: Path: '/'>. Path: /responses/utter_orientation

You shouldn’t put - before buttons (unless there’s nothing before it):

  utter_orientation:
  - text: "Please, choose your orientation"
    buttons:
    - title: "Teacher directed"
      payload: /arguments{"orientation":"teacher directed"}
    - title: "Learner directed"     
      payload: /arguments{"orientation":"learner directed"}

Edit: Indeed, as Raoul said below, use {{ }} instead of { } so that the bot does not mistake it for a variable in a response. You can safely use single brackets inside of a Custom Action though.

…and do not forget the double curly braces around the entities!

payload: /arguments{{"orientation":"teacher directed"}}

see Responses (rasa.com)

2 Likes

Thank you for your response

1 Like