How to Connect Openclaw to Slack: Step-by-Step Guide

Image
Table of contents: [Show]

Connect Openclaw to Slack

Quick Start

Connecting Openclaw to Slack lets you deploy AI agents directly into your workspace. Your team can interact with the bot via mentions, direct messages, and reactions. This guide walks you through creating a Slack app, configuring Socket Mode, and setting up the integration.

If you are new to Openclaw channel integrations, you might also want to read about Discord integration for another popular messaging platform.

Create and Configure the Slack App

Step 1: Create a New App

Go to the Slack API Dashboard and create a new App from scratch.

Step 2: Enable Socket Mode

Navigate to Socket Mode in the left sidebar and enable it. You will be prompted to generate an App-Level Token (starts with xapp-...). Grant it the connections:write scope and save this token.

Step 3: Add Bot Token Scopes

Go to OAuth & Permissions and add these required Bot Token Scopes:

chat:write channels:history, channels:read groups:history, groups:read im:history, im:read, im:write mpim:history, mpim:read, mpim:write users:read reactions:read pins:read emoji:read

Step 4: Subscribe to Bot Events

Navigate to Event Subscriptions, turn it on, and subscribe to these Bot Events:

app_mention message.channels, message.groups, message.im, message.mpim reaction_added, reaction_removed member_joined_channel, member_left_channel channel_rename pin_added, pin_removed

Step 5: Enable App Home

Go to App Home and enable the Messages Tab so users can send Direct Messages to your bot.

Step 6: Install to Workspace

Finally, go to Install App, install it to your workspace, and copy the Bot User OAuth Token (starts with xoxb-...).

Configure Openclaw

Add both tokens to your ~/.openclaw/openclaw.json configuration file:

{ "channels": { "slack": { "enabled": true, "mode": "socket", "appToken": "xapp-...", "botToken": "xoxb-..." } } }

Alternatively, for the default account, you can set these environment variables on your gateway host:

export SLACK_APP_TOKEN="xapp-..." export SLACK_BOT_TOKEN="xoxb-..."

For more advanced channel configurations, check out our guide on Microsoft Teams integration.

Best Practices & Troubleshooting

  • Token security: Never commit tokens to version control. Use environment variables or a secure secrets manager.
  • Socket Mode vs HTTP: Socket Mode is recommended for development and private workspaces. For public distribution, consider HTTP mode with proper request URL verification.
  • Rate limits: Slack imposes rate limits on API calls. Monitor your bot's usage if you have a large workspace.
  • Permissions: If the bot cannot read messages, verify that channels:history and groups:history scopes are granted and the bot is invited to the channel.
  • Reactions not working: Ensure reactions:read scope is added and the bot has access to the channel where reactions occur.

Once configured, restart your Openclaw gateway and your Slack bot will be ready to respond to mentions and DMs.