OpenClaw Telegram Channel
Connect OpenClaw to Telegram using the grammY Bot API framework. Create a Telegram bot via @BotFather, grab the token, and your AI assistant is live on Telegram in minutes. Supports long-polling by default with optional webhook mode. One of the easiest channels to set up, with rich features including inline buttons, stickers, reactions, and group chat support.
Telegram Supported Features
Text Messages
Supported
Media & Files
Supported
Reactions
Supported
Threads
Supported
Voice Messages
Supported
Group Chat
Supported
Telegram Prerequisites
- A Telegram account
- A Bot Token from @BotFather (send /newbot to @BotFather)
- OpenClaw Gateway running and configured
- Node.js 18+ installed on your server
Telegram Quick Setup
Create a bot with @BotFather
Open Telegram, search for @BotFather, and send /newbot. Follow the prompts to name your bot and get the API token. Save this token — you'll need it for the config.
Add Telegram channel config
Add the Telegram channel configuration to ~/.openclaw/openclaw.json. Paste the bot token from @BotFather into the botToken field. Set the dmPolicy (pairing, allowlist, or open) to control who can message your assistant.
Start Gateway and test
Launch the Gateway process. Search for your bot on Telegram and send it a message. If using the default pairing policy, approve the sender via 'openclaw pairing approve telegram <code>'. OpenClaw should respond through the AI assistant.
Telegram Configuration Example
{
"channels": {
"telegram": {
"enabled": true,
"botToken": "YOUR_BOT_TOKEN_FROM_BOTFATHER",
"dmPolicy": "pairing"
}
}
}
Telegram Deep Dive
Architecture Overview
Creating Your Bot with @BotFather
DM Policies
{
"channels": {
"telegram": {
"dmPolicy": "pairing",
"allowFrom": [123456789, 987654321]
}
}
}
Group Chat Management
{
"channels": {
"telegram": {
"groupPolicy": "open",
"requireMention": false,
"groups": ["-1001234567890"]
}
}
}
Message Formatting & Streaming
{
"channels": {
"telegram": {
"streamMode": "partial",
"chunkMode": "newline"
}
}
}
Inline Buttons
{
"channels": {
"telegram": {
"capabilities": {
"inlineButtons": "all"
}
}
}
}
Stickers & Media
Reactions
{
"channels": {
"telegram": {
"reactionNotifications": "own",
"reactionLevel": "ack"
}
}
}
Commands & Tools
Webhook Mode
{
"channels": {
"telegram": {
"webhookUrl": "https://your-domain.com/telegram/webhook",
"webhookSecret": "your-random-secret-string"
}
}
}
Telegram Configuration Reference
| Key | Type | Default | Description |
|---|---|---|---|
| enabled | boolean | true | Enable or disable the Telegram channel |
| botToken | string | "" | Telegram Bot API token from @BotFather. Can also use TELEGRAM_BOT_TOKEN env var |
| dmPolicy | string | "pairing" | Controls who can DM the bot. Options: pairing, allowlist, open, disabled |
| allowFrom | number[] | [] | Numeric Telegram user IDs allowed to message the bot (when dmPolicy is allowlist) |
| groupPolicy | string | "allowlist" | Group chat policy. Options: disabled, open, allowlist |
| groups | string[] | [] | List of allowed group chat IDs. If empty and groupPolicy is not disabled, all groups are allowed |
| requireMention | boolean | true | Whether the bot requires @mention to respond in groups |
| streamMode | string | "partial" | Streaming mode for AI responses. Options: partial (progressive updates), block (chunked), off (disabled) |
| chunkMode | string | "split" | How to handle long responses. Options: split (hard character limit), newline (respect paragraphs) |
| webhookUrl | string | "" | HTTPS URL for webhook mode. If set, switches from polling to webhook |
| webhookSecret | string | "" | Secret token for webhook verification |
| reactionNotifications | string | "off" | Which reactions trigger notifications. Options: off, own, all |
| reactionLevel | string | "ack" | Bot reaction capability. Options: off, ack, minimal, extensive |
| capabilities.inlineButtons | string | "off" | Inline button mode. Options: off, dm, group, all, allowlist |
| configWrites | boolean | true | Auto-migrate chat IDs during supergroup upgrades. Set to false to disable |
| mediaCap | number | 5 | Maximum media file size in MB for uploads and downloads |
| historyLimit | number | 50 | Maximum number of history messages to retain per user/group conversation |
| retryPolicy | object | { "maxRetries": 3, "backoff": "exponential" } | Retry policy with exponential backoff for failed API calls |
| proxyUrl | string | "" | Proxy URL for Telegram API calls. Useful for restricted network environments |
| forceIPv4 | boolean | false | Force IPv4 resolution for api.telegram.org. Enable if IPv6 egress causes silent failures |
Enable or disable the Telegram channel
Telegram Bot API token from @BotFather. Can also use TELEGRAM_BOT_TOKEN env var
Controls who can DM the bot. Options: pairing, allowlist, open, disabled
Numeric Telegram user IDs allowed to message the bot (when dmPolicy is allowlist)
Group chat policy. Options: disabled, open, allowlist
List of allowed group chat IDs. If empty and groupPolicy is not disabled, all groups are allowed
Whether the bot requires @mention to respond in groups
Streaming mode for AI responses. Options: partial (progressive updates), block (chunked), off (disabled)
How to handle long responses. Options: split (hard character limit), newline (respect paragraphs)
HTTPS URL for webhook mode. If set, switches from polling to webhook
Secret token for webhook verification
Which reactions trigger notifications. Options: off, own, all
Bot reaction capability. Options: off, ack, minimal, extensive
Inline button mode. Options: off, dm, group, all, allowlist
Auto-migrate chat IDs during supergroup upgrades. Set to false to disable
Maximum media file size in MB for uploads and downloads
Maximum number of history messages to retain per user/group conversation
Retry policy with exponential backoff for failed API calls
Proxy URL for Telegram API calls. Useful for restricted network environments
Force IPv4 resolution for api.telegram.org. Enable if IPv6 egress causes silent failures
Telegram Frequently Asked Questions
Telegram Troubleshooting
Privacy mode is enabled by default in Telegram bots. When active, the bot only receives messages that @mention it or start with a slash command.
The bot token may be incorrect, the Gateway may not be running, or there's a network connectivity issue.
The webhook URL is not publicly accessible, SSL certificate is invalid, or the webhook was not registered properly.
Telegram has a 4,000-character message limit. Long AI responses are automatically chunked.