OpenClaw Telegram Bot Setup, Pairing, and Troubleshooting
Configure an OpenClaw Telegram Bot from BotFather token to pairing, gateway verification, and not-responding troubleshooting.
How do you connect OpenClaw to Telegram?
Get a bot token from @BotFather, add the Telegram channel to openclaw.json, restart the gateway, and send /start to the bot to verify the connection.
- Use dmPolicy: open with allowFrom for open access
- Use dmPolicy: pairing and approve the pairing code on the server for controlled access
- If the bot does not respond, check the gateway, token, and Telegram logs first
Telegram Bot messages are sent through the OpenClaw/Lumecoder access path you configure. Avoid submitting sensitive personal information, important data, trade secrets, or unauthorized code, and follow local laws and provider terms.
Prerequisites
- OpenClaw + Lumecoder already installed and configured
- Telegram account
If not done, please read OpenClaw + Lumecoder Integration Guide
1. Get Telegram Bot Token
- Search for @BotFather in Telegram
- Send /newbot (create new Bot) or /mybots (view existing Bots)
- Select your Bot
- Click API Token
- Copy the Token (example format):
123456789:ABCdefGHIJKLMNOP
2. Configure Telegram
Edit configuration file
nano ~/.openclaw/openclaw.json
Add or modify telegram configuration in the channels section:
{
"channels": {
"telegram": {
"enabled": true,
"dmPolicy": "open",
"allowFrom": ["*"],
"botToken": "YOUR_BOT_TOKEN",
"groupPolicy": "allowlist",
"streamMode": "partial"
}
}
}Save and exit:
- Ctrl + O to save
- Ctrl + X to exit
Alternative: Replace Token via command
If configuration file exists, you can replace directly:
sed -i 's/OLD_TOKEN/NEW_TOKEN/' ~/.openclaw/openclaw.json
3. Restart and Verify
Restart Gateway
openclaw gateway restart
Check Gateway status
openclaw gateway status
View Telegram logs
grep -i telegram /tmp/openclaw/openclaw-$(date +%Y-%m-%d).log | tail -10
Log should show something like:
starting provider (@YourBotUsername)
4. Test the Bot
- Find your Bot in Telegram
- Click Start or send /start
- Send any message
- Bot should respond normally
If Bot responds normally, configuration is successful!
5. Configuration Reference
| Config | Value | Description |
|---|---|---|
| enabled | true | Enable Telegram |
| dmPolicy | "open" | Open mode, anyone can use |
| dmPolicy | "pairing" | Pairing mode, requires auth code |
| allowFrom | ["*"] | Allow all users (with open) |
| allowFrom | ["123456"] | Only allow specific Telegram user IDs |
| groupPolicy | "allowlist" | Group allowlist mode |
| streamMode | "partial" | Streaming output |
6. Troubleshooting
Bot not responding
Check if Gateway is running:
openclaw gateway status
tail -100 /tmp/openclaw/openclaw-$(date +%Y-%m-%d).log | grep -i error
"You are not authorized" error
Ensure open mode is configured, then restart:
"dmPolicy": "open", "allowFrom": ["*"]
openclaw gateway restart
Telegram pairing and pair command
With dmPolicy set to pairing, the user receives a pairing code after the first message. Approve it on the server:
openclaw pairing approve telegram <pairing-code>
Check if Bot Token is correct
cat ~/.openclaw/openclaw.json | grep botToken
Telegram bot stopped working after an OpenClaw upgrade
Confirm the upgrade did not replace channels.telegram, then restart the gateway and inspect the latest Telegram and error logs.
openclaw gateway restart
openclaw gateway status
tail -200 /tmp/openclaw/openclaw-$(date +%Y-%m-%d).log | grep -Ei "telegram|error"
7. Quick Command Reference
Edit Telegram config
nano ~/.openclaw/openclaw.json
Restart and check
openclaw gateway restart openclaw gateway status
Approve a Telegram pairing code
openclaw pairing approve telegram <pairing-code>
Related OpenClaw guides
Complete
You have successfully configured OpenClaw Telegram Bot and can now use AI in Telegram.
