Integrating OpenClaw with Telegram turns your favorite messaging app into a powerful control center for your AI agent. Send commands, trigger automations, and receive notifications directly through Telegram. This guide covers everything from creating your bot to troubleshooting common issues.
Prerequisites
Before you begin, ensure you have:
- A Telegram account
- OpenClaw deployed and configured (version 2026.2.3 or higher recommended)
- Node.js (version 24 recommended, 22.14+ supported)
- An API key from a model provider (Anthropic, OpenAI, or Google)
Step 1: Create a Telegram Bot
Every Telegram integration starts with a bot. Here is how to create one:
- Open Telegram and search for @BotFather
- Select the official account with the blue verified checkmark
- Start a chat and send /newbot
- Follow the prompts to choose a display name for your bot
- Choose a unique username that must end in 'bot' (e.g., MyAssistantBot)
- Copy the HTTP API token provided by BotFather. This is essential for connecting OpenClaw to your bot.
Step 2: Configure OpenClaw with the Bot Token
Now add the token to your OpenClaw configuration:
- Access your OpenClaw configuration via the CLI (openclaw onboard), the web interface, or by editing ~/.openclaw/openclaw.json
- Navigate to the Telegram channel settings
- Add your bot token to the botToken field
"channels": {
"telegram": {
"enabled": true,
"dmPolicy": "pairing",
"botToken": "YOUR_TELEGRAM_BOT_TOKEN",
"groupPolicy": "allowlist",
"streamMode": "partial"
}
}Key Configuration Options
- dmPolicy: 'pairing' (requires approval), 'allowlist' (pre-approved users), or 'open'
- groupPolicy: Controls group chat access
- streamMode: 'partial' for incremental responses, 'full' for complete messages
Set dmPolicy to "pairing" for secure access, at least initially.
Step 3: Pair Your Telegram Account
The pairing process ensures only authorized users can control your OpenClaw instance:
- Restart OpenClaw or the gateway for changes to take effect
- Open Telegram and search for your newly created bot
- Send /start or any message to your bot
- Your OpenClaw bot will reply with your Telegram user ID and a pairing code
- Copy this pairing code
- Approve the pairing in OpenClaw: openclaw pairing approve telegram <CODE>
- Your Telegram account is now permanently allowlisted
Step 4: Verify and Test
Confirm everything is working:
- Check Telegram channel status: openclaw channels status --probe
- You should see: Telegram enabled, configured, running, and working
- Send a test message to your bot (e.g., "Hello")
- Your OpenClaw agent should respond
Step 5: Configure for Group Chats (Optional)
If you want to use your bot in Telegram groups:
- In BotFather, send /setjoingroup, select your bot, and choose "Enable"
- By default, bots only see messages that mention them
- To see all messages, send /setprivacy to BotFather, select your bot, and choose "Disable"
- Alternatively, make your bot a group administrator
- After changing privacy settings, you may need to remove and re-add the bot to existing groups
In your OpenClaw configuration, set groupPolicy and channels.telegram.groups to match your desired access model.
Security Best Practices
- Never expose your bot token publicly. If compromised, regenerate it immediately via @BotFather
- Use "dmPolicy": "allowlist" and add your Telegram user ID to allowFrom for permanent access
- Always restart OpenClaw after configuration changes
- One bot token should connect to one OpenClaw instance. Create separate bots for multiple agents.
Troubleshooting Common Issues
Pairing Required Loop
If Telegram repeatedly sends new pairing codes without completing:
- Restart the OpenClaw container via your VPS panel or: docker compose -p openclaw restart
- Send a fresh message to generate a new code and approve it immediately
Silent Bot (Connected but No Replies)
Most silent bot problems relate to dmPolicy, allowFrom, or groupPolicy settings:
- Verify your numeric Telegram user ID (not @username) is in allowFrom
- Check health indicator in the dashboard (should be "Health OK")
- Verify "Running: Yes" and "Probe ok" in Channels section
Network and Firewall Issues
If the bot fails silently, especially during initial polling:
- Check if your firewall is blocking connections to api.telegram.org
- Temporarily use a mobile hotspot to diagnose network restrictions
- Ensure DNS/IPv6/proxy routing to api.telegram.org is correctly configured
"Unsupported type" Error
If you see "Unsupported type: … Use Raw mode":
- Install or upgrade the oxylabs-ai-studio-openclaw plugin to version 1.0.2 or newer
- Restart the OpenClaw container
FAQ
How do I create a Telegram bot for OpenClaw?
Open Telegram and search for @BotFather. Send /newbot, follow the prompts to choose a name and unique username (must end in 'bot'), and copy the HTTP API token provided.
What is the pairing process for Telegram?
After configuring the bot token, message your bot with /start. It will reply with a pairing code and your user ID. Approve it in OpenClaw with: openclaw pairing approve telegram <CODE>
What does dmPolicy control?
dmPolicy controls how the bot responds to direct messages. Use 'pairing' for secure access (requires approval), 'allowlist' for pre-approved users, or 'open' for anyone.
How do I enable the bot for group chats?
In BotFather, send /setjoingroup and enable it. To see all messages (not just mentions), send /setprivacy and disable privacy mode. Make the bot an admin for full access.
Why is my bot connected but not responding?
Check your dmPolicy and allowFrom settings. Verify your Telegram user ID is in the allowlist. Ensure privacy mode is disabled for groups. Run openclaw doctor --fix for diagnostics.
Need help from people who already use this stuff?
Need help with Telegram?
Join My AI Agent Profit Lab: practical help from people who've already solved the same Telegram integration issues.