Introduction

Moltbot is an open-source, self-hosted personal AI assistant that connects to messaging platforms you already use. Instead of switching between apps and AI tools, Moltbot brings your AI assistant directly into WhatsApp, Slack, Telegram, Discord, and more.

This guide covers setting up Moltbot from scratch using Docker, configuring Slack as a workspace channel, linking your personal WhatsApp number, and securing the gateway with Tailscale plus loopback-only bindings.

Why Moltbot?

  • Multi-channel inbox — One assistant across WhatsApp, Slack, Telegram, Discord, Signal, and more
  • Self-hosted — Your data stays on your infrastructure
  • Model-agnostic — Works with Anthropic (Claude), OpenAI, Ollama, and other providers
  • Always-on — Runs as a gateway daemon, ready to respond 24/7
  • Extensible — Plugin system for additional channels, skills, and tools

Architecture Overview

WhatsAppG(A/adItaSeeMlwmoaaodcynek)l/TelegDOrolaclmkaem/raDc/iosnCctloaariudndeer/(mOopletnbAoIt-gateway)

The Gateway is the central control plane. It owns all channel connections (WhatsApp via Baileys, Slack via Bolt SDK), routes messages, manages sessions, and dispatches replies. The CLI container talks to the gateway for admin operations like login, status checks, and manual sends.

Prerequisites

  • Docker and Docker Compose installed
  • Node.js 22+ (for local CLI usage, optional)
  • A Slack workspace with a bot app created
  • A WhatsApp account (personal number works fine)
  • An AI model provider (Ollama, Anthropic API key, etc.)

Step 1: Clone and Build Moltbot

1
2
3
4
5
git clone <moltbot-repo>
cd moltbot

pnpm install
pnpm build

Step 2: Configure Environment Variables

Create a .env file in the project root:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# AI Model Provider
OLLAMA_API_KEY=your-ollama-api-key

# Gateway auth + binding
CLAWDBOT_GATEWAY_TOKEN=your-random-gateway-token
CLAWDBOT_GATEWAY_PORT=18789
CLAWDBOT_BRIDGE_PORT=18790
CLAWDBOT_GATEWAY_BIND=127.0.0.1

# Persistent volumes (host paths)
CLAWDBOT_CONFIG_DIR=/path/to/moltbot/local-config
CLAWDBOT_WORKSPACE_DIR=/path/to/moltbot/local-workspace

Generate a secure gateway token:

1
openssl rand -hex 16

Step 3: Run the Onboarding Wizard

The wizard walks you through initial gateway, workspace, and channel setup:

1
pnpm moltbot onboard --install-daemon

This creates ~/.clawdbot/moltbot.json (or local-config/moltbot.json for Docker setups) with your base configuration.

Step 4: Start the Gateway with Docker

The docker-compose.yml defines two services:

  • moltbot-gateway — The always-on daemon that handles all channel connections
  • moltbot-cli — A one-off container for admin commands (login, status, send)
1
docker compose up -d moltbot-gateway

Verify the container is running:

1
docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"

Expected output:

NmAoMlEtSbot-moltbot-gateway-1SUTpATXUSminutesP1O2R7T.S0.0.1:18789-18790->18789-18790/tcp

Step 4.1: Secure Docker With Loopback + Tailscale

To avoid exposing the gateway on your LAN, bind the gateway to loopback and publish ports only on 127.0.0.1.

Example docker-compose.yml snippet:

1
2
3
4
5
services:
  moltbot-gateway:
    ports:
      - "127.0.0.1:18789:18789"
      - "127.0.0.1:18790:18790"

Then use Tailscale to reach the gateway from your devices without opening it to the public internet.

On the host:

1
2
3
sudo tailscale up --ssh
tailscale serve --tcp 18789 127.0.0.1:18789
tailscale serve --tcp 18790 127.0.0.1:18790

