OpenClaw Telegram Bot Setup — From BotFather to Production (2026)
TL;DR
Setting up an OpenClaw Telegram bot takes about 10 minutes: create a bot via @BotFather, copy the token, paste it into OpenClaw's config, and you're live. This guide covers the full flow — from a blank slate to a production-ready bot with webhooks, group support, and proper error handling.
Want to skip the setup? OneClaw has BotFather integration built-in. Paste your token, pick an AI model, and your bot is live in 3 minutes. Start a free trial →
Why Telegram is the Best Channel for OpenClaw
| Feature | Telegram | WhatsApp (Baileys) | Discord |
|---|---|---|---|
| Official bot API | ✅ | ❌ (unofficial, ban risk) | ✅ |
| Setup time | 3 min | 15 min | 10 min |
| Per-message cost | Free | Free (unofficial) | Free |
| Proactive messaging | ✅ | ❌ | ✅ |
| File/image support | ✅ up to 2 GB | ✅ 64 MB | ✅ 25 MB |
| Group/channel support | ✅ | ✅ | ✅ |
| Account ban risk | None | Medium-High | None |
Recommendation: Start with Telegram. Add WhatsApp/Discord later if you need them.
Prerequisites
- A Telegram account (free)
- A running OpenClaw instance — self-hosted (see our Hostinger guide) or on OneClaw
- An AI model API key already configured in OpenClaw
Estimated time: 10 minutes.
Step 1: Create a Bot with @BotFather
BotFather is Telegram's official bot for creating other bots.
- Open Telegram → search
@BotFather(blue verified ✓) - Start chat → send
/newbot
BotFather asks 2 questions:
Display name → e.g. "My Personal Assistant"
Username ending in bot → e.g. my_assistant_bot (globally unique)
BotFather replies with your token:
1234567890:AAHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Copy it.
Step 2: Configure OpenClaw
On OneClaw (managed)
- Dashboard → Deploy
- Paste token in "Telegram Token" field
- Pick AI model (Claude / GPT / Gemini)
- Click "Deploy" — live in 30 seconds
Skip to Step 4.
Self-hosting
nano /opt/openclaw/.env
Add:
TELEGRAM_BOT_TOKEN=1234567890:AAHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Restart:
cd /opt/openclaw && docker compose restart openclaw
Watch logs for Telegram bot connected: @my_assistant_bot.
Step 3: Set Bot Commands (Recommended)
In @BotFather:
- Send
/setcommands→ pick your bot - Paste:
help - Show what I can do
reset - Clear conversation history
summarize - Summarize a URL or text
image - Generate an image
settings - Change preferences
Users see a menu button with auto-complete.
Step 4: Test Your Bot
- Telegram → search your bot (e.g.
@my_assistant_bot) - Send
/start - Within 1-2s you get a welcome message
- Send "Summarize the latest news on AI agents"
- Verify Claude/GPT-powered response
🎉 Your OpenClaw Telegram bot is live.
Step 5: Add to Groups (Optional)
By default bots only see @mentions in groups. To see all messages:
- @BotFather →
/mybots→ select bot - Bot Settings → Group Privacy → Disable
Add bot to any group. Be transparent in the group description.
Step 6: Webhooks for Production
Polling works for personal use. Webhooks reduce latency.
Self-hosted
Need a public HTTPS URL. In .env:
TELEGRAM_WEBHOOK_URL=https://your-domain.com/webhook/telegram
Restart — OpenClaw registers webhook automatically. Verify:
curl https://api.telegram.org/bot<TOKEN>/getWebhookInfo
OneClaw
Webhooks enabled by default. Nothing to do.
Step 7: Customize the Bot Personality
OpenClaw uses SOUL.md to define personality, skills, memory.
OneClaw
Dashboard → Templates to pick from 40+ pre-built personalities, or → Personality to edit SOUL.md directly. Changes push in < 10 seconds.
Self-hosted
Edit /opt/openclaw/data/SOUL.md:
# Who I Am
AI assistant for Acme Corp customer support.
## Personality
- Friendly but professional
- Ask clarifying questions
- Escalate to human when unsure
## What I Can Do
- Answer product questions
- Draft support tickets
- Search our docs
Restart OpenClaw.
Troubleshooting
Bot doesn't reply
docker compose logs -f openclawcurl https://api.telegram.org/bot<TOKEN>/getMeshould return bot infocurl -I https://api.telegram.orgfor egress- Clear stale webhook:
curl https://api.telegram.org/bot<TOKEN>/deleteWebhook
"Conflict: terminated by other getUpdates request"
- Another process is polling the same token. Kill it or rotate token.
Bot replies with API errors
- Check
ANTHROPIC_API_KEYbilling / rate limit
Group messages ignored
- Privacy mode on. BotFather → Bot Settings → Group Privacy → Disable.
Messages truncated
- Telegram caps at 4096 chars. OpenClaw auto-splits. If truncation persists, set
MAX_MESSAGE_LENGTHor send long responses as.txtattachments.
Production Checklist
- Token in secret manager (not plaintext committed to git)
- Rate limit configured (
MAX_CONCURRENT_REQUESTS=5) - Error messages don't leak stack traces
- Descriptive bot username
-
/helpcommand lists capabilities - Privacy policy link in bot description (
/setdescription) - Webhooks + HTTPS
- Monitoring — alerts if bot stops responding > 5 min
- Daily backups of chat history / user preferences
OneClaw handles all of these by default.
Skip All This — Use OneClaw
OneClaw does it for you:
- Paste BotFather token → live in 30 seconds
- Pick AI model from dropdown
- Pre-configured: group privacy, commands, webhooks, monitoring
- Auto-updates, daily backups, 99.9% uptime SLA
Related Guides
- Install OpenClaw on Hostinger VPS
- OpenClaw One-Click Deploy Guide
- Personal AI Agent Free
- Best OpenClaw Hosting 2026
Published by the OneClaw team. Feedback? Open an issue on GitHub or email support@oneclaw.net.