OpenClaw Telegram Bot Setup Guide
Configure Telegram Bot with OpenClaw + Lumecoder to use Gemini AI in Telegram.
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
Pairing mode authorization (dmPolicy: pairing)
User receives pairing code on first message, then run on server:
openclaw pairing approve telegram <pairing-code>
Check if Bot Token is correct
cat ~/.openclaw/openclaw.json | grep botToken
7. Quick Command Reference
Edit Telegram config
nano ~/.openclaw/openclaw.json
Restart and check
openclaw gateway restart openclaw gateway status
Complete
You have successfully configured OpenClaw Telegram Bot and can now use Gemini AI in Telegram.
