Connect Slack App

Integrate Clawdbot with Slack for AI-powered assistance in your workspace. Step-by-step Slack app setup guide.

Medium ⏱ 15 min

Overview

Connect Clawdbot to Slack and bring AI assistance to your workspace:

  • Channel conversations — AI responds in public/private channels
  • Direct messages — Personal AI assistant for each user
  • Thread replies — Contextual responses in threads
  • Slash commands — Quick AI interactions

Prerequisites

  • Clawdbot installed on your machine
  • A Slack workspace where you have admin permissions
  • Slack account with app creation rights

Step 1: Create a Slack App

  1. Go to Slack API Apps
  2. Click “Create New App”
  3. Choose “From scratch”
  4. Enter an app name (e.g., “AI Assistant”) and select your workspace
  5. Click Create App

Step 2: Configure Bot Permissions

Add OAuth Scopes

  1. Go to “OAuth & Permissions” in the sidebar
  2. Scroll to “Scopes” → “Bot Token Scopes”
  3. Add these scopes:
ScopePurpose
chat:writeSend messages
channels:historyRead channel messages
groups:historyRead private channel messages
im:historyRead DMs
app_mentions:readRespond to @mentions
users:readGet user info

Step 3: Enable Event Subscriptions

  1. Go to “Event Subscriptions”
  2. Toggle “Enable Events” to On
  3. For Request URL, you’ll need a public endpoint. Options:
    • Use ngrok for local development: ngrok http 18789
    • Deploy to a server with public IP
  4. Enter: https://your-domain.com/slack/events
  5. Under “Subscribe to bot events”, add:
    • app_mention
    • message.channels
    • message.groups
    • message.im
  6. Click Save Changes

Step 4: Install App to Workspace

  1. Go to “Install App” in the sidebar
  2. Click “Install to Workspace”
  3. Review permissions and click Allow
  4. Copy the Bot User OAuth Token (starts with xoxb-)

Step 5: Get Signing Secret

  1. Go to “Basic Information”
  2. Under “App Credentials”, find Signing Secret
  3. Click Show and copy it

Step 6: Add Slack to Clawdbot

Run in your terminal:

clawdbot channels add slack

Enter when prompted:

  • Bot Token: Your xoxb- token
  • Signing Secret: The signing secret from Basic Information

Or configure manually:

clawdbot config set slack.botToken "xoxb-your-token"
clawdbot config set slack.signingSecret "your-signing-secret"

Step 7: Start the Gateway

clawdbot gateway

If using ngrok for development:

# In another terminal
ngrok http 18789

Update the Request URL in Slack with your ngrok URL.


Configuration Options

Restrict to Specific Channels

clawdbot config set slack.allowedChannels "C01234567,C09876543"

Set Response Mode

# Respond only when mentioned (default)
clawdbot config set slack.trigger mention

# Respond to all messages
clawdbot config set slack.trigger all

Thread Behavior

# Always reply in threads (recommended for busy channels)
clawdbot config set slack.replyInThread true

Slash Commands (Optional)

Add custom slash commands:

  1. Go to “Slash Commands” in your app settings
  2. Click “Create New Command”
  3. Configure:
    • Command: /ask
    • Request URL: https://your-domain.com/slack/commands
    • Description: “Ask the AI assistant”
  4. Save and reinstall the app

Production Deployment

For production use, deploy Clawdbot on a server:

Using Docker

docker run -d \
  -e SLACK_BOT_TOKEN=xoxb-your-token \
  -e SLACK_SIGNING_SECRET=your-secret \
  -p 18789:18789 \
  clawdbot/clawdbot gateway

Verify Webhook

Slack will send a challenge request to verify your endpoint. Clawdbot handles this automatically.


Troubleshooting

”URL Verification Failed”

  • Ensure Clawdbot gateway is running
  • Check the URL is publicly accessible
  • Verify no firewall blocking port 18789

Bot Not Responding

  1. Check the bot is invited to the channel
  2. Verify OAuth scopes include channels:history
  3. Confirm events are subscribed correctly

”Invalid Signing Secret”

Re-copy the signing secret from Slack. Make sure there are no extra spaces.

Messages Delayed

If using ngrok free tier, connections may timeout. Consider:

  • Upgrading ngrok
  • Deploying to a cloud server
  • Using Slack’s Socket Mode (no public URL needed)

Socket Mode (Alternative)

For local development without a public URL:

  1. Go to “Socket Mode” in app settings
  2. Enable Socket Mode
  3. Generate an App-Level Token with connections:write scope
  4. Configure Clawdbot:
clawdbot config set slack.socketMode true
clawdbot config set slack.appToken "xapp-your-app-token"

Next Steps