TechBuzzPro

How to Integrate Rasa with Slack: Step-by-Step

· 5 min read · Apps & Browsers

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

You can integrate Rasa with Slack by creating a Slack app, enabling the Events API and bot scopes, exposing your Rasa server with a public URL, and adding the Slack channel credentials to your Rasa project. This guide walks through the full setup so your Rasa assistant answers messages in Slack channels and direct messages. You will need a running Rasa project, Python, and a Slack workspace where you can install apps.

What You'll Need

  • A working Rasa project (Rasa installed and a trained model).
  • A Slack workspace where you have permission to install apps.
  • A public HTTPS URL that forwards to your Rasa server (for local testing, a tunneling tool such as ngrok works).
  • Basic command-line familiarity and access to your Rasa credentials file.

Step-by-Step

  1. Create a Slack app. Go to the Slack API website, choose to create a new app, and select your workspace. Give it a name such as Rasa Assistant.
  2. Add bot scopes. In the app settings, open the OAuth & Permissions section. Under Scopes, add the bot token scopes your assistant needs: at minimum chat:write, channels:history, groups:history, im:history, and mpim:history. Add app_mentions:read if the bot should respond when mentioned. Save the changes.
  3. Enable the Events API. In the app settings, open Event Subscriptions and turn it on. Set the Request URL to https://YOUR_PUBLIC_URL/webhooks/slack/webhook. Slack will send a verification challenge; your Rasa server must be running and reachable for this to succeed. Subscribe to bot events: message.channels, message.groups, message.im, and message.mpim.
  4. Install the app to your workspace. Use the Install App section and approve the permissions. Copy the Bot User OAuth Token that Slack shows; it starts with xoxb-.
  5. Add the Slack channel to Rasa. In your Rasa project, open credentials.yml and add a slack section with the bot token and a signing secret. The signing secret is found in the app's Basic Information section. The block looks like this:
slack:
  slack_token: "xoxb-your-token"
  slack_signing_secret: "your-signing-secret"
  1. Start the Rasa server with the Slack channel enabled. Run rasa run with the credentials file and enable the channel, for example rasa run --credentials credentials.yml --enable-api --cors "*". Make sure the port matches what your public URL forwards to (the default is 5005).
  2. Expose the server publicly. If you are testing locally, start a tunnel to port 5005 and copy the HTTPS forwarding URL. Update the Slack Event Subscriptions Request URL to use that host followed by /webhooks/slack/webhook. Wait for Slack to show a verified checkmark.
  3. Test the integration. In Slack, invite the bot to a channel or send it a direct message. If the bot replies, the integration is working. If it does not, check the Rasa server logs for incoming requests and errors.

Common Mistakes

  • Using the wrong token: the bot token starts with xoxb-; a user token or app-level token will not work for this channel.
  • Forgetting the signing secret, which causes Slack requests to be rejected.
  • Setting the Request URL without the /webhooks/slack/webhook path, so Slack cannot verify the endpoint.
  • Not subscribing to the message events, so the bot never receives messages even though the URL verifies.
  • Running Rasa on a port that the tunnel or reverse proxy does not forward to.
  • Leaving the tunnel URL unchanged after restarting the tunnel; the public URL changes and Slack verification fails.

Tips

  • Keep the bot token and signing secret out of version control; use environment variables or a local credentials file that is ignored by Git.
  • Use a stable public URL for production rather than a temporary tunnel.
  • Test in a private channel first, then invite the bot to busier channels once replies look correct.
  • Check the Rasa server logs while testing; they show whether Slack requests arrive and whether the model responds.
  • If you change scopes or events, reinstall the app so Slack applies the new permissions.

Troubleshooting

If Slack will not verify the Request URL, confirm the Rasa server is running, the tunnel is active, and the path is exactly /webhooks/slack/webhook. A 404 usually means the path is wrong; a timeout usually means the server or tunnel is down.

If the bot does not reply, check that it was invited to the channel and that the message events are subscribed. In direct messages, the bot must be allowed to receive message.im events.

If replies are duplicated, check whether multiple Rasa instances are running against the same Slack app or whether the same event is subscribed twice.

If authentication errors appear in the logs, re-copy the bot token and signing secret, then restart Rasa. If you recently changed scopes, reinstall the app to the workspace.

Frequently Asked Questions

Do I need a public URL to integrate Rasa with Slack?

Yes. Slack sends events to your Rasa server over HTTPS, so the server must be reachable from the internet. A tunnel is fine for testing; use a stable host for production.

Which Slack token does Rasa need?

The Bot User OAuth Token that starts with xoxb-, plus the app's signing secret.

Can the bot work in direct messages?

Yes, if the message.im event is subscribed and the bot has the required scopes. Users can then message the app directly.

Why does Slack show a verification error?

The most common causes are a stopped Rasa server, an inactive tunnel, or a Request URL missing the webhook path. Fix the URL or restart the server and verify again.

Do I need to reinstall the Slack app after changing scopes?

Yes. Slack applies new scopes only after the app is reinstalled to the workspace.

Where do I put the Slack credentials in Rasa?

In credentials.yml under a slack section, then start Rasa with that credentials file.