Slackbot with Rasa

Where we Left

This is a continuation of the previous article: A journey to build and deploy your chatbot with Rasa and Slack. In the first part, we had a discussion about Rasa Stack. We then used two components of Rasa namely Rasa NLU and Rasa Core to build a fully functional chatbot and pushing it to Slack using Ngrok. We also saw how to design a conversation flow for a Rasa chatbot and use an external API.


In this article, We are going to make messages interactive by adding buttons, date pickers, and approve/deny option. To do so, we are going to make use of The Slack interactive message framework. I highly recommend that you read Part 1 before attempting this part.

Slack interactive messages

We will see some key points which are essential but we will not detail Slack interactive message framework. Why ? Because it is very well explained on the site! But also because I would like to show you how to do it from Rasa part

Interactive messages are much like other messages, only they contain buttons, a variety of menus types, or they have some custom actions available. Rather than remaining mostly static, interactive messages evolve over time. You try any of the slack interactive messages here

Message buttons and menus may travel almost anywhere a message goes.

And for sure, we can Attach them:

  • To our messages that Rasa bot sends.

How to do it ?

First of all, we have to configure our Slack app:

  1. go to Interactivity & Shortcuts, and turn it on :

Use the same Ngrok URL of your Rasa server in this format under the Request URL field:

That's it ! !

2. Now, We are going to update our domain.yml file so Rasa can tell Slack to use interactive components : buttons, date pickers, multi select buttons...

Wait ! Something is missing here ! ! Slack uses JSON for its components, and in the other hand, Rasa uses YAML (domain is a YAML file)...

Don't worry about it ! a simple conversion can do the trick, all you have to do is to pick the component you need and rewrite it with YAML format, finally your domain.yml will look like this :

Congratulations ! You have added some style to your bot responses :

Add date picker :


P.S: We can specify an initial date by adding

  type: datepicker
  initial_date: 2020-06-24

Add list of elements:

output :

Add buttons :

output :

Read Part 1 here

Useful resources :

  1. Building block
  2. Making messages interactive
  3. block elements

Thanks for reading!