Slack
Connect your OpenClaw agent to Slack so it can respond to direct messages and mentions in your workspace. OpenClaw uses Slack's Socket Mode, which means no public URL or webhook setup is required.
Prerequisites
- A Slack workspace where you have permission to install apps
- Access to your OpenClaw Dashboard
Step-by-Step Setup
1. Create a Slack App
- Go to the Slack API Apps page.
- Click Create New App.
- Select From Scratch.
- Enter an app name (e.g., "My AI Agent").
- Select the workspace you want to install it in.
- Click Create App.
2. Enable Socket Mode
- In the left sidebar, click Socket Mode.
- Toggle Enable Socket Mode to on.
Socket Mode lets your bot connect to Slack via a WebSocket connection instead of requiring a publicly accessible URL. This is simpler to set up and works well with OpenClaw's architecture.
3. Set Bot Permissions
- In the left sidebar, click OAuth & Permissions.
- Scroll down to Scopes > Bot Token Scopes.
- Add the following scopes:
chat:write-- send messageschannels:history-- read messages in public channelsim:history-- read direct messagesusers:read-- access user information
- Scroll back up and click Install to Workspace.
- Click Allow on the authorization screen.
- Copy the Bot User OAuth Token that appears (starts with
xoxb-).
4. Subscribe to Events
- In the left sidebar, click Event Subscriptions.
- Toggle Enable Events to on.
- Under Subscribe to bot events, add:
message.im-- triggers when someone DMs the botapp_mention-- triggers when someone @mentions the bot
- Click Save Changes.
5. Generate an App-Level Token
- In the left sidebar, click Basic Information.
- Scroll down to App-Level Tokens.
- Click Generate Token and Scopes.
- Give it a name (e.g., "socket-token").
- Add the scope:
connections:write. - Click Generate.
- Copy the token (starts with
xapp-).
6. Connect in OpenClaw
- Go to your OpenClaw Dashboard.
- Navigate to Instance > Channels.
- Click Slack.
- Click Connect.
- Paste the Bot Token (
xoxb-...) in the first field. - Paste the App-Level Token (
xapp-...) in the second field. - Click Save.
OpenClaw will connect to Slack using Socket Mode. You should see the channel status change to Connected within a few seconds.
7. Test It
Open Slack and send a direct message to your bot, or @mention it in a channel. Your OpenClaw agent should respond.
If the bot does not appear in your DM list, click the + button next to "Direct Messages" in Slack and search for your app's name.
Token Reference
| Token | Prefix | Where to Find |
|---|---|---|
| Bot User OAuth Token | xoxb- | OAuth & Permissions page |
| App-Level Token | xapp- | Basic Information > App-Level Tokens |
Troubleshooting
- Bot does not respond to DMs: Make sure you subscribed to the
message.imevent in step 4 and that theim:historyscope is added in step 3. - Bot does not respond to @mentions: Make sure you subscribed to the
app_mentionevent. - "Invalid token" error: Verify you are pasting the correct tokens in the correct fields. The bot token starts with
xoxb-and the app-level token starts withxapp-. - Bot is not visible in workspace: Ensure you completed the "Install to Workspace" step in OAuth & Permissions.