Skip to content

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).

  • A Slack Workspace where you have permission to install apps.
  • OpenClaw installed.

Socket Mode is recommended for most users as it doesn’t require exposing a public IP address.

  1. Go to api.slack.com/apps and click Create New App. Choose From scratch, name it (e.g., “OpenClaw”), and pick your workspace.

    • 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.
  2. 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)
  3. Scroll up to the top of OAuth & Permissions and click Install to Workspace.

    • Copy the xoxb-... token. This is your Bot Token.
  4. Go to Event Subscriptions.

    • Toggle Enable Events.
    • Expand Subscribe to bot events and add:
      • message.channels
      • message.groups
      • message.im
      • app_mention
      • member_joined_channel
  5. Go to App Home.

    • Check Allow users to send Slash commands and messages from the messages tab.
  6. Add the tokens to your config.json.

    {
    channels: {
    slack: {
    enabled: true,
    // App Token (Socket Mode)
    appToken: "xapp-...",
    // Bot Token (OAuth)
    botToken: "xoxb-..."
    }
    }
    }

Slack conversations often happen in threads. You can control how OpenClaw replies.

ModeBehaviorConfig
Off (Default)Replies in the main channel (unless the user is already in a thread).replyToMode: "off"
FirstThe first reply starts a thread; subsequent replies stay in that thread. Keeps channels clean.replyToMode: "first"
AllEvery reply is threaded.replyToMode: "all"

Example:

{
channels: {
slack: {
// Thread DMs always, but keep group chats flat
replyToModeByChatType: {
direct: "all",
group: "off"
}
}
}
}

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: ["*"] }
    }
    }
    }

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
}
}
}
}

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.im events?

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).