How do i create buttons in rasa X?

So I tried putting this code in my domain.yml file but whenever i load rasa x and go to that path, it doesn’t seem to work.

domain.yml

Templates:
  utter_init:
  - text: Hi ! I am your friendly xyz AI chatbot. You can select from the options below or type on your own?
    buttons:
    - title: Happy
      payload: /mood_great
    - title: Sad
      payload: /mood_unhappy

Output:

hey @Shiraz, can you try adding the value in the “title” fields of buttons in quotes, I mean this way:

title : “Happy”

@JiteshGaikwad has a good point, put your payloads also in quotes. Do your buttons work in rasa shell but not in Rasa X?

1 Like

That didn’t help… when i use that command “rasa train” it edits my domain.yml file and removes those quotes

Yes. They do work. I can use my arrow keys to make a choice. The problem still persists when i try the same thing in rasa x.

A quick hack that i found to get around the problem is to load an image before the buttons. The buttons then get displayed properly. But this can’t be a solution.

That’s quite strange. What version of Rasa X is it? We just released a new one yesterday, could you try updating to 0.19.3 and see if the problem persists?

I have the same issue, buttons are not displayed in rasa-x, while in rasa shell everything’s working as expected (I can move with arrows and chose an option).

The same happens with images, I don’t see them in rasa-x but I see at least a text with “Attachment: /path/to/my/image” in the console. Are images supported in rasa-x?

I’m using the latest version of rasa-x (0.19.5)

Hey guys. Just tested on 0.19.5, I don’t have any issues with buttons or images.

I see at least a text with “Attachment: /path/to/my/image” in the console. Are images supported in rasa-x?

Are you using image: or attachment: in your domain file?

Thanks for your answer, I was about to write that after upgrading also rasa to 1.1.6 I could see buttons too. I had an older version of rasa and latest version of rasa-x and that probably caused the issue with buttons.

About images, in my use case, I’m using dispatcher.utter_attachment(f"/path/to/my/image.jpeg") inside a custom form and I can’t see it in rasa-x.

Yes indeed, attachment could be anything, which is why it doesn’t auto-render as an image. I’m afraid that I don’t think there is currently a way to get images from custom actions rendering in rasa X. However there was just recently a PR to add a utter_image_url method to the dispatcher class here – once that version of SDK is released, I believe images dispatched using that method would render in rasa X.

That’s nice! I will give it a try whenever there will be a new release, thanks!

erohmensing Does Buttons works fine with Rasa? or Do i need to install Rasa X