This guide assumes you have OpenClaw running (if not, see the getting started guide). Here we connect it to Telegram (easiest) and WhatsApp.
Telegram Setup (Start Here — 15 minutes)
Telegram is the simplest platform to connect because it has an official bot API. No bridges, no workarounds.
Step 1: Create a Telegram Bot with BotFather
- Open Telegram and search for @BotFather
- Send
/newbot - Choose a name for your bot (e.g. "My AI Assistant")
- Choose a username (must end in
bot, e.g.my_ai_assistant_bot) - BotFather gives you a token that looks like:
1234567890:ABCdefGHIjklMNOpqrSTUvwxyz
Copy that token — you need it in the next step.
Step 2: Add the Token to OpenClaw
Edit your .env file:
nano .env
Add:
TELEGRAM_BOT_TOKEN=1234567890:ABCdefGHIjklMNOpqrSTUvwxyz
Restart OpenClaw:
docker compose restart openclaw
# or
pm2 restart openclaw
Step 3: Test the Connection
In Telegram, find your bot by searching its username and send /start. OpenClaw should reply.
Send any message — your AI assistant will respond through the bot.
Optional: Allow group chats
To use OpenClaw in a Telegram group (useful for team setups), send BotFather the command /setjoingroups and enable it for your bot. Then add the bot to any group.
Step 4: Lock the Bot to Only You
By default, anyone who finds your bot can message it. To restrict access to your Telegram user ID only:
Find your Telegram user ID:
- Message @userinfobot in Telegram
- It returns your numeric ID (e.g.
123456789)
Add to .env:
TELEGRAM_ALLOWED_USER_IDS=123456789
# For multiple users:
# TELEGRAM_ALLOWED_USER_IDS=123456789,987654321
Restart OpenClaw. Now only your account can interact with the bot.
WhatsApp Setup (30–60 minutes)
WhatsApp is more involved because there's no official bot API. OpenClaw uses a WhatsApp bridge that connects via WhatsApp Web's multi-device protocol.
Option A: Dedicated Number (Recommended)
Using a separate number for your AI keeps it clean and avoids any risk to your main WhatsApp account.
Get a number:
- A cheap prepaid SIM (easiest)
- A virtual Indian number via services like TextNow or similar
- A Google Voice number (if you have US access)
Register WhatsApp on that number, then follow the steps below.
Option B: Multi-Device on Your Existing Number
WhatsApp allows up to 4 linked devices. OpenClaw can be one of them — no second number needed. Your AI and your phone share the same WhatsApp account.
Tradeoff: All messages to your number go through OpenClaw too. Configure the WHATSAPP_RESPOND_TO_ALL setting carefully.
Step 1: Enable WhatsApp in OpenClaw
In .env:
WHATSAPP_ENABLED=true
WHATSAPP_SESSION_PATH=./data/whatsapp-session
Restart:
docker compose restart openclaw
Step 2: Scan the QR Code
After restarting, OpenClaw displays a QR code in the terminal/logs:
docker compose logs -f openclaw | grep -A 20 "WhatsApp QR"
Or visit the OpenClaw web UI at localhost:3000 → Settings → WhatsApp — the QR code shows there.
To link using a dedicated number:
- Open WhatsApp on the phone with the dedicated number
- Go to Settings → Linked Devices → Link a Device
- Scan the QR code from OpenClaw
To link as a multi-device on your main number: Same process — link from your own WhatsApp number.
Step 3: Test
Send a WhatsApp message to the connected number. OpenClaw should reply within a few seconds.
If it's your own number: send a message to yourself from another device or contact.
Step 4: Keep the Session Alive
WhatsApp sessions occasionally expire if the server restarts without saving state. Make sure the session path is persistent:
# In .env:
WHATSAPP_SESSION_PATH=./data/whatsapp-session
# Make sure the data/ directory persists across Docker restarts
# If using Docker, ensure your docker-compose.yml mounts the data directory:
Check your docker-compose.yml has a volume mount for the data directory:
services:
openclaw:
volumes:
- ./data:/app/data # this line ensures session data persists
Step 5: Control Which Messages OpenClaw Responds To
By default, OpenClaw responds to direct messages to the connected number. Configure this in .env:
# Respond only to messages that start with "ai" or "/"
WHATSAPP_TRIGGER_PREFIX=/
# Or respond to all direct messages (default)
WHATSAPP_RESPOND_TO_ALL=true
# Ignore group chats (recommended to start)
WHATSAPP_RESPOND_IN_GROUPS=false
# Only respond to specific contacts (comma-separated phone numbers with country code)
WHATSAPP_ALLOWED_NUMBERS=+919876543210,+919123456789
Discord Setup (Optional, 20 minutes)
If you use Discord for community or team work:
Create a Discord Bot
- Go to discord.com/developers/applications
- Click New Application, give it a name
- Go to Bot → Add Bot
- Copy the Bot Token
- Under Privileged Gateway Intents, enable Message Content Intent
- Go to OAuth2 → URL Generator, select
botscope +Send Messages+Read Message Historypermissions - Use the generated URL to add the bot to your server
Add to .env:
DISCORD_BOT_TOKEN=your-discord-bot-token
DISCORD_RESPOND_IN_CHANNELS=channel-id-1,channel-id-2
Running All Platforms at Once
OpenClaw handles multiple platform connections simultaneously. Once configured, your .env looks something like:
# LLM
OPENAI_API_KEY=sk-...
OPENAI_MODEL=gpt-4o-mini
# Telegram
TELEGRAM_BOT_TOKEN=...
TELEGRAM_ALLOWED_USER_IDS=123456789
# WhatsApp
WHATSAPP_ENABLED=true
WHATSAPP_SESSION_PATH=./data/whatsapp-session
WHATSAPP_ALLOWED_NUMBERS=+919876543210
# Discord
DISCORD_BOT_TOKEN=...
All three run concurrently. You can message your AI from any platform and it maintains the same memory and context across all of them.
Why 24/7 Uptime Matters
Messaging integrations only work when OpenClaw is running. If your laptop is off, your WhatsApp AI goes silent.
For messaging to always work, you need an always-on machine. The options:
- Home server / Raspberry Pi — free but requires home hardware
- Cloud VPS — reliable, ~₹600–900/month on Hostinger
I cover the full VPS setup in Self-Hosting OpenClaw on Hostinger VPS.
Troubleshooting
Telegram bot not responding:
# Check logs
docker compose logs openclaw | grep -i telegram
# Verify token is correct — no spaces, no quotes in .env
WhatsApp QR code expired: QR codes expire after 60 seconds. Restart OpenClaw to generate a fresh one:
docker compose restart openclaw
WhatsApp session keeps logging out: Make sure the data directory is mounted as a Docker volume (see Step 4 above). The session file must persist across container restarts.
Getting responses from strangers on WhatsApp:
Set WHATSAPP_ALLOWED_NUMBERS to restrict to your number only. Or use a dedicated number that you don't share publicly.
Discord bot can't read messages: Ensure Message Content Intent is enabled in the Discord developer portal for your app.