On your client device (already logged in to the same tailnet), you can reach the gateway using the host’s Tailscale IP and the same ports. Keep your tailnet ACLs scoped to only the devices that should access Moltbot.

Step 5: Configure Slack Integration

Create a Slack App

  1. Open the Slack developer console and click Create New App
  2. Choose From scratch, name it (e.g., “Moltbot”), and select your workspace
  3. Under Socket Mode, enable it and generate an App-Level Token with connections:write scope
  4. Under OAuth & Permissions, add these Bot Token Scopes:
    • chat:write
    • channels:history
    • groups:history
    • im:history
    • mpim:history
    • app_mentions:read
  5. Install the app to your workspace and copy the Bot User OAuth Token (xoxb-...)
  6. Copy the App-Level Token (xapp-...)

Add Slack to Moltbot Config

Edit your local-config/moltbot.json and add the Slack channel:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
{
  "channels": {
    "slack": {
      "enabled": true,
      "botToken": "YOUR_BOT_TOKEN",
      "appToken": "YOUR_APP_TOKEN",
      "groupPolicy": "open"
    }
  },
  "plugins": {
    "entries": {
      "slack": {
        "enabled": true
      }
    }
  }
}

Verify Slack Connection

Restart the gateway and check status:

1
2
docker compose restart moltbot-gateway
docker compose run --rm moltbot-cli channels status --probe

You should see:

-Slackdefault:enabled,configured,bot:config,app:config

Step 6: Configure WhatsApp Integration

Moltbot uses Baileys (WhatsApp Web protocol) for WhatsApp — no paid API or business account required. You link your phone just like WhatsApp Web.

Add WhatsApp to Config

Edit local-config/moltbot.json and add the WhatsApp channel:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
{
  "channels": {
    "whatsapp": {
      "dmPolicy": "allowlist",
      "allowFrom": ["<your-number>"],
      "sendReadReceipts": true,
      "selfChatMode": true
    }
  },
  "plugins": {
    "entries": {
      "whatsapp": {
        "enabled": true
      }
    }
  }
}

Config options explained:

KeyDescription
dmPolicy"allowlist" — only numbers in allowFrom can chat. Options: allowlist, pairing, open
allowFromArray of E.164 phone numbers allowed to message the bot
sendReadReceiptsSend blue ticks when messages are read
selfChatModeSet true when using your personal number (chat with yourself)

Run the login command inside Docker:

1
docker compose run --rm moltbot-cli channels login

A QR code appears in your terminal. On your phone:

  1. Open WhatsApp
  2. Go to Settings > Linked Devices
  3. Tap Link a Device
  4. Scan the QR code

You should see:

WaiLtiinnkgedf!orCrWehdaetnstAipaplscosnanveecdtifoonr..f.uturesends.

Credentials are stored at ~/.clawdbot/credentials/whatsapp/<accountId>/creds.json and persist across restarts.

Restart and Verify

1
2
docker compose restart moltbot-gateway
docker compose run --rm moltbot-cli channels status --probe

Expected output:

--WShlaatcskApdpefdaeuflatu:lte:naebnlaebdl,edc,oncfoingfuirgeudr,edb,otl:icnoknefdig,app:config

Send a Test Message

1
docker compose run --rm moltbot-cli message send -t <your-number> --channel whatsapp --message "Hello from Moltbot"

You should receive the message in your WhatsApp.

Step 7: Configure the AI Model

Moltbot supports multiple model providers. Here’s an example using Ollama:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
  "models": {
    "mode": "merge",
    "providers": {
      "ollama": {
        "baseUrl": "your-ollama-endpoint",
        "apiKey": "${OLLAMA_API_KEY}",
        "api": "openai-completions",
        "models": [
          {
            "id": "your-model-id",
            "name": "Your Model Name",
            "contextWindow": 128000,
            "maxTokens": 8192
          }
        ]
      }
    }
  },
  "agents": {
    "defaults": {
      "model": { "primary": "ollama/your-model-id" }
    }
  }
}

