Quick Start
The fastest way to set up Telegram is with the interactive onboarding:Creating a Telegram Bot
Chat with @BotFather
Open Telegram and search for @BotFather. This is Telegram’s official bot for creating and managing bots.
Create a new bot
Send
/newbot to @BotFather and follow the prompts:- Choose a display name (e.g., “OpenClaw Bot”)
- Choose a username (must end in
bot, e.g.,openclawbotormy_openclaw_bot)
Copy your bot token
@BotFather will give you a token that looks like:Save this token securely. You’ll need it for configuration.
Configuration
Using Environment Variables
The simplest way to configure Telegram:Using Config File
Alternatively, store the token directly inopenclaw.config.json:
| Key | Type | Default | Description |
|---|---|---|---|
enabled | boolean | false | Enable Telegram channel |
botToken | string | - | Bot token from @BotFather (or use TELEGRAM_BOT_TOKEN env var) |
dmPolicy | string | "pairing" | DM access policy: pairing, allowlist, open, disabled |
allowFrom | string[] | [] | Telegram user IDs allowed to message (e.g., ["123456789"]) |
groupPolicy | string | "allowlist" | Group access policy: allowlist, open, disabled |
DM Policies
pairing(recommended): Unknown users get a pairing code; approve withopenclaw pairing approve telegram <userId>allowlist: Only user IDs inallowFromcan DM the botopen: Anyone can DM the bot (setallowFrom: ["*"])disabled: Ignore all Telegram DMs
Getting Your Telegram User ID
To allowlist yourself, you need your Telegram user ID (a numeric ID, not your username). Method 1: Check logs (safest)- DM your bot on Telegram
- Run
openclaw logs --follow - Look for a line like:
"from":{"id":123456789} in the JSON response.
Resolving Usernames to IDs
OpenClaw can resolve@username to a user ID automatically:
allowFrom.
Group Configuration
To use your bot in Telegram groups:Add bot to group
- Open the group in Telegram
- Tap the group name → “Add Members”
- Search for your bot’s username and add it
Give bot permissions (optional)
Make your bot an admin if you want it to:
- Pin/unpin messages
- Delete messages
- Read all messages (even without @mentions)
Group Options
| Key | Type | Default | Description |
|---|---|---|---|
requireMention | boolean | false | Only respond when bot is @mentioned |
allowFrom | string[] | [] | User IDs allowed to use the bot in this group |
toolPolicy | string | "open" | Tool usage policy: open, allowlist, disabled |
Commands Support
Telegram supports native bot commands. Set up commands with @BotFather:Threads Support
Telegram supergroups support topics (threads). OpenClaw automatically detects and maintains thread context:Inline Buttons
Telegram supports interactive inline buttons. OpenClaw can render buttons in responses:Media Handling
Telegram supports:- Photos (up to 10MB)
- Videos (up to 50MB)
- Audio files
- Voice messages
- Documents (up to 50MB)
- Stickers
- GIFs
Multi-Account Support
You can run multiple Telegram bots:Troubleshooting
Bot not responding to messages
Bot not responding to messages
Check that:
- Bot token is correct
- Your user ID is in
allowFrom(ordmPolicyispairingoropen) - Channel is enabled and gateway is running
Bot can't see group messages
Bot can't see group messages
Telegram bots have privacy mode enabled by default, which means they only see:
- Messages that @mention the bot
- Messages that are replies to the bot
- Commands (messages starting with
/)
- Chat with @BotFather
- Send
/setprivacy - Select your bot
- Choose “Disable”
Invalid token error
Invalid token error
Double-check your bot token. It should look like:Test it manually:If this returns an error, the token is invalid. Get a new token from @BotFather with
/token.Pairing codes not working
Pairing codes not working
Ensure Approve users with:
dmPolicy is set to "pairing":Username resolution not working
Username resolution not working
Username resolution requires a valid bot token. Ensure:
- Token is configured correctly
- Bot has been started at least once
- Username is spelled correctly (including
@)
Security Considerations
- Keep your bot token secret - it gives full access to your bot
- Use environment variables instead of committing tokens to version control
- Use allowlist mode for production bots with known users
- Disable inline buttons if you don’t need them to reduce attack surface
- Rate limit is handled by Telegram (30 messages/second to different chats)
Next Steps
Pairing Guide
Learn about pairing codes and approvals
Discord Setup
Set up Discord as another channel
Configuration Reference
Full configuration options
Commands
Manage channels with the CLI

