Adding buttons in YAML file

When am adding buttons in doamin.yml file we create with pattern

buttons:
- title: "Happy"
  payload: "utter_happy"
- title: "Sad"
  payload: "utter_cheer_up"

but when i train and open it using rasa x this pattern got reversed and the buttons are not working properly.

it changed to this pattern

- buttons:
  - payload: /National
    title: National
  - payload: /International
    title: International
   ```

it would be highly helpful if anybody respond on this topic!!
1 Like

Hi @Arunshowri, welcome to the community, can you share the whole code here, in the meantime I think you should right something like this:

utter_name_of_utter:
  - buttons:
    - payload: utter_happy
      title: Happy
    - payload: utter_cheer_up
      title: Sad
    text: some display message here

Also, I believe in the payload you should pass the intent that will trigger the utter, like:

If you have an intent : feeling_sad and an utter: utter_cheer_up perhaps it would something like this:

utter_mood:
  - buttons:
    - payload: /feeling_happy
      title: Happy
    - payload: /feeling_sad
      title: Sad
    text: How are you feeling today ?

Hope it helps

This is the code before training :

session_config: session_expiration_time: 60 carry_over_slots_to_new_session: true intents:

  • greet
  • goodbye
  • affirm
  • deny
  • mood_great
  • mood_unhappy
  • bot_challenge
  • news_search
  • national_news
  • international_news responses: utter_greet:
    • text: Hey! How are you? utter_news_search:
    • text: What would you prefer buttons:
      • title: National payload: /National
      • title: International payload: /International utter_national_news:
    • text: ‘Here is your national news: India Today’ utter_international_news:
    • text: ‘Here is your International news: India Today’ utter_cheer_up:
    • image: https://i.imgur.com/nGF1K8f.jpg text: ‘Here is something to cheer you up:’ utter_did_that_help:
    • text: Did that help you? utter_happy:
    • text: Great, carry on! utter_goodbye:
    • text: Bye utter_iamabot:
    • text: I am a bot, powered by Rasa.

here is the code after training:

session_config: session_expiration_time: 60 carry_over_slots_to_new_session: true intents:

  • greet
  • goodbye
  • affirm
  • deny
  • mood_great
  • mood_unhappy
  • bot_challenge
  • news_search
  • national_news
  • international_news responses: utter_greet:
    • text: Hey! How are you? utter_news_search:
    • buttons:
      • payload: /National title: National
      • payload: /International title: International text: What would you prefer utter_national_news:
    • text: ‘Here is your national news: India Today’ utter_international_news:
    • text: ‘Here is your International news: India Today’ utter_cheer_up:
    • image: https://i.imgur.com/nGF1K8f.jpg text: ‘Here is something to cheer you up:’ utter_did_that_help:
    • text: Did that help you? utter_happy:
    • text: Great, carry on! utter_goodbye:
    • text: Bye utter_iamabot:

Can you format your code (put it inside of `` ) or a send a screenshot please

hey eden ,

i’ve sent you the screenshots please check them and respond asap.

Hey @Arunshowri, where did you send them ?

check your email please!!