Slack
Connect OpenClaw to Slack for always-on agent deployment in your workspace. Works behind firewalls with Socket Mode.
Slack is the best channel for work contexts. Socket Mode keeps your agent connected without requiring a public URL, and it works reliably behind firewalls and corporate VPNs.
Creating Your Slack App
- Go to api.slack.com/apps and click Create New App
- Choose From scratch
- Name it (something like "My Assistant") and select your workspace
- Under Socket Mode, enable it and generate an App-Level Token with
connections:writescope - Under OAuth & Permissions, add these Bot Token Scopes:
chat:write— send messagesim:history— read DMschannels:history— read channel messages (only channels you add the bot to)app_mentions:read— detect @mentions
- Install the app to your workspace and copy the Bot Token
Save your tokens as environment variables:
export SLACK_BOT_TOKEN="xoxb-..."
export SLACK_APP_TOKEN="xapp-..."
export SLACK_SIGNING_SECRET="..."Configuration
{
"channels": {
"slack": {
"enabled": true,
"mode": "socket",
"dmPolicy": "pairing",
"groupPolicy": "mention",
"requireMention": true,
"botToken": "${SLACK_BOT_TOKEN}",
"appToken": "${SLACK_APP_TOKEN}",
"signingSecret": "${SLACK_SIGNING_SECRET}",
"allowedChannels": [
"C0123456789"
],
"threadReplies": true
}
}
}Socket Mode vs. Events API
Socket Mode (Recommended)
Creates a persistent WebSocket connection — no public URL required. Works behind firewalls. Automatically reconnects after interruptions.
This is what most setups should use. Reliable enough to run continuously for weeks without issues.
Events API
Requires a publicly accessible webhook URL. Slack sends event notifications to your URL when things happen. Use this only if your infrastructure can't support outbound WebSocket connections.
Interactive Replies
As of v2026.3.24, Slack replies have full rich reply parity for direct deliveries. If your agent's response ends with a simple Options: block, OpenClaw auto-renders those options as interactive buttons or select menus in Slack — no extra configuration needed.
Example agent output:
Here are three approaches for the migration:
Options:
- Run the migration now
- Schedule for tonight
- Skip this cycleThis renders as clickable buttons in Slack. Interactive setup defaults have also been improved and reply controls are isolated from plugin interactive handlers, so custom plugins won't interfere with standard reply buttons.
Security Recommendations
Restrict bot access to dedicated channels. Don't add your agent bot to every channel in your workspace. Create a #assistant channel and invite the bot there.
Minimal scopes. Only request the OAuth scopes you actually need. Avoid channels:read on all channels — be specific.
Separate workspaces. If you're using this for personal purposes in a work Slack, consider creating a personal workspace instead of mixing them.
Store tokens in environment variables, never directly in config files. Your openclaw.json should only reference ${SLACK_BOT_TOKEN}, not the actual token value.
Threading
With threadReplies: true, your agent responds in threads rather than the main channel. This keeps channels clean and makes it easy to track conversations.
To start a fresh conversation, message the bot directly (DM) rather than in a channel.
Testing
After setup, DM your bot:
Hey, are you there?Or @mention it in your allowed channel:
@YourBot what's the weather today?Check logs if it doesn't respond:
openclaw logs --follow | grep slack