To connect Telegram to OpenClaw, create a bot with BotFather on Telegram, copy the TELEGRAM_BOT_TOKEN, and configure it in OpenClaw's config file. OpenClaw then communicates with Telegram's Bot API to send messages, receive commands, and automate notifications across chats and groups. This is a direct API integration — no ClawHub skill required. Telegram's bot API is one of the most developer-friendly messaging APIs available, with no hardware prerequisites.
Why Connect Telegram to OpenClaw?
Telegram's Bot API is widely regarded as one of the cleanest and most capable messaging APIs available to developers. Unlike Discord (which has a complex guild/channel hierarchy and privileged intents system) or WhatsApp (which requires business verification), Telegram lets anyone create a bot in under two minutes through BotFather with zero approval requirements. This makes it the fastest path to messaging automation for individuals, developer teams, and small businesses.
Connecting Telegram to OpenClaw gives your AI agent a real-time communication channel. The most common use cases are: sending notifications when events occur (new sign-ups, system alerts, task completions), receiving commands from users and generating AI-powered responses, building announcement channels that auto-post content, and creating personal productivity bots that respond to your own messages. Telegram's flat chat model — where each bot-user or bot-group interaction is a simple chat ID — makes it straightforward to target specific recipients.
This integration uses Telegram's standard Bot API endpoints (api.telegram.org) with your bot token as the authentication credential. OpenClaw can either poll for updates using the `getUpdates` method (simpler, works without a public URL) or receive updates via webhook (real-time, requires OpenClaw to have an accessible HTTPS endpoint). Both approaches are covered in this guide — polling is recommended for getting started, switching to webhooks for production use cases that require low latency.
Integration method
Telegram's Bot API uses token-based authentication issued by BotFather — Telegram's official bot creation service. You register a bot with BotFather, receive a TELEGRAM_BOT_TOKEN, and configure OpenClaw to communicate with the Bot API at api.telegram.org. OpenClaw can then send messages via the REST API and receive incoming messages via getUpdates polling or Webhook delivery. This is a direct HTTP API integration with no ClawHub skill layer in between.
Prerequisites
- A Telegram account (mobile app or desktop — needed to chat with BotFather)
- OpenClaw installed and running on your machine
- Your personal Telegram chat ID or a target group/channel ID for testing
- Basic familiarity with API configuration and config files
- Optional: a public HTTPS URL for webhook delivery (not required for polling)
Step-by-step guide
Create a Telegram Bot with BotFather and Get Your Token
Create a Telegram Bot with BotFather and Get Your Token
Open Telegram and search for '@BotFather' — this is Telegram's official bot for creating and managing other bots. Start a chat and send the `/newbot` command. BotFather will ask for two things: a display name for your bot (this is what people see in chats, can include spaces, e.g., 'OpenClaw Assistant') and a username (must end in 'bot', no spaces, e.g., 'openclaw_assistant_bot'). Once you provide both, BotFather replies with your bot token in this format: `1234567890:AABBCCDDEEFF-gghhiijjkk_llmmnnoo`. Copy the entire token — this is your TELEGRAM_BOT_TOKEN. It functions as both the bot's identity and authentication credential. Store it securely and never post it publicly. While in BotFather, configure a few optional but useful settings: - `/setdescription` — sets the 'What can this bot do?' text users see before starting - `/setcommands` — registers command suggestions (e.g., `/help`, `/status`, `/ask`) so Telegram shows them as autocomplete options - `/setprivacy` — by default bots only see messages that mention them in groups. Set to DISABLED if you want the bot to see all group messages (needed for keyword triggers).
1# Your Telegram bot token format:2# TELEGRAM_BOT_TOKEN=1234567890:AABBCCDDEEFF-gghhiijjkk_llmmnnoo34# Verify your token works:5curl "https://api.telegram.org/bot<YOUR_TOKEN>/getMe"67# Expected response:8# {"ok": true, "result": {"id": 1234567890, "is_bot": true, "first_name": "OpenClaw Assistant", "username": "openclaw_assistant_bot"}}910# Get your own chat ID (send any message to your bot first, then run):11curl "https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates"Pro tip: To get your personal Telegram chat ID (needed to send yourself notifications), search for '@userinfobot' on Telegram, start it, and it will reply with your numeric user ID. This is the chat_id you use in API calls to message yourself.
Expected result: BotFather has issued your bot token, the getMe API call returns your bot's info, and you have your personal chat ID ready for testing.
Configure TELEGRAM_BOT_TOKEN in OpenClaw
Configure TELEGRAM_BOT_TOKEN in OpenClaw
Open OpenClaw's config file at `~/.openclaw/config.yaml` and add the Telegram integration block under the `integrations` key. The `bot_token` field takes your full TELEGRAM_BOT_TOKEN from BotFather. The `update_method` field controls how OpenClaw receives incoming messages: `polling` (OpenClaw repeatedly calls getUpdates to fetch new messages — works anywhere, no public URL needed) or `webhook` (Telegram pushes events to your OpenClaw server in real time — requires a public HTTPS URL). For the `polling` method, `poll_interval` sets how frequently OpenClaw checks for new updates in seconds. A value of 5-10 seconds gives near-real-time responsiveness for most use cases. The `timeout` field sets the long-polling timeout — using a longer value (like 30) means Telegram holds the connection open for up to 30 seconds waiting for new messages, which is more efficient than frequent short polls. The optional `allowed_chats` list restricts OpenClaw to specific chat IDs. Include your personal chat ID for testing, or leave it empty to respond to any chat the bot is added to.
1# ~/.openclaw/config.yaml2integrations:3 telegram:4 bot_token: "YOUR_TELEGRAM_BOT_TOKEN"5 update_method: polling # Options: polling | webhook6 poll_interval: 1 # Seconds between getUpdates calls (use with short timeout)7 timeout: 30 # Long-polling timeout in seconds (recommended)8 allowed_chats: # Optional: restrict to specific chat IDs9 - 123456789 # Your personal chat ID10 - -1001234567890 # Group chat IDs are negative numbers11 parse_mode: HTML # Default message formatting: HTML | Markdown | MarkdownV212 command_prefix: "/" # Telegram conventional command prefixPro tip: Group chat IDs in Telegram are negative numbers starting with -100. Channel IDs also follow a specific format. Use the getUpdates approach from Step 1 to find the correct IDs — send a message to the group/channel, then call getUpdates to see the chat ID in the response.
Expected result: Config is saved, `clawhub reload` runs without errors, and OpenClaw begins polling the Telegram Bot API for incoming updates.
Test Sending a Message from OpenClaw to Telegram
Test Sending a Message from OpenClaw to Telegram
Before building automation, confirm that OpenClaw can successfully send a message to a Telegram chat. The Telegram Bot API's `sendMessage` endpoint takes a `chat_id` and a `text` parameter — this is all you need for basic text messaging. For your first test, use your personal chat ID to send yourself a message. This confirms the bot token is valid and the chat_id is correct without needing a group setup. Telegram supports HTML and Markdown formatting in messages. Using `parse_mode=HTML`, you can include `<b>bold</b>`, `<i>italic</i>`, `<code>code</code>`, and `<a href="URL">links</a>` in messages. This is particularly useful for formatting OpenClaw-generated summaries, alerts, and reports. If the sendMessage call returns `{"ok": true}`, the message was delivered. If you see `{"ok": false}`, check the description field for the specific error — most commonly this is an invalid chat_id or the bot not being started by the user.
1# Test sending a message to yourself:2curl -X POST "https://api.telegram.org/bot<YOUR_TOKEN>/sendMessage" \3 -H "Content-Type: application/json" \4 -d '{"chat_id": YOUR_CHAT_ID, "text": "Hello from OpenClaw! Integration is working."}'56# Test with HTML formatting:7curl -X POST "https://api.telegram.org/bot<YOUR_TOKEN>/sendMessage" \8 -H "Content-Type: application/json" \9 -d '{10 "chat_id": YOUR_CHAT_ID,11 "text": "<b>OpenClaw Status</b>\n\nBot is <i>online</i> and ready.\n\n<code>TELEGRAM_BOT_TOKEN</code> configured.",12 "parse_mode": "HTML"13 }'1415# Send to a group (note the negative chat_id):16curl -X POST "https://api.telegram.org/bot<YOUR_TOKEN>/sendMessage" \17 -H "Content-Type: application/json" \18 -d '{"chat_id": -1001234567890, "text": "Bot connected to this group."}'Pro tip: The Telegram Bot API has no mandatory send rate limit for personal chats, but enforces 30 messages per second globally and 20 messages per minute per group. For bulk notifications to many users, batch them with a 50ms delay between sends.
Expected result: A message from your bot appears in your Telegram chat, confirming the bot token is valid and the API connection works correctly.
Configure Incoming Message Handling and Command Responses
Configure Incoming Message Handling and Command Responses
Now set up OpenClaw to receive and respond to incoming Telegram messages. With polling configured, OpenClaw fetches updates from the `getUpdates` endpoint and processes each message event. Telegram delivers updates as a JSON array. Each update contains an `update_id` (for deduplication), a `message` or `callback_query` or `inline_query` depending on the type, and within `message` you have `chat.id`, `from.id`, `text`, and `date`. Configure OpenClaw workflows to act on these incoming events. The most common pattern is a command handler: when a message starts with `/ask`, extract the rest of the text as a question, pass it to OpenClaw's AI, and reply with `sendMessage` back to the same `chat_id`. For groups, ensure you have set BotFather's privacy mode to DISABLED (using `/setprivacy` in BotFather) if you want the bot to see all messages — by default, bots in groups only receive messages that mention them directly or start with a slash command.
1# Sample getUpdates response structure (for understanding the data format):2# {3# "ok": true,4# "result": [{5# "update_id": 123456789,6# "message": {7# "message_id": 42,8# "from": {"id": 987654321, "first_name": "Alice"},9# "chat": {"id": 987654321, "type": "private"},10# "date": 1709123456,11# "text": "/ask What is the weather in London?"12# }13# }]14# }1516# ~/.openclaw/config.yaml — command handling workflow17workflows:18 telegram-command-handler:19 trigger:20 integration: telegram21 event: message22 conditions:23 - field: message.text24 starts_with: "/ask"25 actions:26 - type: ai-response27 prompt: "Answer this question concisely: {{trigger.message.text | remove_prefix('/ask ')}}"28 - type: integration-call29 integration: telegram30 endpoint: /sendMessage31 method: POST32 body:33 chat_id: "{{trigger.message.chat.id}}"34 text: "{{ai-response.output}}"35 parse_mode: HTML36 reply_to_message_id: "{{trigger.message.message_id}}"Pro tip: Use `reply_to_message_id` in your sendMessage calls to make OpenClaw's reply visually threaded under the original message in Telegram. This makes multi-turn conversations much easier to follow in group chats.
Expected result: OpenClaw responds to `/ask` commands in Telegram with AI-generated answers, replying directly in the same chat.
Optionally Switch to Webhook for Real-Time Delivery
Optionally Switch to Webhook for Real-Time Delivery
Polling works well for most use cases, but if you need truly real-time message delivery (sub-second response time) and you have a server with a public HTTPS URL, webhooks are more efficient — Telegram pushes each update to your endpoint the moment it arrives rather than waiting for the next poll cycle. To use webhooks: your OpenClaw server must be accessible at a public HTTPS URL (self-signed certificates are not supported — use Let's Encrypt or a reverse proxy like Cloudflare Tunnel). Register your webhook URL with Telegram using the `setWebhook` API call. Telegram will then POST each update to that URL in real time. Only one update delivery method can be active at a time. If you call `setWebhook`, polling (`getUpdates`) stops working. To switch back to polling, call `deleteWebhook` first. For most personal and small-team setups, polling with a 30-second timeout is equivalent to webhooks in practice. RapidDev recommends polling unless you are building a production bot that handles hundreds of messages per minute.
1# Register webhook (run once — Telegram stores this):2curl -X POST "https://api.telegram.org/bot<YOUR_TOKEN>/setWebhook" \3 -H "Content-Type: application/json" \4 -d '{5 "url": "https://your-openclaw-server.com/telegram/webhook",6 "secret_token": "optional-secret-for-verification",7 "allowed_updates": ["message", "callback_query"]8 }'910# Verify webhook is registered:11curl "https://api.telegram.org/bot<YOUR_TOKEN>/getWebhookInfo"1213# Remove webhook (to switch back to polling):14curl -X POST "https://api.telegram.org/bot<YOUR_TOKEN>/deleteWebhook"1516# Update ~/.openclaw/config.yaml for webhook mode:17# integrations:18# telegram:19# bot_token: "YOUR_TOKEN"20# update_method: webhook21# webhook_path: /telegram/webhook22# webhook_secret: optional-secret-for-verificationPro tip: Telegram requires a valid TLS certificate for webhooks — it does not accept self-signed certificates or plain HTTP. If you do not have a public HTTPS server, stick with polling. Cloudflare Tunnel provides a free public HTTPS URL for locally running services.
Expected result: If using webhooks: Telegram confirms the webhook is registered and begins delivering updates to your endpoint in real time. If staying with polling: OpenClaw continues fetching updates at the configured interval.
Common use cases
Personal Notification Bot
Use OpenClaw to send yourself Telegram notifications when important events occur — a build completes, a monitored price changes, a task is finished, or a scheduled report is ready. Because Telegram bots can message their own creator directly, this requires no group chat setup.
Configure OpenClaw to send me a Telegram message at 8 AM every weekday with a summary of my scheduled tasks and any pending items from yesterday
Copy this prompt to try it in OpenClaw
AI-Powered Group Assistant
Add your OpenClaw-backed bot to a Telegram group. When group members mention the bot or use a command prefix, OpenClaw receives the message, generates a helpful AI response, and replies in the group. Useful for team bots, support groups, and community assistants.
Set up OpenClaw to respond to @openclaw mentions in Telegram group ID -1001234567890 with AI-generated answers using a professional, concise tone
Copy this prompt to try it in OpenClaw
Channel Auto-Posting Workflow
Post automated content to a Telegram channel where your bot is an administrator. Schedule posts, repost content from other sources, or trigger channel posts based on external events — all routed through OpenClaw's workflow engine to the Telegram Bot API.
Build an OpenClaw workflow that posts a daily curated summary to Telegram channel @mychannel every day at 6 PM, pulling content from my specified RSS feeds
Copy this prompt to try it in OpenClaw
Troubleshooting
getUpdates returns empty result array — no messages appearing
Cause: The bot has not been started by the user (for private chats, users must send /start first), or the bot has been blocked, or polling is competing with a previously registered webhook.
Solution: Send /start to your bot from your personal Telegram account to initialize the chat. Check if a webhook is registered with getWebhookInfo — if a webhook URL exists, call deleteWebhook before polling will work again.
1# Check for existing webhook:2curl "https://api.telegram.org/bot<YOUR_TOKEN>/getWebhookInfo"34# Remove webhook to enable polling:5curl -X POST "https://api.telegram.org/bot<YOUR_TOKEN>/deleteWebhook"Bot token invalid — API returns {"ok": false, "error_code": 401}
Cause: The TELEGRAM_BOT_TOKEN in OpenClaw config does not match the token issued by BotFather, or the token has been revoked via /revoke in BotFather.
Solution: Open Telegram, message @BotFather, send /mybots, select your bot, and check 'API Token'. If revoked, use /revoke to generate a new token. Update `bot_token` in `~/.openclaw/config.yaml` with the new token and run `clawhub reload`.
1# Always include 'bot' prefix when making API calls:2# Correct: https://api.telegram.org/botYOUR_TOKEN/getMe3# Wrong: https://api.telegram.org/YOUR_TOKEN/getMeBot does not receive messages in group chats
Cause: Privacy mode is enabled for the bot (default). In this mode, bots only receive messages that mention them or start with a slash command — they do not see regular group messages.
Solution: In Telegram, message @BotFather, send /mybots, select your bot, choose 'Bot Settings' > 'Group Privacy', and set it to DISABLED. Changes take effect immediately without re-inviting the bot to any groups.
429 Too Many Requests when sending to multiple users
Cause: Telegram enforces a rate limit of 30 messages per second globally and 20 messages per minute to any individual group. Bulk broadcasts that exceed these limits are rate limited.
Solution: Stagger sends with a minimum 50ms delay between each sendMessage call. For group messages, keep the rate below 1 message per 3 seconds. Handle 429 responses by reading the `retry_after` value and waiting accordingly before retrying.
1# 429 response format from Telegram:2# {"ok": false, "error_code": 429, "description": "Too Many Requests: retry after 30", "parameters": {"retry_after": 30}}Best practices
- Enable BotFather's group privacy DISABLED setting only if your bot genuinely needs to read all group messages — leave it enabled (default) for bots that only respond to commands, as it reduces unnecessary processing and is better practice.
- Store TELEGRAM_BOT_TOKEN as an environment variable referenced in config as `${TELEGRAM_BOT_TOKEN}` rather than pasting the token directly into `~/.openclaw/config.yaml` to prevent accidental credential exposure in logs or version control.
- Use long-polling (timeout: 30) rather than frequent short-interval polling — it is more efficient, reduces API calls by up to 30x, and still delivers near-real-time updates for most use cases.
- Register your bot's command list with BotFather using /setcommands — this enables autocomplete in the Telegram UI and makes your bot much easier to use, especially in groups where users may not know what commands are available.
- Always respond to incoming commands promptly. Telegram's users expect bots to reply quickly. If your AI processing takes more than 2-3 seconds, send an interim acknowledgment message ('Processing your request...') first, then edit it with the result.
- Use reply_to_message_id in group chat responses to thread replies visually under the triggering message — this keeps group conversations organized when multiple users are interacting with the bot simultaneously.
- Test all workflow logic with your personal chat ID before adding the bot to public groups — fix response quality, formatting, and edge cases privately before exposing them to a wider audience.
- Keep bot tokens rotated periodically and immediately revoke any token that may have been exposed — use BotFather's /revoke command which generates a new token without affecting existing group memberships.
Alternatives
Discord has a richer community platform (servers, channels, roles) but requires more setup — use it if your audience is already in a Discord server rather than Telegram.
BlueBubbles bridges Apple iMessage and requires a permanently running Mac — use it only if iMessage coverage is specifically required over Telegram's broader cross-platform reach.
WhatsApp Business API reaches WhatsApp's larger general consumer base but requires business verification — better for customer-facing communication where your audience uses WhatsApp.
Gmail provides email-based communication that reaches virtually everyone but is asynchronous — choose it for less time-sensitive notifications and async workflows rather than real-time chat.
Frequently asked questions
How do I set up Telegram integration in OpenClaw?
Message @BotFather on Telegram, send /newbot, and follow the prompts to create a bot and receive your TELEGRAM_BOT_TOKEN. Add the token under `integrations.telegram.bot_token` in `~/.openclaw/config.yaml`, set `update_method: polling`, and run `clawhub reload`. Send a message to your bot on Telegram and check OpenClaw's logs to confirm updates are being received.
Where do I get my Telegram bot token for OpenClaw?
Your TELEGRAM_BOT_TOKEN comes from @BotFather — Telegram's official bot management service. Message BotFather on Telegram, send /newbot to create a new bot, and BotFather will reply with the token after you choose a name and username. To retrieve an existing token, send /mybots to BotFather and select your bot.
What is the difference between Telegram polling and webhook in OpenClaw?
Polling (getUpdates) means OpenClaw repeatedly asks Telegram for new messages — it works anywhere without a public URL and is the easiest setup. Webhooks mean Telegram pushes updates to your server the instant they arrive — faster for high-volume bots but requires a public HTTPS URL. For most personal and small-team setups, polling with a 30-second timeout is more than sufficient.
Why is my OpenClaw Telegram bot not receiving group messages?
Telegram bots have privacy mode enabled by default, which means they only see messages that mention them or start with a command. To receive all group messages, message @BotFather, select your bot, go to Bot Settings > Group Privacy, and set it to DISABLED. This takes effect immediately without needing to re-add the bot to any groups.
Can OpenClaw send messages to Telegram channels, not just chats?
Yes — add your bot as an Administrator to the Telegram channel (channel Settings > Administrators > Add Admin > search your bot username). Once the bot is a channel admin, use the channel's chat ID (or @channelname as a string) as the chat_id in sendMessage calls. The bot must have 'Post Messages' permission in the channel's admin settings.
Is there support available for complex OpenClaw Telegram workflows?
RapidDev's team provides hands-on help for OpenClaw integrations including Telegram bots with multi-step command handling, AI-powered response pipelines, and scheduled notification workflows. If you are stuck on setup, webhook configuration, or automation logic, reach out for direct support.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation