Introduction
Slack is one of the most widely used collaboration tools in enterprise teams. Connecting OpenClaw to Slack provides your team with an always-available AI assistant that can answer questions, generate content, and help with everyday tasks. This article walks through the entire process from creating a Slack App to completing the connection.
Prerequisites
- OpenClaw is installed and running
- You have admin permissions for the Slack workspace
- The workspace allows installation of custom apps
Choosing a Connection Method
OpenClaw supports two methods for connecting to Slack:
| Method | Description | Best For |
|---|---|---|
| Socket Mode | Connects via WebSocket; no public URL needed | Local deployments, internal networks |
| Event Subscriptions | Receives events via HTTP Webhook | Public servers, production environments |
Socket Mode is recommended for beginners — it is simpler to configure and does not require a public IP or domain.
Step 1: Create a Slack App
1.1 Visit the Slack API Platform
Go to Slack API and click Create New App.
1.2 Choose the Creation Method
Select From scratch:
- Enter the app name, e.g., "OpenClaw Assistant"
- Select the workspace to install it in
- Click Create App
1.3 Basic Information Setup
On the Basic Information page:
- Upload an app icon
- Fill in the app description
- Note down the Signing Secret — you will need it later
Step 2: Configure Permissions and Events
2.1 Set Bot Token Scopes
Click OAuth & Permissions in the left sidebar, scroll to Bot Token Scopes, and add the following permissions:
Required Bot Token Scopes:
├── app_mentions:read - Read @mention messages
├── channels:history - Read public channel message history
├── channels:read - View public channel information
├── chat:write - Send messages
├── groups:history - Read private channel message history
├── groups:read - View private channel information
├── im:history - Read direct message history
├── im:read - View direct message information
├── im:write - Send direct messages
├── mpim:history - Read group direct message history
├── reactions:write - Add emoji reactions
├── users:read - View user information
└── files:read - Read files (optional, for processing uploaded files)
2.2 Configure Event Subscriptions
Click Event Subscriptions in the left sidebar and toggle Enable Events on.
Using Socket Mode (Recommended)
If you choose Socket Mode, no Request URL is needed. Click Socket Mode in the left sidebar and enable it:
- Click Enable Socket Mode
- Name the App-Level Token (e.g., "openclaw-socket")
- Add the scope:
connections:write - Click Generate and save the generated Token (starts with
xapp-)
Using Event Subscriptions HTTP Method
If you choose the HTTP method, start OpenClaw first and ensure it is publicly accessible, then enter the Request URL:
https://your-domain.com/webhook/slack/events
2.3 Subscribe to Bot Events
In the Subscribe to bot events section of the Event Subscriptions page, add the following events:
| Event | Description |
|---|---|
app_mention |
Triggered when someone @mentions the Bot |
message.channels |
New message in a public channel |
message.groups |
New message in a private channel |
message.im |
New direct message |
message.mpim |
New group direct message |
Click Save Changes to save.
Step 3: Install the App to the Workspace
- Go back to the OAuth & Permissions page
- Click Install to Workspace
- Review the permissions and click Allow
- After installation, copy the Bot User OAuth Token (starts with
xoxb-)
Step 4: Configure OpenClaw
4.1 Socket Mode Configuration
Edit ~/.config/openclaw/openclaw.json5:
{
channels: {
slack: {
enabled: true,
// Bot User OAuth Token (starts with xoxb-)
botToken: "xoxb-1234567890-1234567890123-AbCdEfGhIjKlMnOpQrStUv",
// App-Level Token (starts with xapp-; required for Socket Mode)
appToken: "xapp-1-A1234567890-1234567890123-abcdef1234567890abcdef",
// Signing Secret (from the Basic Information page)
signingSecret: "abc123def456ghi789",
// Connection mode
mode: "socket", // "socket" or "http"
// Trigger configuration
trigger: {
// Whether @Bot is required for a reply
mentionRequired: true,
// Whether to respond to direct messages (no @ needed)
dmEnabled: true,
// Custom trigger keywords (optional)
keywords: ["ask", "问"]
}
}
}
}
4.2 HTTP Mode Configuration
If using HTTP mode:
{
channels: {
slack: {
enabled: true,
botToken: "xoxb-xxxx",
signingSecret: "your-signing-secret",
mode: "http",
// Webhook path for HTTP mode
webhookPath: "/webhook/slack/events"
}
}
}
4.3 Via Environment Variables
export SLACK_BOT_TOKEN="xoxb-1234567890-xxxxx"
export SLACK_APP_TOKEN="xapp-1-A1234567890-xxxxx"
export SLACK_SIGNING_SECRET="abc123def456"
4.4 Restart and Verify
openclaw restart
# View Slack channel connection logs
openclaw logs -f --component channel:slack
Logs upon successful connection:
[INFO] [channel:slack] Socket Mode connection established
[INFO] [channel:slack] Bot logged in as @OpenClaw Assistant
[INFO] [channel:slack] Listening on workspace: Your Workspace
Step 5: Using the Bot in Slack
Invite the Bot to a Channel
After installation, the Bot is not in any channel by default. You need to invite it manually:
- Enter the target channel
- Type
/invite @OpenClaw Assistant - Or go to channel settings > Integrations > Add an app
Interaction Methods
# @mention the Bot in a channel to ask a question
@OpenClaw Assistant Please write a Python sorting algorithm
# Direct message the Bot (no @ needed)
Hello, please translate this English text
# Continue the conversation in a thread
(Simply send a message in the Bot's reply thread to continue with context)
Thread Reply Configuration
Slack threads are a great way to manage conversations. You can configure the Bot's reply behavior:
{
channels: {
slack: {
reply: {
// Whether to reply in a thread (avoids flooding the channel)
threadReply: true,
// Whether to broadcast thread replies to the channel
broadcastReply: false,
// Show "typing" indicator while processing
showTyping: true,
// Add a thinking emoji before sending
thinkingEmoji: "thinking_face",
// Add a confirmation emoji after replying
doneEmoji: "white_check_mark"
}
}
}
}
Channel and Permission Controls
Restrict Which Channels the Bot Operates In
{
channels: {
slack: {
// Only respond in specified channels
allowedChannels: ["C01234ABCDE", "C05678FGHIJ"],
// Or use channel names
allowedChannelNames: ["ai-assistant", "bot-testing"],
// Ignored channels
ignoredChannels: ["C09999XXXXX"]
}
}
}
Restrict Which Users Can Use the Bot
{
channels: {
slack: {
// Allowed user ID list (empty array means everyone is allowed)
allowedUsers: [],
// Admin users (can execute admin commands)
adminUsers: ["U01234ADMIN"]
}
}
}
Workspace Permission Approval
In enterprise Slack workspaces, installing apps may require admin approval:
- The workspace admin navigates to the Manage Apps page
- Finds OpenClaw Assistant in the pending approval list
- Reviews the permission scope and clicks approve
- The app will only work after approval
Troubleshooting
Bot Does Not Respond to Messages
# Check connection status
openclaw logs --level error --component channel:slack
# Common causes:
# 1. Bot has not been invited to the channel
# 2. Message Content events are not subscribed
# 3. Token is incorrect or expired
Socket Mode Connection Failure
# Confirm the App-Level Token is correct
# Confirm Socket Mode is enabled on the Slack API platform
# Check network connectivity (Socket Mode requires access to wss://wss-primary.slack.com)
HTTP Mode Verification Failure
# Confirm the Signing Secret is correct
# Confirm the Request URL is publicly accessible
# Confirm OpenClaw is running and the port is open
Summary
The core steps for connecting OpenClaw to Slack:
- Create an app on the Slack API platform and configure permissions
- Choose Socket Mode or HTTP mode
- Obtain the Bot Token, App Token, and Signing Secret
- Enter the credentials in the OpenClaw configuration file
- Restart the service and invite the Bot to the target channel
Socket Mode is better suited for quick setup and internal network deployments, while HTTP mode is ideal for production environments with a public URL.