Complete guide for migrating your OpenClaw bot from WhatsApp to Telegram.
✅ Official Bot API - Stable, supported, won't break ✅ No QR scanning - Just use a token ✅ No disconnections - Stays connected reliably ✅ No ban risk - Bots are first-class citizens ✅ Multi-device - Phone, desktop, web simultaneously ✅ Better privacy - Bot doesn't need your phone number ✅ Simpler setup - 5 minutes vs 15+ for WhatsApp
Download Telegram:
- macOS/iOS: App Store
- Android: Play Store
- Linux: https://telegram.org/dl/desktop/linux
- Web: https://web.telegram.org
Create account:
- Open Telegram
- Enter your phone number
- Enter SMS verification code
- Set up profile (name, photo)
Privacy tip:
- Settings → Privacy → Phone Number → "Nobody" (hide your number)
Open Telegram and message @BotFather:
- Search for @BotFather (verified bot with checkmark)
- Start a chat:
/start
Create the bot:
/newbot
BotFather will ask:
Bot name: (shown to users)
My Assistant
Bot username: (must end in "bot")
my_assistant_bot
You'll get a token like:
7123456789:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw
Additional bot settings (optional):
/setdescription - Set bot description
/setabouttext - Set about text
/setuserpic - Upload bot profile picture
You need your Telegram user ID to configure the allowlist.
Option A: Use @userinfobot
- Search for @userinfobot on Telegram
- Start a chat with it
- It will reply with your user ID (e.g.,
123456789)
Option B: Use @getidsbot
- Search for @getidsbot
- Send any message
- It replies with your ID
Save your user ID - you'll need it for the config.
SSH into your VPS:
ssh root@openclaw # or ssh openclaw
cd /root/openclawStop the gateway:
docker compose downEdit OpenClaw config:
nano /root/.openclaw/openclaw.jsonAdd Telegram configuration:
Telegram needs TWO sections - channels for config and plugins.entries to enable:
{
"channels": {
"telegram": {
"enabled": true,
"botToken": "7123456789:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw",
"dmPolicy": "allowlist",
"allowFrom": ["123456789"]
}
},
"plugins": {
"entries": {
"telegram": {
"enabled": true
},
"whatsapp": {
"enabled": false
}
}
}
}Replace:
"botToken"- Your bot token from @BotFather"123456789"- Your Telegram user ID as a string
Save and exit: Ctrl+X, Y, Enter
OpenClaw might need the Telegram plugin installed.
Check if installed:
docker compose exec openclaw-gateway openclaw plugins listIf Telegram plugin is missing, the gateway will auto-install it on startup.
docker compose up -dWatch logs:
docker compose logs -f openclaw-gatewayLook for:
[telegram] Connected to Telegram
[telegram] Listening for Telegram messages
If you see errors, check:
- Token is correct
- User ID is a number (no quotes)
- JSON syntax is valid
On Telegram:
- Search for your bot:
@my_assistant_bot(your bot username) - Start a chat:
/start - Send a message:
Hello!
Your bot should respond!
Check logs on VPS:
docker compose logs -f openclaw-gateway | grep telegramYou should see:
[telegram] Received message from user 123456789
[telegram] Sent response to user 123456789
If everything works with Telegram, you can disable WhatsApp:
Already done in Step 4 - in the plugins section:
"plugins": {
"entries": {
"whatsapp": {
"enabled": false
}
}
}Or keep both enabled if you want multi-channel support:
{
"channels": {
"telegram": { ... },
"whatsapp": { ... }
},
"plugins": {
"entries": {
"telegram": { "enabled": true },
"whatsapp": { "enabled": true }
}
}
}{
"agents": {
"defaults": {
"model": {
"primary": "anthropic/claude-haiku-4-5"
},
"heartbeat": {
"every": "30m"
},
"maxConcurrent": 4
}
},
"channels": {
"telegram": {
"enabled": true,
"botToken": "7123456789:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw",
"dmPolicy": "allowlist",
"allowFrom": ["123456789"],
"streamMode": "partial"
}
},
"plugins": {
"entries": {
"telegram": {
"enabled": true
},
"whatsapp": {
"enabled": false
}
}
},
"gateway": {
"port": 18789,
"bind": "127.0.0.1",
"token": "your-gateway-token-here"
}
}You can add custom commands via @BotFather:
/setcommands
Then send:
help - Show help
status - Bot status
skills - List installed skills
These appear in Telegram's command menu (/ button).
Hide your phone number:
- Telegram Settings → Privacy → Phone Number
- Set to "Nobody" or "My Contacts"
Bot privacy:
- Bots can only see messages sent to them
- Your bot username is public (anyone can message it)
- Use
dmPolicy: "allowlist"to restrict access
Check logs:
docker compose logs -f openclaw-gateway | grep telegramCommon issues:
- Wrong token format
- User ID as string instead of number:
"123"→123 - JSON syntax error (missing comma, bracket)
- Bot token not saved correctly
Test token manually:
curl https://api.telegram.org/bot<TOKEN>/getMeReplace <TOKEN> with your bot token. Should return bot info.
- Token is wrong or expired
- Regenerate token: @BotFather →
/token→ select your bot
- Check
allowFromlist includes your user ID - Check
dmPolicyis set correctly - View full logs:
docker compose logs openclaw-gateway
- Username must end in
bot - Wait a few minutes for Telegram to index it
- Try searching exact username:
@your_bot_username
| Feature | Telegram | |
|---|---|---|
| Setup | 5 min, just token | 15 min, QR scanning |
| Stability | Never disconnects | Frequent disconnects |
| Multi-device | ✅ All devices | ❌ Phone only |
| Ban risk | ✅ No risk | ❌ Can get banned |
| Privacy | ✅ Username-based | ❌ Phone exposed |
| API | ✅ Official | ❌ Unofficial |
| Groups | ✅ Full support | |
| Bots | ✅ First-class | ❌ Hack/workaround |
Add bot to a group:
- Create a Telegram group
- Add your bot as member
- Get group ID via @getidsbot (send message in group)
- Update config:
{
"channels": {
"telegram": {
"groupPolicy": "allowlist",
"allowFrom": ["123456789"],
"allowGroups": ["-987654321"]
}
}
}Privacy settings for groups:
Via @BotFather:
/setprivacy
- Disabled - Bot sees all messages
- Enabled - Bot only sees commands and mentions
Your bot token is the only credential you need. Save it securely:
# View current token
grep -A5 telegram /root/.openclaw/openclaw.jsonIf you lose the token:
- Message @BotFather
/mybots→ select your bot → API Token- Copy and update config
✅ Never share your bot token - Anyone with it can control your bot ✅ Use allowlist - Only you can message the bot ✅ Disable group policy - Unless you need it ✅ Rotate token - If compromised, revoke via @BotFather ✅ Monitor logs - Check for unauthorized access attempts
- ✅ Create Telegram account
- ✅ Create bot via @BotFather
- ✅ Get your user ID
- ✅ Configure OpenClaw
- ✅ Test the bot
- ✅ Disable WhatsApp (optional)
- Enjoy stable, reliable bot messaging!
Useful bots:
- @BotFather - Create and manage bots
- @userinfobot - Get your user ID
- @getidsbot - Get user/group IDs
Telegram API test:
# Get bot info
curl https://api.telegram.org/bot<TOKEN>/getMe
# Get updates
curl https://api.telegram.org/bot<TOKEN>/getUpdatesOpenClaw commands:
# Restart
docker compose restart openclaw-gateway
# View logs
docker compose logs -f openclaw-gateway
# Check config
cat /root/.openclaw/openclaw.json | grep -A10 telegram