Connect OpenClaw to Slack
Overview
OpenClaw can run as a Slack app in your workspace-in channels, direct messages (DMs), and (depending on configuration) in private channels. Once connected, your self-hosted AI agent can read messages, reply in threads or DMs, run tasks 24/7, and automate team workflows-all from your own infrastructure, with no data leaving your control. Slack is ideal for business automation, standup summaries, internal Q&A, and development notifications.
This guide covers:
- Creating a Slack app in the Slack API dashboard
- OAuth scopes and bot permissions (chat, channels, DMs)
- Installing the app to your workspace and obtaining the bot token
- Configuring the Slack channel in OpenClaw
- Verification and common Slack-specific issues
- Best practices and where to get help
Prerequisites
- OpenClaw installed and running - Gateway and CLI working. See the Quick Start Guide or installation hub for your platform.
- Slack workspace - You need a Slack workspace where you have permission to install apps (typically an admin or owner, or permission to add apps).
- Basic terminal/CLI - You will run
openclaw config editand optionallyopenclaw status.
Step 1: Create a Slack App
- Go to the Slack API and sign in with your Slack account.
- Click Create New App → From scratch. Name the app (e.g. “OpenClaw Agent”) and select the workspace where you will install it (you can change this later).
- In the left sidebar, open OAuth & Permissions. Under Scopes → Bot Token Scopes, add at least:
chat:write- Send messages as the botchannels:history- Read messages in public channels the bot is inchannels:read- List public channelsim:history- Read direct messagesim:read- List DMsim:write- Send DMsusers:read- Look up users (needed for mentions and context)
groups:historyandgroups:read. For mentions and threads, addapp_mentions:readandchat:write.publicif required by the adapter. Check the official OpenClaw Slack channel docs for the exact scopes your version needs. - Scroll up to OAuth Tokens for Your Workspace. Click Install to Workspace (or Reinstall to Workspace if you already installed). Authorize the app in the browser.
- After installation, copy the Bot User OAuth Token (starts with
xoxb-). Store it securely-you will add it to OpenClaw’s config and never commit it to version control. Prefer an environment variable (e.g.SLACK_BOT_TOKEN) and reference it in the config.
Step 2: Add the Bot to Channels (Optional)
For the bot to read and reply in public channels, you must invite it to those channels. In Slack, open the channel, type /invite @YourAppName (replace with your app’s display name), or use the channel menu to add the app. For DMs, users can open a DM with the app from the app’s profile or by clicking the app in the sidebar. No extra invite is needed for DMs once the app is installed to the workspace.
Step 3: Configure OpenClaw for Slack
Add the Slack channel to your OpenClaw configuration. Exact schema may vary by OpenClaw version; refer to the official Slack channel documentation for the current structure.
- Open your config (e.g.
openclaw config editor edit the config file directly). - Add a channel entry for Slack. Typically you will set:
- Channel type (e.g.
slack) - Bot token - Prefer an environment variable (e.g.
SLACK_BOT_TOKEN) and reference it in the config so the token is not stored in plain text in the file.
- Channel type (e.g.
- Save the config and restart the gateway (or let it reload if it supports hot reload).
Example (illustrative; check docs for your version):
# In your OpenClaw config, under channels (or equivalent):
# slack:
# token: ${SLACK_BOT_TOKEN}
Set SLACK_BOT_TOKEN in your environment before starting OpenClaw. For more options (e.g. signing secret for events, allowed channels), see the advanced configuration guide and the official docs.
Step 4: Verify the Connection
- Run
openclaw status(or your CLI’s status command) and confirm the Slack channel is listed and connected. - In Slack, send a message in a channel where the bot is added, or open a DM with the app. Your OpenClaw agent should receive the message and respond according to your agent and model setup.
- If you use slash commands or event subscriptions, ensure they are configured in the Slack app settings and that your OpenClaw version supports them; see the official Slack channel docs.
If the bot does not respond, see Common Issues below and the channel troubleshooting guide.
Common Slack Issues
| Issue | Solution |
|---|---|
| Bot doesn’t appear or is offline | Gateway may not be running or Slack channel not enabled. Run openclaw status, check logs, and ensure the bot token is correct and the gateway has restarted after config change. |
| invalid_auth / invalid token | Confirm the Bot User OAuth Token (xoxb-…) in Slack API → your app → OAuth & Permissions matches the value in your config or environment. Ensure no extra spaces or quotes. Rotate the token (Reinstall to Workspace) if it was ever exposed. |
| missing_scope / not_allowed_token_type | Add the required Bot Token Scopes under OAuth & Permissions (e.g. chat:write, channels:history, im:history). Then use Reinstall to Workspace so Slack issues a new token with the new scopes. |
| Bot doesn’t read or reply in a channel | Invite the bot to the channel with /invite @YourAppName. Ensure the app has the right scopes (channels:history, chat:write). For private channels, add groups:history and groups:read and invite the bot to the private channel. |
| Events or slash commands not working | If your adapter uses Event Subscriptions or Slash Commands, configure the Request URL and commands in the Slack app (Event Subscriptions, Slash Commands). The URL must be publicly reachable or use a tunnel (e.g. ngrok) for development; see official OpenClaw Slack docs for Socket Mode vs HTTP. |
| Rate limits or throttling | Slack enforces rate limits (e.g. chat:write tier). Check OpenClaw logs for rate-limit errors; reduce message frequency or batch actions. Ensure network/firewall allows outbound HTTPS to slack.com. |
For more fixes (gateway, config, other channels), see the full troubleshooting hub and channel issues page.
Best Practices
- Keep the bot token secret. Use environment variables (e.g.
SLACK_BOT_TOKEN) and follow security best practices. Rotate the token (Reinstall to Workspace) if it is ever exposed. - Principle of least privilege. Grant only the OAuth scopes the bot needs (e.g. chat, channels history, im history). Avoid broad scopes like
channels:joinunless required. - Test in a single workspace first. Use a test or small team workspace before rolling out to large or production workspaces.
- Stay updated. Keep OpenClaw and your Slack adapter up to date for compatibility with Slack API changes.
- Monitor logs. Use
openclaw logs(or your log path) to catch connection and permission errors early.
Next Steps
- Add more channels: Telegram, WhatsApp, Discord - see the Channels hub.
- Install skills from ClawHub to extend what your agent can do in Slack (e.g. calendar, email, runbooks).
- Explore use cases (e.g. business automation, development notifications on Slack).
- Run through the security checklist and harden your deployment.
- Join the OpenClaw community (including the official Discord) for help and tips.
Related Resources
- Official Documentation - Links to docs.openclaw.ai
- OpenClaw Slack channel docs - Authoritative schema and options
- Video Tutorials - Installation and channel setup
- Configuration Templates - Example configs