You first have to create a Slack app to get credentials.
Once you have them you can add these to your
How to get the Slack credentials: You need to set up a Slack app.
To create the app go to https://api.slack.com/apps and click on Create New App.
Activate the following features:
Interactivity & Shortcuts > Interactivity (if your bot uses any interactive components , e.g. buttons)
Add your Rasa request URL
http://<host>:<port>/webhooks/slack/webhook, replacing the host and port with the appropriate values that point to your Rasa X or Rasa Open Source deployment.
Event subscriptions > Subscribe to bot events:
App Home > Always Show My Bot as Online
Bot User OAuth Access Tokenfrom the OAuth & Permissions page. Click
Install App to Workspaceand allow access to your workspace. You will need to provide this value in your credentials later in these instructions. It should start with
In the “OAuth & Permissions > Redirect URLs” enter the endpoint for receiving Slack messages. This is the same URL you entered above for Interactivity & Shortcuts -
Go to the “Event Subscriptions” section, turn on the “Enable Events” and add the endpoint here also.
For more detailed steps, visit the Slack API docs.
Running on Slack
If you want to connect to the slack input channel using the run script, e.g. using:
Do not forget to run the action server if this is required by your bot, e.g. using:
You need to supply a
credentials.yml with the following content:
slack_channelcan be a channel or an individual person that the bot should listen to for communications, in addition to the default behavior of listening for direct messages and app mentions, i.e. “@app_name”. To get the channel id, right click on the channel choose Copy Link and the id will be the last component in the URL.
Use the entry for
Bot User OAuth Access Tokenin the “OAuth & Permissions” tab as your
slack_token. It should start with
Optional: You can add a
proxythrough which to route outgoing traffic to the Slack API. Only HTTP proxies are currently supported.
The endpoint for receiving slack messages is
the host and port with the appropriate values. This is the URL
you should add in the “OAuth & Permissions” section as well as
the “Event Subscriptions”.