Telegram Bot Setup
Deploy your OpenClaw AI agent as a Telegram bot using the Bot API via grammY.
Overview
OpenClaw integrates with Telegram via the Bot API using the grammY library. It supports both direct messages and group chats.
Quick Setup
1. Create a Bot Token
- Open Telegram and search for
@BotFather - Send
/newbotand follow the prompts - Copy the bot token (format:
123:abc...)
2. Configure OpenClaw
{
"channels": {
"telegram": {
"enabled": true,
"botToken": "123:abc...",
"dmPolicy": "pairing",
"groups": {
"*": {
"requireMention": true
}
}
}
}
}Or use an environment variable:
export TELEGRAM_BOT_TOKEN="123:abc..."3. Login and Start
openclaw channels login telegram
openclaw gateway4. Approve First DM
openclaw pairing list telegram
openclaw pairing approve telegram <CODE>DM Access Control
| Policy | Description |
|---|---|
pairing (default) | New senders must be approved via pairing code |
allowlist | Only allow specific sender IDs |
open | Allow all senders (set allowFrom: ["*"]) |
disabled | Reject all DMs |
{
"channels": {
"telegram": {
"dmPolicy": "allowlist",
"allowFrom": ["tg:123456789"]
}
}
}Group Chat Setup
- Add the bot to a Telegram group
- Disable privacy mode: send
/setprivacyto@BotFather - Or make the bot a group admin
BotFather Settings
/setjoingroups— Allow/deny group membership/setprivacy— Control group message visibility
Features
- ✅ Direct messages with pairing
- ✅ Group chats with mention activation
- ✅ Image and media support
- ✅ Audio/voice messages
- ✅ Sticker handling
- ✅ Video messages
Troubleshooting
Bot not responding
- Verify
botTokenis correct - Check
openclaw gateway status - Run
openclaw doctor --fix
Messages not received in groups
- Disable privacy mode via
/setprivacy - Or make the bot a group admin
Next Steps
- WhatsApp Deployment — WhatsApp setup
- AI Agent — Configure agent behavior
- Clawdbot — Bot configuration