OpenClaw Slack Integration: Connect Your Agent to Your Workspace
Your AI agent lives on a server somewhere. To talk to it, you normally type commands in a terminal, open a web dashboard, or fire up a mobile app. But you already spend your workday in Slack. Wouldn’t it be better if you could just message your agent the way you message a teammate?
The OpenClaw Slack integration makes that possible. It connects your OpenClaw agent directly to your Slack workspace so you can send messages, get responses, and trigger automations without leaving the chat client you already use. This guide walks through every step: creating the Slack App, configuring scopes, enabling Socket Mode, wiring up openclaw.json, and testing the connection. By the end you will have an AI agent in your Slack sidebar that responds to @mentions and DMs.
What the OpenClaw Slack Integration Does
OpenClaw is an open-source agent runtime. At its core it takes a message in and produces a response out, but it also has file access, tool execution, memory, and cron scheduling. The Slack integration opens a bidirectional channel between your agent and your Slack workspace.
Here is what that gets you:
- Two-way messaging. Send a message from Slack, get a response in the same thread. No terminals, no dashboards.
- Channel awareness. The agent responds where it is mentioned. It can also remember which channel the last message came from and send follow-ups there.
- DM mode. Optionally restrict the agent to respond only in direct messages so a busy channel does not get cluttered.
- Full agent capability. Whatever tools, memory, or automations your agent has, they work through Slack. Ask it to run a cron job, query its memory, or fetch a news digest.
- Socket Mode by default. No public URL, no open ports. The agent connects outbound to Slack’s API over a WebSocket. This works behind NAT, on a home server, or on a VPS without a public endpoint.
The integration supports two delivery modes. The most common is respond in channel: the agent replies in whatever channel it was mentioned. The alternative is DM-only, where the agent ignores channel mentions and only replies to direct messages. Both modes are controlled through event subscription configuration covered below.
Step 1: Create a Slack App
Everything starts at the Slack API dashboard. Every bot in Slack is technically an app.
- Open a browser and go to api.slack.com/apps.
- Click Create New App.
- Choose From Scratch.
- Give it a name. Something like “My Agent” or “OpenClaw Bot” works. The name appears in the Slack sidebar and in @mentions.
- Select the workspace where you want to install the bot.
- Click Create App.
You now have a blank Slack App. The next steps add the permissions and communication channels it needs to talk to your agent.
Step 2: Configure Bot Token Scopes
Scopes tell Slack what your bot is allowed to do. OpenClaw’s integration needs a specific set of scopes to read messages, write replies, and listen for mentions.
- In the left sidebar of your app’s dashboard, click OAuth & Permissions.
- Scroll down to Scopes and find the Bot Token Scopes section.
- Click Add an OAuth Scope and add each of the following:
| Scope | Why It Is Needed |
|---|---|
chat:write |
Send messages as the bot (replies to your queries) |
channels:read |
Read basic channel metadata (needed to find where to respond) |
im:history |
Read the message history in DM conversations with the bot |
im:write |
Open DM conversations and send messages to users |
app_mentions:read |
Receive events when the bot is @mentioned in a channel |
These are additive: each one gives the bot one more capability. The full list is manageable but you only need these five to get a working bot.
- Scroll up to OAuth Tokens for Your Workspace and click Install to Workspace.
- Review the permissions screen that Slack shows you and click Allow.
- Copy the Bot User OAuth Token that appears. It starts with
xoxb-. Save it somewhere safe; you will put it inopenclaw.jsonlater.
Step 3: Enable Socket Mode
Socket Mode is the simplest way to connect OpenClaw to Slack. Instead of Slack sending events to a public URL on your server (which requires a VPS, port forwarding, or ngrok), your agent opens an outbound WebSocket connection to Slack. No incoming ports needed.
This is the right choice if you are running OpenClaw on a laptop, a home server behind NAT, or a Raspberry Pi. It is also fine on a VPS, but it is not required there.
- In the left sidebar, click Socket Mode under Settings.
- Toggle Enable Socket Mode to on.
- You will be prompted to create an App-Level Token. Click Generate.
- Give the token a name (e.g., “OpenClaw Connection”).
- Add the scope
connections:write. This is the only scope an app-level token needs for Socket Mode. - Click Generate and copy the token. It starts with
xapp-.
You now have two tokens: the Bot User OAuth Token (xoxb-...) and the App-Level Token (xapp-...). Both go into your OpenClaw configuration.
Step 4: Add Event Subscriptions
Event subscriptions tell Slack which messages to forward to your agent. Without these, your bot exists silently and never receives anything.
- In the left sidebar, click Event Subscriptions.
- Toggle Enable Events to on.
- Scroll down to Subscribe to bot events.
- Click Add Bot User Event and add:
message.im– Fires when someone sends a direct message to the bot.app_mention– Fires when someone @mentions the bot in a public or private channel.
That is it. Two events. If you want DM-only behavior, subscribe only to message.im and skip app_mention. If you want the bot to respond in channels (including when mentioned), subscribe to both.
- Click Save Changes. Slack may prompt you to reinstall the app to apply the new event scopes. If it does, click the reinstall link.
With events configured, Slack knows when to send data to your agent. With Socket Mode enabled, that data arrives over a WebSocket instead of requiring a public HTTP endpoint.
Step 5: Configure openclaw.json
OpenClaw reads its configuration from openclaw.json, usually located in your OpenClaw data directory. The Slack integration lives under the channels section.
Open openclaw.json in a text editor and add or modify the channels block. The required fields are:
{
"channels": {
"slack": {
"token": "xoxb-...",
"signingSecret": "...",
"appToken": "xapp-...",
"defaultChannel": "C0123456789"
}
}
}
| Field | Value | Source |
|---|---|---|
token |
Bot User OAuth Token | OAuth & Permissions page (starts xoxb-) |
signingSecret |
Signing Secret | Basic Information page of your Slack App |
appToken |
App-Level Token | Socket Mode page (starts xapp-) |
defaultChannel |
Slack channel ID | Right-click a channel name, Copy Link, extract the ID |
To find the signing secret: go to your Slack App dashboard, click Basic Information, scroll down to App Credentials, and copy the Signing Secret field.
To find a channel ID: right-click a channel name in Slack, choose Copy Link, and extract the ID from the URL. It looks like C0123456789. Alternatively, open the channel details panel in the Slack desktop app and look at the bottom of the About tab.
The defaultChannel is used for outbound messages when no specific channel context exists. For a reactive bot that only replies where it is triggered, this field matters less, but it is required in the config.
Once the file is saved, restart OpenClaw or reload its configuration:
openclaw gateway restart
Or, if OpenClaw is running as a service:
sudo systemctl restart openclaw
Step 6: Invite the Bot and Test
Now the real test: talking to your agent from Slack.
- Open Slack and go to a channel where you want the bot to respond.
- Type
/invite @your-bot-namewhereyour-bot-nameis whatever you named your Slack App. The bot must be a member of the channel to see messages there. - Once the bot joins, @mention it:
@your-bot-name hello, are you there? - Within a second or two, the bot should reply in the same thread.
If you added message.im to your event subscriptions, you can also send a direct message to the bot. Find it in the Slack sidebar under Apps, click it, and type a message. The bot should respond in the DM thread.
That is it. Your OpenClaw agent is now connected to your Slack workspace.
Webhook Mode: When You Need a Public URL
Socket Mode covers most self-hosted setups. But there are cases where you want or need webhook-based delivery:
- You are already running OpenClaw on a VPS with a public IP and prefer not to add a WebSocket dependency.
- You need Slack to deliver events even when the agent’s WebSocket connection is briefly interrupted.
- You want to use Slack’s retry logic for missed event delivery.
In webhook mode, Slack sends HTTP POST requests to a public URL on your server. To set this up:
- In the Slack App dashboard, go to Event Subscriptions.
- Under Enable Events, toggle on and enter a Request URL. This is the URL where OpenClaw is listening, for example
https://your-server.com/slack/events. - Slack sends a URL verification challenge. OpenClaw handles this automatically if the endpoint is configured correctly.
- Disable Socket Mode under Socket Mode settings.
- Remove the
appTokenfrom youropenclaw.jsonconfiguration. ThetokenandsigningSecretare still required.
For local development, use ngrok to create a temporary public URL that tunnels to your local machine:
ngrok http 3000
Then use the generated https://xxxx.ngrok.io URL as your Request URL in Slack. Note that ngrok URLs change every time you restart ngrok unless you have a paid plan.
Socket Mode is the simpler, more secure path for most people. Webhook mode is useful if you already have a public-facing setup or need Slack’s delivery guarantees.
Practical Use Cases: What People Actually Use This For
Once the bot is live, the question shifts from “how do I set this up” to “what do I do with it.” Here are the patterns that come up most often:
Personal Command Interface
During the workday, you can message your bot directly instead of opening a terminal or a web dashboard. Ask it to check server status, summarize a file, or remind you of a task. The agent responds in the DM thread, and the context stays with you.
Cron Job Triggers
OpenClaw supports cron schedules. You can set up a job that runs on a timer and messages your agent, which in turn posts results to a Slack channel. A common pattern: a daily morning digest that scrapes news, checks weather, and posts a summary to #team-updates.
Memory Queries
OpenClaw agents have persistent memory. From Slack, you can ask your agent to recall information stored in previous sessions: “What was the IP address of the staging server we set up last week?” or “Remind me what tasks are in progress.”
Channel Automation
Drop the bot into a project channel. When someone asks a common question, the agent answers from its knowledge base. When a deployment happens, the agent reports the result. The delivery.channel: "last" behavior means the agent automatically responds in whatever channel last triggered it, so you do not need to specify a target channel in every message.
News Digests and Monitoring
Have your agent periodically check external sources and post updates to a dedicated channel. This works for uptime monitoring, RSS feed aggregation, crypto or stock price alerts, and GitHub release tracking.
Troubleshooting: Common Issues and Fixes
The most common problems happen in the first five minutes of setup. Here is what to check when the bot does not respond.
Bot does not respond to @mentions
- Verify that
app_mentionis in your bot event subscriptions. - Confirm the bot has been invited to the channel (
/invite @botname). - Check that Socket Mode is enabled and the
appToken(xapp- token) is correctly set inopenclaw.json. - Restart OpenClaw after making config changes.
Bot does not respond to DMs
- Verify that
message.imis in your bot event subscriptions. - Confirm the bot exists in your workspace’s App list. Users can start a DM with any installed bot.
- Check OpenClaw logs for incoming event errors. Run
openclaw gateway logsor check your journal.
Bot responds with “Socket Mode not enabled” or token errors
- This usually means the App-Level Token (xapp-) is missing or invalid.
- Go back to the Socket Mode page in your Slack App dashboard and regenerate the token if needed.
- Make sure the token is in
openclaw.jsonunderchannels.slack.appToken.
Wrong token type
- The
tokenfield expects a Bot User OAuth Token that starts withxoxb-. - The
appTokenfield expects an App-Level Token that starts withxapp-. - Swapping them or using a user token (
xoxp-) will not work.
Events not showing up in OpenClaw logs
- If using Socket Mode, confirm the WebSocket connection established at startup. Look for a log message indicating the connection was opened.
- If using webhook mode, check that the Request URL in Event Subscriptions returns a 200 OK to Slack’s URL verification challenge.
- Firewall rules can block outbound WebSocket connections. Verify your server can reach
wss://slack.comon port 443.
Bot sends messages but they appear from the wrong account
- The bot token you installed determines the identity. Make sure you copied the Bot User OAuth Token (not a user token). The bot posts as itself, not as your personal Slack account.
Sources
Slack API Documentation
api.slack.com/apis – Slack API reference, scopes, and app management.
OpenClaw Documentation
github.com/openclaw/openclaw – Configuration reference for channels, tokens, and openclaw.json.
Socket Mode Guide
api.slack.com/apis/connections/socket – Slack’s official Socket Mode documentation.
Event Subscriptions Reference
api.slack.com/apis/events-api – Events API event types and subscription setup.
