<diagnosis_order>
- •Check gateway service status and recent logs
- •Verify telegram providers are starting (look for "[telegram] [name] starting provider")
- •Check for 401 Unauthorized errors (invalid/revoked bot token)
- •Check for stale update-offset files (from recreated bots)
- •Verify config has correct account entries and bindings
- •Test bot token directly with Telegram API </diagnosis_order>
<config_locations> Gateway config: ~/.openclaw/openclaw.json Telegram state: ~/.openclaw/telegram/update-offset-*.json Bot token file (legacy): ~/.openclaw/telegram-bot-token Service: systemctl --user status openclaw-gateway Logs: journalctl --user -u openclaw-gateway </config_locations>
<telegram_config_structure> Agents need THREE things to work on Telegram:
- •Agent definition in agents.list (id, model, workspace)
- •Telegram account in channels.telegram.accounts (name, enabled, botToken)
- •Binding connecting agent to telegram account (agentId, match.channel, match.accountId)
Example working config:
"agents": {
"list": [
{ "id": "robson", "workspace": "/home/user/openclaw/robson" }
]
},
"bindings": [
{ "agentId": "robson", "match": { "channel": "telegram", "accountId": "robson" }}
],
"channels": {
"telegram": {
"accounts": {
"robson": {
"name": "Robson",
"enabled": true,
"botToken": "123456789:AAxxxxxxxxxxxxxxxxxxxxxxxxx",
"dmPolicy": "pairing",
"groupPolicy": "allowlist",
"streamMode": "partial"
}
}
}
}
</telegram_config_structure>
<common_issues>
Bot not responding (401 Unauthorized)
Cause: Token was revoked or bot was deleted/recreated in BotFather. Fix: Get new token from BotFather, update botToken in config, restart gateway.
Bot recreated with same name
Cause: New bot has different ID, old update-offset file has stale state. Fix: Delete ~/.openclaw/telegram/update-offset-AGENTNAME.json and restart gateway.
Missing telegram provider in logs
Cause: Account missing "enabled: true" or no botToken configured. Fix: Add explicit account entry with enabled: true and botToken.
Agent bound to wrong bot
Cause: "default" account uses tokenFile, not agent-specific token. Fix: Create explicit account for each agent with own botToken.
setMyCommands failed (400: BOT_COMMANDS_TOO_MUCH)
Cause: Too many slash commands registered with Telegram. Status: Non-critical warning, bot still works.
</common_issues>
<diagnostic_commands>
# Check gateway status systemctl --user status openclaw-gateway # Check which telegram providers started journalctl --user -u openclaw-gateway --since "5 minutes ago" | grep -E "telegram.*starting" # Check for errors journalctl --user -u openclaw-gateway --since "5 minutes ago" | grep -iE "(error|fail|401|403)" # Test bot token directly curl -s "https://api.telegram.org/bot<TOKEN>/getMe" | jq . # Check telegram state files ls -la ~/.openclaw/telegram/ # Read config accounts cat ~/.openclaw/openclaw.json | jq '.channels.telegram.accounts' # Read bindings cat ~/.openclaw/openclaw.json | jq '.bindings'
</diagnostic_commands>
<fix_procedures>
Add new telegram bot for agent
- •Create bot in BotFather: /newbot
- •Copy the token
- •Edit ~/.openclaw/openclaw.json:
- •Add account entry in channels.telegram.accounts
- •Add binding in bindings array
- •Restart: systemctl --user restart openclaw-gateway
- •Verify: journalctl --user -u openclaw-gateway | grep "starting provider"
Reset bot after recreation
- •Delete stale offset: rm ~/.openclaw/telegram/update-offset-AGENT.json
- •Update token in config if needed
- •Restart: systemctl --user restart openclaw-gateway
Update bot token
- •Edit ~/.openclaw/openclaw.json
- •Find channels.telegram.accounts.AGENT.botToken
- •Replace with new token
- •Gateway may hot-reload, or restart manually
</fix_procedures>
<verification> After any fix: 1. Check logs for "starting provider (@botname)" without errors 2. Test bot token: curl "https://api.telegram.org/bot<TOKEN>/getMe" 3. Send test message to bot 4. Verify message appears in logs </verification><related_files> Gateway service definition: home-manager module (systemd user service) Agent workspaces: ~/openclaw/<agent-name>/ Skills deployment: ~/openclaw/<agent-name>/skills/ </related_files>