notice

This is unreleased documentation for Rasa Open Source Documentation Master/Unreleased version.
For the latest released documentation, see the latest version (2.0.x).

Version: Master/Unreleased

Slack

You first have to create a Slack app to get credentials. Once you have them you can add these to your credentials.yml.

Getting Credentials

How to get the Slack credentials: You need to set up a Slack app.

  1. To create the app go to Your Apps and click on Create New App.

  2. 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 from your running Rasa X or Rasa Open Source server.

  • Event subscriptions > Subscribe to bot events: message.channels, message.groups, message.im, message.mpim

  • App Home > Always Show My Bot as Online

  1. Get the Bot User OAuth Access Token from the OAuth & Permissions page. Click Install App to Workspace and allow access to your workspace. You will need to provide this value in your credentials later in these instructions. It should start with xoxb.

  2. In the “OAuth & Permissions > Redirect URLs” enter the endpoint for receiving Slack messages. This is the same URL you entered above for Interactivity & Shortcuts - http://<host>:<port>/webhooks/slack/webhook.

  3. Configure your credentials.yml with the new Slack credentials as described in the Running on Slack section, and restart your server. This will allow your server to confirm that the endpoint is ready to receive events. Once you've restarted the server, go to the “Event Subscriptions” section, turn on the “Enable Events” and add the endpoint as the Request URL.

For more detailed steps, visit the Slack API docs.

Running on Slack

Add the Slack credentials to your credentials.yml:

slack:
slack_token: "xoxb-286425452756-safjasdf7sl38KLls"
slack_channel: "C011GR5D33F"
proxy: "http://myProxy.online" # Proxy Server to route your traffic through. This configuration is optional.
slack_retry_reason_header: "x-slack-retry-reason" # Slack HTTP header name indicating reason that slack send retry request. This configuration is optional.
slack_retry_number_header: "x-slack-retry-num" # Slack HTTP header name indicating the attempt number. This configuration is optional.
errors_ignore_retry: None # Any error codes given by Slack included in this list will be ignored. Error codes are listed [here](https://api.slack.com/events-api#errors).
use_threads: False # If set to True, bot responses will appear as a threaded message in Slack. This configuration is optional and set to False by default.
  • The slack_channel can 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 Token in the “OAuth & Permissions” tab as your slack_token. It should start with xoxb.

  • Optional: You can add a proxy through which to route outgoing traffic to the Slack API. Only HTTP proxies are currently supported.

Restart your Rasa X or Rasa Open Source server to make the new channel endpoint available for Slack to send messages to.