Adding buttons for Slackbot with Rasa

Hi everyone,

I have been doing some research, however, I cannot find any detail explanation about buttons for Slackbot. I can only find guidelines on “domain.yml” file but no further information.

I’m wondering if anyone has more specific documentation? I’m super new to both rasa and Python programming language :blush:

Thanks in advance!

adding buttons in domain file will trigger one event(or a payload). If you don’t know what is event or what is payload then consider it as something is fired when that particular condition occures. So when you fire a payload when any particular action is called.

If these things sound so new don’t worry, just understand that, when you deploy your bot with your own website(or on chat widget), the basic architecture is that you’ll have a backend server (rasa server) APIs and your frontend widget will call that APIs. One calling the API for the button case frontend will get a payload response. So At the frontend, you have to write CSS for the button.

Coming to slack, you can’t write the CSS of the button in slack. But Slack allows some events you can fire when your button action is called. You can find list of all the slack components here: Reference: Interactive components | Slack

Hi Ganesh!

First of all, thank you so much for your answer. I understand the concept of payload, however I don’t know where can I add this CSS for the button.

I searched on Slack API documentation and they provided some template for button, for example: { "type": "button", "text": { "type": "plain_text", "text": "Click Me" }, "value": "click_me_123", "action_id": "button" }

Should I make a .json file inside the directory where the other configuration files are already in? If so, how can I connect it?

I really appreciate your help! :slight_smile:

Oh got it. you don’t need to write css of the button, It’s already written there. You just need to fire the event to access the button. To do so you have to add payload in domain file.

you can refer these links: Reference: Block elements | Slack

I got it now!! But we also need to configure the events (or in this case, payloads), right?

For example if I want to ask users to rate the performance of the bot, then I will have 2 buttons “Helpful” or “Not helpful”, or I want them to click on the button to narrow down a topic of their questions.

Will I continue to further configure these in domain yaml file? If so, can you please show me where can I find documentation?

Thank you for being so patient and guide me through this!

As of now I can suggest one think that you can create two intents positive_feedback and negative_feedback and you can give the respected custom actions of these intents in the payload. for ex:

    - title: "helpful"
      payload: "positive_feedback"
    - title: "not helpful"
      payload: "negative_feedback"
1 Like

Aaah I understand now! So we will need 2 other intents for the payload. Am I interpreting your answer correctly now? :blush:


Thank you so so much!!! Enjoy your week! :innocent:

1 Like

thank you, i have same problem. thank you <3