OpenClaw LogoOpenClaw with ArmorIQ
Configuration

Slack Setup

Configure Slack bot with Socket Mode for OpenClaw

Slack Bot Setup

Set up a Slack bot using Socket Mode to interact with OpenClaw via Slack.

Slack uses Socket Mode for real-time communication - no public URLs or webhooks needed!


Prerequisites

  • A Slack workspace where you can install apps
  • Admin permissions to create and install Slack apps
  • A Slack account

Create Slack App

  1. Go to Slack API Dashboard: https://api.slack.com/apps

  2. Create New App:

    • Click "Create New App"
    • Choose "From scratch"
    • App Name: OpenClaw Bot (or your preferred name)
    • Pick a workspace: Select your development workspace
    • Click "Create App"

Enable Socket Mode

Socket Mode is required! This allows OpenClaw to receive messages without exposing a public URL.

  1. Go to SettingsSocket Mode (left sidebar)
  2. Toggle "Enable Socket Mode" → ON
  3. Generate App-Level Token:
    • Token Name: openclaw-socket
    • Scopes: Select connections:write
    • Click "Generate"
    • Copy the App Token (starts with xapp-) - save it securely!

Configure Bot Token Scopes

  1. Go to FeaturesOAuth & Permissions
  2. Scroll to "Scopes""Bot Token Scopes"
  3. Click "Add an OAuth Scope" and add these scopes:
    • app_mentions:read - See @mentions of the bot
    • channels:history - View messages in public channels
    • channels:read - View basic channel information
    • chat:write - Send messages
    • groups:history - View messages in private channels
    • groups:read - View basic private channel info
    • im:history - View messages in DMs
    • im:read - View basic DM info
    • im:write - Start direct messages
    • mpim:history - View messages in group DMs
    • mpim:read - View basic group DM info
    • users:read - View people in workspace

Install App to Workspace

  1. Stay on OAuth & Permissions page
  2. Click "Install to Workspace" (top of page)
  3. Review permissions → Click "Allow"
  4. Copy the Bot User OAuth Token (starts with xoxb-) - save it securely!

Enable Event Subscriptions

  1. Go to FeaturesEvent Subscriptions
  2. Toggle "Enable Events" → ON
  3. Subscribe to bot events:
    • Click "Add Bot User Event"
    • Add these events:
      • app_mention - When bot is @mentioned
      • message.channels - Messages in public channels
      • message.groups - Messages in private channels
      • message.im - Direct messages to bot
      • message.mpim - Group direct messages
  4. Click "Save Changes"

Get Slack IDs

