Connect Slack
OpenClaw integrates with Slack to provide an intelligent assistant for your team. It supports Socket Mode (easiest, works behind firewalls) and HTTP Mode (for public servers).
Prerequisites
Section titled “Prerequisites”- A Slack Workspace where you have permission to install apps.
- OpenClaw installed.
Setup Guide (Socket Mode)
Section titled “Setup Guide (Socket Mode)”Socket Mode is recommended for most users as it doesn’t require exposing a public IP address.
Create a Slack App
Section titled “Create a Slack App”Go to api.slack.com/apps and click Create New App. Choose From scratch, name it (e.g., “OpenClaw”), and pick your workspace.
Enable Socket Mode
Section titled “Enable Socket Mode”- Navigate to Socket Mode in the sidebar.
- Toggle Enable Socket Mode.
- Give the token a name (e.g., “Socket Token”) and click Generate.
- Copy the
xapp-...token. This is your App Token.
Configure Scopes
Section titled “Configure Scopes”Go to OAuth & Permissions. Scroll down to Bot Token Scopes and add:
app_mentions:read(to hear @mentions)chat:write(to reply)channels:history(to read public channels)groups:history(to read private channels)im:history(to read DMs)im:write(to send DMs)users:read(to know who is talking)files:write(to upload images/files)
Install App
Section titled “Install App”Scroll up to the top of OAuth & Permissions and click Install to Workspace.
- Copy the
xoxb-...token. This is your Bot Token.
- Copy the
Subscribe to Events
Section titled “Subscribe to Events”Go to Event Subscriptions.
- Toggle Enable Events.
- Expand Subscribe to bot events and add:
message.channelsmessage.groupsmessage.imapp_mentionmember_joined_channel
Enable DMs
Section titled “Enable DMs”Go to App Home.
- Check Allow users to send Slash commands and messages from the messages tab.
Configure OpenClaw
Section titled “Configure OpenClaw”Add the tokens to your
config.json.{channels: {slack: {enabled: true,// App Token (Socket Mode)appToken: "xapp-...",// Bot Token (OAuth)botToken: "xoxb-..."}}}
Threading Behavior
Section titled “Threading Behavior”Slack conversations often happen in threads. You can control how OpenClaw replies.
| Mode | Behavior | Config |
|---|---|---|
| Off (Default) | Replies in the main channel (unless the user is already in a thread). | replyToMode: "off" |
| First | The first reply starts a thread; subsequent replies stay in that thread. Keeps channels clean. | replyToMode: "first" |
| All | Every reply is threaded. | replyToMode: "all" |
Example:
{ channels: { slack: { // Thread DMs always, but keep group chats flat replyToModeByChatType: { direct: "all", group: "off" } } }}Access Control
Section titled “Access Control”Direct Messages
Section titled “Direct Messages”By default, OpenClaw uses Pairing Mode for DMs.
- Approve a user:
openclaw pairing approve slack <code> - Open to everyone:{channels: {slack: {dm: { policy: "open", allowFrom: ["*"] }}}}
Channel Access
Section titled “Channel Access”You can restrict which channels the bot responds to.
{ channels: { slack: { groupPolicy: "allowlist", channels: { "C12345678": { allow: true }, // Allow specific channel ID "#general": { allow: true } // Allow by name } } }}Troubleshooting
Section titled “Troubleshooting”Bot doesn’t respond to DMs:
- Did you enable the Messages Tab in the App Home section on api.slack.com?
- Did you subscribe to
message.imevents?
Bot doesn’t respond in channels:
- Did you invite the bot to the channel? (
/invite @OpenClaw) - Did you subscribe to
message.channels?
“missing_scope” error:
- Check the logs to see which scope is missing, then add it in OAuth & Permissions and Reinstall the App (you must reinstall for scope changes to take effect).