Telegram Bot Integration with OpenClaw
Control OpenClaw AI from any Telegram client on your phone or desktop. Send tasks, check job status, and receive automated reports directly in chat.
Quick Start in 3 Steps
Step 1 — Create your bot: Message @BotFather on Telegram, send /newbot, and save the token.
Step 2 — Configure OpenClaw:
openclaw config set telegram.bot_token "YOUR_TOKEN"
openclaw config set telegram.allowed_users "YOUR_TELEGRAM_ID"Step 3 — Start and test:
openclaw start --telegram
# Then send to your bot: /run Summarize today's top AI newsPrerequisites
- OpenClaw v1.0.0 or later installed (Installation Guide)
- A Telegram account and the Telegram app
- Access to @BotFather on Telegram
- Your Telegram user ID (get it via @userinfobot)
Step 1: Create a Bot via BotFather
- Open Telegram and search for @BotFather
- Send
/newbotand follow prompts to name your bot - Copy the API token that BotFather provides (e.g.
123456789:ABCdef...) - Get your personal chat ID: message @userinfobot to receive your numeric ID
Always set telegram.allowed_users in your config to restrict bot access to your personal Telegram ID only.
Step 2: Install the Telegram Pack
openclaw install telegramStep 3: Configure
openclaw config set telegram.bot_token "123456789:ABCdef..."
openclaw config set telegram.allowed_users "YOUR_TELEGRAM_USER_ID"# config.yaml
integrations:
telegram:
bot_token: "${TELEGRAM_BOT_TOKEN}"
allowed_users:
- 123456789 # your numeric Telegram ID
mode: polling # polling or webhook
poll_interval: 2 # secondsBot Commands
| Command | Description |
|---|---|
/run <task> | Execute an AI task |
/status | Check current job status |
/stop | Stop the running job |
/help | Show available commands |
/config provider <name> | Switch AI provider |
Step 4: Start the Bot
# Start OpenClaw with Telegram integration enabled
openclaw start --telegramNow send /run Summarize today's top tech news to your bot in Telegram.
Webhook vs Polling
Polling is simpler — OpenClaw regularly asks Telegram for new messages. Works on any network.
Webhook is more efficient — Telegram pushes messages immediately. Requires a public HTTPS endpoint.
integrations:
telegram:
mode: webhook
webhook_url: https://api.your-domain.com/telegram/webhookScheduled Tasks and Reports
Set up OpenClaw to send you automated reports via Telegram at a scheduled time:
# config.yaml
integrations:
telegram:
bot_token: "${TELEGRAM_BOT_TOKEN}"
allowed_users:
- 123456789
scheduled_reports:
- cron: "0 9 * * *" # Daily at 9:00 AM
task: "Summarize yesterday's news headlines"
- cron: "0 17 * * 5" # Every Friday at 5 PM
task: "Generate a weekly productivity summary"# Or use the CLI to send a one-off message
openclaw telegram send "Backup complete. 42 files processed."Common Use Cases
- Remote monitoring — check server status from your phone:
/status - AI writing assistant — draft emails or reports on the go:
/run Write a reply to this email: [paste] - Code review — paste a snippet and ask for a review:
/run Review this Python code for bugs - Daily briefing — auto-send a morning digest at 8 AM with scheduled tasks
- Notification system — trigger Telegram alerts from scripts or CI/CD pipelines
Security Best Practices
Without allowed_users, anyone who knows your bot token can send it commands. Always set this to your personal Telegram ID.
- Store the bot token in an environment variable:
TELEGRAM_BOT_TOKEN - Never commit the token to version control or config files checked into git
- Use a separate bot for each environment (dev, staging, production)
- Rotate the bot token via @BotFather →
/revokeif compromised - Enable two-factor authentication on your Telegram account
Multi-User Access
Grant access to multiple Telegram users (e.g., a team):
integrations:
telegram:
allowed_users:
- 123456789 # Your personal ID
- 987654321 # Teammate
permission_levels:
123456789: admin # can run, stop, and configure
987654321: viewer # can only check /statusTroubleshooting
| Problem | Cause | Fix |
|---|---|---|
| Bot doesn't respond | Token invalid or bot not started | Verify token; run openclaw start --telegram |
| "Unauthorized" error | Bot token revoked | Generate new token via @BotFather → /token |
| Commands ignored | User ID not in allowed_users | Add your user ID (get it from @userinfobot) |
| Webhook not receiving | Public URL unreachable or HTTP-only | Use polling mode, or ensure HTTPS endpoint is accessible |
| Slow response | High poll_interval | Lower poll_interval to 1 second in config |
Try It Yourself
Once your Telegram bot is running, test these commands directly from the Telegram app on your phone or desktop.
Example 1: Run a task from Telegram while away from your computer
# In Telegram, message your bot:
/run Summarise yesterday's git commits in my main project
# OpenClaw runs on your server and replies:
# ✅ Done. Yesterday's commits:
# - feat: add dark mode toggle (3 files)
# - fix: correct timeout in API client
# - docs: update README with new config optionsExample 2: Schedule a daily briefing via Telegram
# Add to cron (runs on your server, sends result to Telegram)
# crontab -e
0 8 * * 1-5 openclaw run "Generate a brief morning standup: yesterday's work, today's priorities, blockers" \
--path ~/projects/main/ \
| openclaw telegram send "🌅 Daily Briefing
$(cat)"Example 3: Receive alerts from automated scripts
#!/usr/bin/env bash
# deploy.sh — send Telegram notification after deployment
./scripts/deploy.sh
if [ $? -eq 0 ]; then
openclaw telegram send "✅ Deployment succeeded: v$(cat VERSION) is live"
else
openclaw telegram send "❌ Deployment FAILED — check logs at /var/log/deploy.log"
fiallowed_users in your OpenClaw config.
What's Next
- Discord Bot Integration — bring OpenClaw AI to your Discord server
- Scheduling Tasks — advanced cron scheduling for automated reports
- Daily Workflow Automation — build a daily AI-powered assistant routine
- Autonomous Workflows — combine Telegram triggers with complex automation chains