Integrating RASA chat bot with Slack
Shrijan Choudhary » I will try to maintain the brevity of the article without missing on any crucial step and I guarantee that if you follow the steps, you will have a working slack bot for yourself.
Creating a slack app
- To create the app go to Your Apps and click on Create New App.
Basic information: Scroll down to reach theDisplay Informationfilling the name, description, a photo and a background colour for your bot.


Authorization and Permission for your BOT
add the permissions for your bot so that it can read and write text messages with anyone who wants to interact with your bot.
-
Head over to
OAuth & Permissionsand scroll down toScopes. To add the permissionschat:writeim:readim:writeim:historympim:historyapp_mentions:readchannels:historygroups:historyreactions:write


- Scroll up and click
Install Appoption to install the app on slack with these permissions.
Setting up the RASA credentials.yml
- Copy the
Bot User OAuth Tokenand paste in thecredentials.ymlpage of your RASA project

- Head over to
Basic Informationto gather theSigning Secret.

- Keep the
slack_channelparameter empty.

Running scripts for actions, ngrok and shell.
-
Running the action script
Un-comment the
action_endpointtag in theendpoints.yml
$ rasa run actions -
Start your RASA shell
Make sure you are on the RASA project directory and the virtual environment of project
$ rasa run --port 5002 \ --connector slack \ --credentials credentials.yml \ --endpoints endpoints.yml \ --log-file out.log \ --cors * \ --enable-api \ --debug -
Start ngrok on the
5002port$ ngrok http 5002
-
Copy the URL and append
webhooks/slack/webhookto get something like below:https://b90b-202-44-192-214.ngrok.io/webhooks/slack/webhook
Final configurations on Slack
-
Go to the Event Subscription section and then toggle the Enable Events switch on the page to ensure it is ON.
-
Paste the above copied
ngrok URLto Request URL -
Waiting for a “Verified” remarks against your request URL section.

-
Go to
Subscribe to bot eventsand add the following events- message.channels
- message.groups
- message.im
- message.mpim

-
Save the changes and reinstall the app.
To start chatting with your bot, go to https://slack.com/intl/en-in/ and click Launch Slack to go to your workspace. Select your bot from the left hand side menu and start chatting! :)
