Stack Junkie
Fix OpenClaw Slack Errors: 5 Proven Solutions
Published on
· 8 min read

Fix OpenClaw Slack Errors: 5 Proven Solutions

Authors

Fix OpenClaw Slack Errors: 5 Proven Solutions

TLDR Quick Summary

OpenClaw's Slack channel uses three different tokens and they all serve different purposes. invalid_auth means you used the wrong token type or the token was revoked. missing_scope means you need to add OAuth scopes and reinstall the app. Socket mode failures usually come from using the bot token (xoxb-) where the app-level token (xapp-) is required.

Intro Section

OpenClaw (previously known as Clawdbot and Moltbot) connects to Slack through the Slack API, using socket mode to receive real-time events without exposing a public webhook URL. Unlike Telegram or Discord, Slack has a more complex token system with three distinct token types that do different things.

Getting the three tokens right took me longer than I expected. The Slack app settings UI doesn't make it obvious which token goes where. This guide covers the actual error messages and what to change to fix them.

Table of Contents

Error: invalid_auth or token_revoked

This is the error that catches everyone first:

Error: invalid_auth

or

Error: token_revoked

The gateway starts but immediately fails to authenticate. The most likely cause is using the wrong token type in your config.

The three Slack tokens:

Slack uses three different token types:

  • xoxb-... - Bot Token. This is the main token OpenClaw uses to send and receive messages.
  • xapp-... - App-Level Token. This is specifically for socket mode connections. NOT the same as the bot token.
  • Signing Secret - Used to verify event payloads. Not a token in the config, but still required.

I've debugged this exact scenario where invalid_auth came from pasting the bot token into the app_token field. They look similar but serve entirely different purposes.

Slack API documentation page showing bot token, app-level token, and user token types

Find your tokens:

Go to your app at api.slack.com/apps. Select your app.

  • Bot Token (xoxb-): Under "OAuth & Permissions" > "Bot User OAuth Token"
  • App-Level Token (xapp-): Under "Basic Information" > "App-Level Tokens". You need to generate one if it doesn't exist yet.
  • Signing Secret: Under "Basic Information" > "App Credentials" > "Signing Secret"

Update your OpenClaw config:

{
  "channels": {
    "slack": {
      "enabled": true,
      "accounts": {
        "default": {
          "bot_token": "xoxb-YOUR-BOT-TOKEN",
          "app_token": "xapp-YOUR-APP-TOKEN",
          "signing_secret": "YOUR-SIGNING-SECRET"
        }
      }
    }
  }
}

Restart the gateway after updating:

openclaw gateway restart

Token revoked

If the token worked before and suddenly shows token_revoked, someone regenerated it in the Slack app settings. Tokens also get revoked when an app is reinstalled with different scopes.

Go back to api.slack.com/apps, generate fresh tokens, and update your config.

Error: missing_scope permissions not granted

Your bot connects but gets missing_scope when trying to read messages or send responses:

Error: missing_scope
Required scope: channels:history

This means the Slack app doesn't have the OAuth scope needed for that action.

Minimum required scopes for OpenClaw:

According to the Slack API scopes reference, OpenClaw needs these at minimum:

  • channels:history - Read messages in public channels
  • channels:read - List and access channel information
  • chat:write - Send messages as the bot
  • im:history - Read direct messages
  • im:read - Access DM conversations
  • im:write - Send direct messages
  • users:read - Access user information

For socket mode, add:

  • connections:write - Required for socket mode connections (on the App-Level Token, not the bot token)

Add missing scopes:

Go to your Slack app at api.slack.com/apps. Click "OAuth & Permissions". Scroll to "Bot Token Scopes". Add any missing scopes from the list above.

After adding scopes, you MUST reinstall the app to the workspace. There is a yellow "Reinstall to Workspace" button at the top of the "OAuth & Permissions" page. Click it and authorize the app again.

The reinstall generates a new bot token. Copy the new xoxb- token and update your OpenClaw config:

openclaw gateway restart

Socket mode connection failures

Socket mode lets OpenClaw receive Slack events without a public webhook URL. When it fails, you see:

Error: Socket Mode connection failed

or

Error: invalid_auth (when using app_token)

The key thing that trips people up: socket mode uses the app-level token (xapp-), not the bot token. I set up my first Slack integration by putting the bot token in both fields. Socket mode failed silently until I looked at which token type was in the app_token field.