Get Channel ID

  • Open Slack workspace in browser or desktop app
  • Go to the channel (e.g., #general)
  • Click channel name at top → View details
  • Scroll down → Channel ID (e.g., C04ABC12345)

Or right-click channel → Copy → Copy Link

  • Link format: https://yourworkspace.slack.com/archives/C04ABC12345
  • The ID is after /archives/

Get User ID

  • Click on your profile picture → Profile
  • Click ••• (More) → Copy member ID
  • Format: U04ABC12345

Get Workspace/Team ID (if needed)

  • Go to workspace settings
  • Or extract from any Slack URL: https://app.slack.com/client/T04ABC12345/...
  • Format: T04ABC12345

Add Slack Configuration

Set environment variables:

~/.openclaw/.env
# Slack Configuration
SLACK_BOT_TOKEN=xoxb-YOUR-BOT-TOKEN-HERE
SLACK_APP_TOKEN=xapp-YOUR-APP-TOKEN-HERE

Update configuration file ~/.openclaw/openclaw.json:

{
  "channels": {
    "slack": {
      "enabled": true,
      "socketMode": true,
      "dm": {
        "enabled": true,
        "policy": "allowlist",
        "allowFrom": ["U04ABC12345"]
      },
      "groupPolicy": "allowlist",
      "channels": {
        "C04ABC12345": {
          "allow": true,
          "requireMention": false
        }
      },
      "teams": {
        "T04ABC12345": {
          "users": ["U04ABC12345"]
        }
      }
    }
  },
  "plugins": {
    "entries": {
      "slack": {
        "enabled": true
      }
    }
  }
}

Replace with your IDs:

  • xoxb-... - Your Slack Bot Token
  • xapp-... - Your Slack App Token
  • U04ABC12345 - Your Slack user ID
  • C04ABC12345 - Your channel ID
  • T04ABC12345 - Your workspace/team ID

Invite Bot to Channels

After configuration, invite the bot to channels:

  1. Go to the Slack channel (e.g., #general)
  2. Type: /invite @OpenClaw Bot
  3. Press Enter
  4. Bot will join the channel

Or:

  • Click channel name → Integrations tab
  • Click "Add apps" → Find your bot → Add

Configuration Options

FieldDescriptionDefault
socketModeUse Socket Mode (no webhooks needed)true
dm.enabledEnable direct message supporttrue
dm.policyAccess control: allowlist, pairing, open, disabledpairing
dm.allowFromSlack user IDs allowed to DM[]
groupPolicyChannel policy: allowlist, open, disabledallowlist
channels.<id>.allowAllow bot in this channelfalse
channels.<id>.requireMentionRequire @mention to respondtrue
teams.<id>.usersUser IDs allowed in this workspace[]

Mention vs No-Mention Mode

Bot only responds when @mentioned:

@OpenClaw Bot hello
  • Prevents bot from responding to every message
  • Better for busy channels
  • Recommended for shared channels

With requireMention: false (Testing Only)

Bot responds to every message in configured channels.

  • Can be noisy in active channels
  • Good for private testing channels

Verify Setup

Start Gateway

cd /path/to/aiq-openclaw
export SLACK_BOT_TOKEN=xoxb-...
export SLACK_APP_TOKEN=xapp-...
node scripts/run-node.mjs gateway

Expected Log Output

[slack] socket mode connected
[slack] connected to workspace: YourWorkspace

Check Status

pnpm openclaw channels status --probe

Expected output:

Slack default: enabled, configured, running, works

Test Slack Bot

Test in DM

  1. Click Apps in Slack sidebar
  2. Find your bot → Click to open DM
  3. Send: Hello ArmorIQ!
  4. Bot should respond (if your user ID is in allowlist)

Test in Channel

  1. Go to configured channel where bot was invited
  2. If requireMention: false, send: hello
  3. If requireMention: true, send: @YourBot hello
  4. Bot should respond

Test with @mention

In any channel where bot is a member:

@OpenClaw Bot what's the weather today?

Troubleshooting

Bot doesn't respond

Check:

  • Both SLACK_BOT_TOKEN and SLACK_APP_TOKEN are set correctly
  • Socket Mode is enabled in Slack app settings
  • Bot has all required OAuth scopes
  • Bot was invited to the channel: /invite @YourBot
  • Check logs for "socket mode connected"
  • Your user ID is in allowFrom list if using allowlist policy
  • You're using @mention if requireMention: true

Solution:

# Check logs
tail -f /tmp/openclaw/openclaw-$(date +%Y-%m-%d).log | grep slack

# Verify environment
echo $SLACK_BOT_TOKEN
echo $SLACK_APP_TOKEN

Socket mode connection failed

Error: Failed to connect to Socket Mode

Fix:

  1. Verify App Token (xapp-...) has connections:write scope
  2. Check Socket Mode is enabled in Slack app settings
  3. Regenerate tokens if they were revoked

Missing permissions

Error: missing_scope: The token used is not granted the specific scope permissions required

Fix:

  1. Go to Slack API dashboard
  2. Check all required scopes are added
  3. Reinstall app after adding scopes

Security Best Practices

Use Allowlist Policy

SAFE - Only specific users in allowed channels:

{
  "channels": {
    "slack": {
      "dm": {
        "policy": "allowlist",
        "allowFrom": ["U04ABC12345"]
      },
      "groupPolicy": "allowlist",
      "teams": {
        "T04ABC12345": {
          "users": ["U04ABC12345"]
        }
      }
    }
  }
}

DANGEROUS - Anyone in workspace can interact:

{
  "channels": {
    "slack": {
      "dm": { "policy": "open" },
      "groupPolicy": "open"  // NEVER DO THIS!
    }
  }
}

Token Storage

Store tokens securely in environment:

~/.openclaw/.env

Never commit tokens to version control!


Next Steps

Slack configured!

Configure additional channels:

On this page