How do I connect Slack to OpenClaw?
Connect Slack using Socket Mode (easiest) or HTTP webhook mode for server deployments.
OpenClaw offers two ways to connect to Slack: Socket Mode (no public URL needed, great for local development) and HTTP Mode (webhook-based, ideal for server deployments).
Quick Setup (Socket Mode)
The fastest way to get started. You don't need a public server URL.
Create a Slack app and enable Socket Mode. Then configure OpenClaw with your tokens:
{
"channels": {
"slack": {
"enabled": true,
"appToken": "xapp-...",
"botToken": "xoxb-..."
}
}
}Or use environment variables:
SLACK_APP_TOKEN=xapp-... SLACK_BOT_TOKEN=xoxb-...
Step-by-Step Setup
1. Create a Slack App
Go to https://api.slack.com/apps and create a new app from scratch.
2. Enable Socket Mode
In your Slack app settings, enable Socket Mode.
3. Generate App Token
Go to Basic Information → App-Level Tokens → Generate Token and Scopes. Add the scope connections:write. Copy the App Token (starts with xapp-).
4. Configure Bot Permissions
Go to OAuth & Permissions and add these bot token scopes:
chat:writeim:writechannels:history,groups:history,im:history,mpim:historychannels:read,groups:read,im:read,mpim:readusers:readapp_mentions:readreactions:read,reactions:writefiles:write
Click Install to Workspace and copy the Bot User OAuth Token (starts with xoxb-).
5. Enable Events
Go to Event Subscriptions → enable events and subscribe to:
message.channels,message.groups,message.im,message.mpimapp_mentionreaction_added,reaction_removedmember_joined_channel,member_left_channel
6. Configure OpenClaw
Add your tokens to the OpenClaw configuration or set them as environment variables.
# Via config openclaw config set channels.slack.enabled true openclaw config set channels.slack.appToken xapp-... openclaw config set channels.slack.botToken xoxb-... # Or via environment variables export SLACK_APP_TOKEN=xapp-... export SLACK_BOT_TOKEN=xoxb-...
7. Invite the Bot to Channels
Invite your Slack bot to any channels you want it to read from and reply in.
HTTP Mode (Webhook)
Use HTTP mode when your OpenClaw gateway is publicly accessible over HTTPS.
Setup for HTTP Mode
- Create a Slack app and disable Socket Mode
- Copy the Signing Secret from Basic Information
- Install the app and copy the Bot User OAuth Token
- Set Request URL to your webhook endpoint (default
/slack/events)
{
"channels": {
"slack": {
"enabled": true,
"mode": "http",
"botToken": "xoxb-...",
"signingSecret": "your-signing-secret",
"webhookPath": "/slack/events"
}
}
}Slash Commands
To use slash commands like /openclaw, create them in your Slack app under Slash Commands and set the Request URL to your endpoint (same as HTTP mode).
Troubleshooting
If Slack isn't working, run these commands:
openclaw status openclaw gateway status openclaw logs --follow openclaw doctor
Common issues:
- Bot not replying in channels: Make sure the bot is invited to the channel
- DMs ignored: Sender may need to be approved (check pairing)
- API errors: Check your bot token scopes are complete
Security Note
By default, DMs require pairing approval. Set channels.slack.dm.policy="open" and channels.slack.dm.allowFrom=["*"] if you want to allow anyone to DM your bot.