Enable Socket Mode in your Slack app:

Go to api.slack.com/apps, select your app, then click "Socket Mode" in the left sidebar. Enable it.

After enabling, go to "Basic Information" > "App-Level Tokens" and generate an app-level token. Give it the connections:write scope. The token starts with xapp-.

OpenClaw documentation for the Slack channel showing token and socket mode configuration

Update your OpenClaw config:

{
  "channels": {
    "slack": {
      "accounts": {
        "default": {
          "bot_token": "xoxb-YOUR-BOT-TOKEN",
          "app_token": "xapp-YOUR-APP-LEVEL-TOKEN",
          "socket_mode": true
        }
      }
    }
  }
}

The app_token must be the xapp- token, not the xoxb- bot token. Restart the gateway after updating.

Bot responds in DMs but not channels

Your bot works fine in direct messages but ignores messages in Slack channels.

Missing channel scopes:

In my experience, this is a channels:history or channels:read scope missing. The bot can send DMs (using im: scopes) but can't see channel messages without the channels: scopes.

Go to "OAuth & Permissions" in your Slack app, add channels:history and channels:read to bot token scopes, then reinstall the app to apply the change.

Bot not invited to the channel:

Slack bots must be explicitly invited to channels they want to participate in. In the Slack channel where you want the bot to respond, type:

/invite @YourBotName

Once invited, the bot receives channel messages. This is separate from OAuth scopes.

Channel allowlist in OpenClaw config:

If you have a channels allowlist in your OpenClaw config, the bot only responds in listed channels. Check your config:

{
  "channels": {
    "slack": {
      "accounts": {
        "default": {
          "channels": ["C0123456789"]
        }
      }
    }
  }
}

Channel IDs in Slack start with C. Get a channel ID by right-clicking the channel name in Slack and selecting "Copy link" (the ID is at the end of the URL), or from the channel's "About" tab. Add your channel ID to the allowlist.

Bot not responding at all

The bot appears online but ignores every message.

Check the workspace allowlist:

OpenClaw has a workspaces allowlist in the config. If your workspace ID isn't listed, the bot ignores all messages from that workspace.

{
  "channels": {
    "slack": {
      "accounts": {
        "default": {
          "workspaces": ["T0123456789"]
        }
      }
    }
  }
}

Workspace IDs start with T. Find your workspace ID in Slack under "Settings & Administration" > "Workspace Settings". It shows in the URL as well.

Check pairing approval:

OpenClaw requires pairing approval. Check pending pairings:

openclaw pairing pending

Approve any pending requests:

openclaw pairing approve slack T0123456789

FAQ Slack Channel

Should I use Socket Mode or webhooks with OpenClaw?

Use Socket Mode. It is simpler to set up because it doesn't require a public URL, and it works on VPS installs without exposing ports. Webhooks require your server to be publicly reachable and properly configured with TLS. Unless you have a specific reason to use webhooks, Socket Mode is the right choice.

Can I connect OpenClaw to multiple Slack workspaces?

Yes. Add multiple accounts under channels.slack.accounts in your config, each with its own bot_token and app_token. Each workspace needs its own separate Slack app installation.

The bot token looks fine but I still get invalid_auth after restarting. Why?

Copy the token directly from the Slack app settings page, not from your terminal history or a password manager where it may have been modified. Also check for invisible characters from copy-paste. The token should start with xoxb- with no spaces, quotes, or invisible characters around it.

Conclusion Summary

Slack errors in OpenClaw come down to token types, scopes, and socket mode configuration. The three tokens (xoxb-, xapp-, signing secret) each serve a specific role. invalid_auth means wrong token or wrong field. missing_scope requires adding scopes and reinstalling the app. Socket mode must use the app-level token, not the bot token.

After fixing auth, check that your bot is invited to the channels where it should respond. Slack doesn't auto-invite bots to channels even when properly authenticated.

For first-time Slack setup, the OpenClaw Slack setup guide walks through app creation and token configuration. The fix OpenClaw Telegram errors and fix OpenClaw Discord errors guides cover similar auth troubleshooting patterns for those channels. If you want ideas for what to build once your OpenClaw Slack integration is working, the article on building a second brain with your AI agent at EmergentWeirdness shows what a well-connected agent can do.

Enjoyed this post?

Get new articles delivered to your inbox. No spam, unsubscribe anytime.

Comments