For Anthropic (Claude), set ANTHROPIC_API_KEY in your .env and configure accordingly.

Full Configuration Reference

Here is a complete moltbot.json with both Slack and WhatsApp configured:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{
  "agents": {
    "defaults": {
      "workspace": "/home/node/clawd",
      "model": { "primary": "ollama/your-model-id" },
      "maxConcurrent": 4,
      "subagents": { "maxConcurrent": 8 }
    }
  },
  "commands": {
    "native": "auto",
    "nativeSkills": "auto"
  },
  "channels": {
    "slack": {
      "enabled": true,
      "botToken": "YOUR_BOT_TOKEN",
      "appToken": "YOUR_APP_TOKEN",
      "groupPolicy": "open"
    },
    "whatsapp": {
      "dmPolicy": "allowlist",
      "allowFrom": ["<your-number>"],
      "sendReadReceipts": true,
      "selfChatMode": true
    }
  },
  "gateway": {
    "mode": "local",
    "port": 18789,
    "bind": "lan",
    "auth": {
      "mode": "token",
      "token": "your-gateway-token"
    }
  },
  "plugins": {
    "entries": {
      "slack": { "enabled": true },
      "whatsapp": { "enabled": true }
    }
  }
}

CLI Quick Reference

CommandDescription
moltbot onboardRun the interactive setup wizard
moltbot gateway --port 18789Start the gateway daemon
moltbot channels loginLink WhatsApp via QR code
moltbot channels login --account <id>Link a specific WhatsApp account
moltbot channels logoutUnlink WhatsApp session
moltbot channels status --probeCheck all channel connections
moltbot message send -t <phone> --message "text"Send a message
moltbot message send -t <phone> --media <path>Send media (image/video/doc)
moltbot message send -t <phone> --channel whatsappForce send via WhatsApp
moltbot pairing list whatsappList pending pairing requests
moltbot pairing approve whatsapp <code>Approve a pairing request
moltbot doctorDiagnose common issues

Docker equivalents — prefix with docker compose run --rm moltbot-cli:

1
2
3
docker compose run --rm moltbot-cli channels login
docker compose run --rm moltbot-cli channels status --probe
docker compose run --rm moltbot-cli message send -t <your-number> --channel whatsapp --message "Hello"

Troubleshooting

IssueFix
Gateway not reachableRestart: docker compose restart moltbot-gateway
WhatsApp linked: falseRe-link: docker compose run --rm moltbot-cli channels login
required option --target not specifiedUse -t or --target instead of --to
Slack not connectingVerify botToken and appToken in config; ensure Socket Mode is enabled
Bot responds on wrong channelAdd --channel whatsapp or --channel slack to force routing
WhatsApp reconnect loopRun moltbot doctor or restart gateway and re-link

Security Best Practices

  1. Use allowlist DM policy — Don’t set dmPolicy: "open" unless you want anyone to message your bot
  2. Keep credentials out of version control — Use .env for tokens and API keys
  3. Generate strong gateway tokens — Use openssl rand -hex 16
  4. Restrict allowFrom — Only list phone numbers that should have access
  5. Review group policies — Set groupPolicy: "allowlist" to control which WhatsApp groups the bot responds in

Conclusion

With Moltbot running in Docker, you now have a personal AI assistant available on both Slack and WhatsApp. The gateway handles all channel connections, message routing, and session management, while Docker keeps everything isolated and easy to manage.

Key takeaways:

  • Slack uses Bot Token + App Token with Socket Mode for real-time messaging
  • WhatsApp uses Baileys (WhatsApp Web protocol) — link via QR code, no paid API needed
  • Docker Compose provides two services: the always-on gateway and the one-off CLI for admin tasks
  • Self-chat mode lets you use your personal WhatsApp number to talk to the bot

For more details, check the official Moltbot documentation and community channels.