Skip to content

Slack Setup

Slack works well with Moltbot if your team (or just you) lives in Slack. The setup is more involved than Telegram — Slack's app platform has a lot of moving parts — but once it's running, it's smooth.

One thing to know upfront: Slack's free plan has message history limits. If you're on the free tier, older messages disappear after 90 days. This doesn't affect Moltbot's operation directly, but it's worth knowing.

Create a Slack App

  1. Go to api.slack.com/apps
  2. Click "Create New App"
  3. Choose "From scratch" (not from a manifest, though we'll cover that later)
  4. Name your app and pick your workspace
  5. You're in the app dashboard

Set Up Bot Token Scopes

Go to OAuth & Permissions in the sidebar. Scroll down to Bot Token Scopes and add:

  • app_mentions:read — so the bot can see when it's mentioned
  • channels:history — read messages in public channels
  • channels:read — see which channels exist
  • chat:write — send messages
  • groups:history — read messages in private channels (if you want that)
  • groups:read — see private channels
  • im:history — read DMs
  • im:read — see DM conversations
  • im:write — open DMs
  • users:read — know who's talking

That's a lot of scopes. Bit of a pain but worth it — if you skip any, certain features won't work and the error messages aren't always helpful.

Install to Workspace

Still on the OAuth page, click "Install to Workspace" at the top. Authorize the app.

You'll get a Bot User OAuth Token that starts with xoxb-. Copy it.

Set Up Event Subscriptions

Go to Event Subscriptions in the sidebar and toggle it on.

For the Request URL, you need a public HTTPS endpoint. Moltbot's default webhook path for Slack is:

https://your-domain.com/slack/events

Moltbot needs to be running and accessible from the internet for verification to succeed. Use Cloudflare Tunnel, ngrok, or a proper server setup.

Under Subscribe to bot events, add:

  • app_mention — someone @mentions the bot
  • message.channels — messages in public channels
  • message.groups — messages in private channels
  • message.im — direct messages

Click "Save Changes."

Enable Socket Mode (Alternative)

If you don't want to deal with webhooks, Slack offers Socket Mode. It's like Telegram's long polling — no public URL needed.

Go to Socket Mode in the sidebar and enable it. You'll get an App-Level Token that starts with xapp-. You'll need this in addition to the bot token.

yaml
channels:
  slack:
    mode: socket
    appToken: "xapp-your-app-level-token"

Socket Mode is easier for personal setups. Webhooks are better for production.

Configure Moltbot

Environment Variables

bash
export SLACK_BOT_TOKEN=xoxb-your-bot-token
export SLACK_SIGNING_SECRET=your-signing-secret
# Only if using Socket Mode:
export SLACK_APP_TOKEN=xapp-your-app-level-token

The signing secret is found under Basic InformationApp Credentials in your Slack app dashboard.

Config File

yaml
# ~/.moltbot/config.yaml
channels:
  slack:
    botToken: "xoxb-your-bot-token"
    signingSecret: "your-signing-secret"
    # mode: socket  # uncomment for Socket Mode
    # appToken: "xapp-..."  # required for Socket Mode

Or the wizard:

bash
moltbot configure --section slack

Start and Pair

bash
moltbot start

DM the bot in Slack or mention it in a channel. Pairing code appears in your terminal:

bash
moltbot pairing approve slack ABCD-1234

You're good to go.

How It Works

DMs

The bot always responds to direct messages from paired users.

Channels

In channels, the bot only responds when @mentioned. This is the sane default. Nobody wants a bot that responds to every single message in #general.

@moltbot what's our deploy schedule this week?

Threads

Moltbot is thread-aware. If someone starts a thread with a mention, the bot will continue responding in that thread. This keeps channels clean and is honestly one of the nicer Slack-specific features.

Channel Restrictions

yaml
channels:
  slack:
    allowedChannels:
      - "bot-playground"
      - "ask-ai"

App Manifest (Quick Setup)

If the manual setup above feels like a lot, you can use a Slack App Manifest to configure everything at once. When creating a new app, choose "From an app manifest" and paste:

yaml
display_information:
  name: Moltbot
  description: AI assistant powered by Moltbot
oauth_config:
  scopes:
    bot:
      - app_mentions:read
      - channels:history
      - channels:read
      - chat:write
      - groups:history
      - groups:read
      - im:history
      - im:read
      - im:write
      - users:read
settings:
  event_subscriptions:
    bot_events:
      - app_mention
      - message.channels
      - message.groups
      - message.im
  socket_mode_enabled: true

This sets up Socket Mode with all the right scopes in one shot. Still need to grab the tokens afterward though.

Troubleshooting

Bot doesn't respond to mentions

  • Check that app_mentions:read scope is added
  • Make sure the app_mention event is subscribed
  • Verify the bot is actually in the channel (invite it with /invite @moltbot)

"not_authed" or "invalid_auth" errors

Your bot token is wrong or expired. Reinstall the app to your workspace to get a fresh token.

Events not arriving

  • If using webhooks: check your Request URL verification status in the Slack dashboard
  • If using Socket Mode: make sure you set the appToken and that Socket Mode is enabled in the dashboard
  • Look at moltbot logs — Slack errors are usually descriptive

Bot responds to everything (not just mentions)

Check your event subscriptions. If you subscribed to message.channels without filtering, the bot sees all messages. Moltbot should filter these by default, but check your groupPolicy setting:

yaml
channels:
  slack:
    groupPolicy: "mention-only"

Rate limiting

Slack rate limits are generous for small-scale use. If you hit them, you're probably doing something unusual. Moltbot queues messages automatically when throttled.

What's Next

  • Security — review your policies before sharing the bot with your team
  • Memory — the bot remembers things across all channels
  • Proactive Messages — schedule messages to Slack channels

Community tutorial site — not affiliated with official Moltbot