openclaw telegram setupopenclaw telegram botopenclaw botfatherconnect openclaw to telegramtelegram bot ai

OpenClaw Telegram Bot Setup: Complete 2026 Guide (BotFather to Production)

April 23, 202610 min readBy OneClaw Team

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

FeatureTelegramWhatsApp (Baileys)Discord
Official bot API❌ (unofficial, ban risk)
Setup time3 min15 min10 min
Per-message costFreeFree (unofficial)Free
Proactive messaging
File/image support✅ up to 2 GB✅ 64 MB✅ 25 MB
Group/channel support
Account ban riskNoneMedium-HighNone

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.

  1. Open Telegram → search @BotFather (blue verified ✓)
  2. 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)

  1. Dashboard → Deploy
  2. Paste token in "Telegram Token" field
  3. Pick AI model (Claude / GPT / Gemini)
  4. 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:

  1. Send /setcommands → pick your bot
  2. 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

  1. Telegram → search your bot (e.g. @my_assistant_bot)
  2. Send /start
  3. Within 1-2s you get a welcome message
  4. Send "Summarize the latest news on AI agents"
  5. 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:

  1. @BotFather → /mybots → select bot
  2. 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 openclaw
  • curl https://api.telegram.org/bot<TOKEN>/getMe should return bot info
  • curl -I https://api.telegram.org for 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_KEY billing / 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_LENGTH or send long responses as .txt attachments.

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
  • /help command 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

Start your 3-Day Free Trial →


Related Guides


Published by the OneClaw team. Feedback? Open an issue on GitHub or email support@oneclaw.net.

Frequently Asked Questions

How do I get a Telegram bot token for OpenClaw?
Open Telegram, search for @BotFather (with the blue verified checkmark), send /newbot, then pick a display name and a unique username ending in "bot". BotFather replies with a token like 1234567890:AAHxxx... — paste that into OpenClaw. If you lose the token you can run /token in the BotFather chat to retrieve it.
Why isn't my OpenClaw Telegram bot responding?
Three most common causes: (1) token in .env has a trailing space or mismatches BotFather — copy it fresh; (2) server can't reach api.telegram.org — verify with curl -I https://api.telegram.org; (3) a previous deployment left a webhook registered — call https://api.telegram.org/bot<TOKEN>/deleteWebhook to clear it so long-polling works.
Can an OpenClaw bot join Telegram groups?
Yes. Disable "Group Privacy" via BotFather (/mybots → [your bot] → Bot Settings → Group Privacy → Disable) so the bot can read group messages. Then add the bot to any group. By default bots only see commands unless privacy mode is disabled.
Do I need webhooks or is polling fine?
Polling (the default) works for most users and is simpler. Use webhooks when you want lower latency or to run behind a load balancer. OpenClaw supports both — set TELEGRAM_WEBHOOK_URL in your .env to switch. OneClaw managed hosting uses webhooks by default.
How do I add commands like /help and /reset?
Send /setcommands to BotFather, select your bot, then paste a list of commands with short descriptions. OpenClaw auto-wires these to its command handlers based on your agent configuration.

Ready to Deploy OpenClaw?

Get your AI assistant running in under 60 seconds with OneClaw.

Get Started Free

Stay ahead with AI assistant tips

Weekly insights on self-hosted AI, privacy, and automation