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
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
| |
Step 2: Configure Environment Variables
Create a .env file in the project root:
| |
Generate a secure gateway token:
| |
Step 3: Run the Onboarding Wizard
The wizard walks you through initial gateway, workspace, and channel setup:
| |
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)
| |
Verify the container is running:
| |
Expected output:
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:
| |
Then use Tailscale to reach the gateway from your devices without opening it to the public internet.
On the host:
| |
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
- Open the Slack developer console and click Create New App
- Choose From scratch, name it (e.g., “Moltbot”), and select your workspace
- Under Socket Mode, enable it and generate an App-Level Token with
connections:writescope - Under OAuth & Permissions, add these Bot Token Scopes:
chat:writechannels:historygroups:historyim:historympim:historyapp_mentions:read
- Install the app to your workspace and copy the Bot User OAuth Token (
xoxb-...) - Copy the App-Level Token (
xapp-...)
Add Slack to Moltbot Config
Edit your local-config/moltbot.json and add the Slack channel:
| |
Verify Slack Connection
Restart the gateway and check status:
| |
You should see:
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:
| |
Config options explained:
| Key | Description |
|---|---|
dmPolicy | "allowlist" — only numbers in allowFrom can chat. Options: allowlist, pairing, open |
allowFrom | Array of E.164 phone numbers allowed to message the bot |
sendReadReceipts | Send blue ticks when messages are read |
selfChatMode | Set true when using your personal number (chat with yourself) |
Link WhatsApp via QR Code
Run the login command inside Docker:
| |
A QR code appears in your terminal. On your phone:
- Open WhatsApp
- Go to Settings > Linked Devices
- Tap Link a Device
- Scan the QR code
You should see:
Credentials are stored at ~/.clawdbot/credentials/whatsapp/<accountId>/creds.json and persist across restarts.
Restart and Verify
| |
Expected output:
Send a Test Message
| |
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:
| |
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:
| |
CLI Quick Reference
| Command | Description |
|---|---|
moltbot onboard | Run the interactive setup wizard |
moltbot gateway --port 18789 | Start the gateway daemon |
moltbot channels login | Link WhatsApp via QR code |
moltbot channels login --account <id> | Link a specific WhatsApp account |
moltbot channels logout | Unlink WhatsApp session |
moltbot channels status --probe | Check 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 whatsapp | Force send via WhatsApp |
moltbot pairing list whatsapp | List pending pairing requests |
moltbot pairing approve whatsapp <code> | Approve a pairing request |
moltbot doctor | Diagnose common issues |
Docker equivalents — prefix with docker compose run --rm moltbot-cli:
| |
Troubleshooting
| Issue | Fix |
|---|---|
Gateway not reachable | Restart: docker compose restart moltbot-gateway |
WhatsApp linked: false | Re-link: docker compose run --rm moltbot-cli channels login |
required option --target not specified | Use -t or --target instead of --to |
| Slack not connecting | Verify botToken and appToken in config; ensure Socket Mode is enabled |
| Bot responds on wrong channel | Add --channel whatsapp or --channel slack to force routing |
| WhatsApp reconnect loop | Run moltbot doctor or restart gateway and re-link |
Security Best Practices
- Use
allowlistDM policy — Don’t setdmPolicy: "open"unless you want anyone to message your bot - Keep credentials out of version control — Use
.envfor tokens and API keys - Generate strong gateway tokens — Use
openssl rand -hex 16 - Restrict
allowFrom— Only list phone numbers that should have access - 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.
