Telegram Configuration
Telegram (Bot API)
Section titled “Telegram (Bot API)”Status: Production-Ready (Bot API via grammY).
OpenClaw integrates seamlessly with Telegram bots, allowing you to interact with your agent via DMs or add it to group chats.
Quick Setup
Section titled “Quick Setup”Create a Bot
- Open Telegram and search for @BotFather.
- Send
/newbotand follow the prompts. - Copy the HTTP API Token provided (e.g.,
123456789:ABCdefGHIjklMNOpqrstUVwxyz).
Configure OpenClaw Add the token to
~/.openclaw/openclaw.json:{channels: {telegram: {enabled: true,botToken: "YOUR_BOT_TOKEN_HERE",dmPolicy: "pairing" // Requires pairing code on first contact}}}Start the Gateway
Terminal window openclaw gateway runPairing
- Send a message to your new bot on Telegram (e.g., “Hello”).
- The bot will reply asking for a pairing code.
- Check the gateway logs for the code and send it to the bot.
Configuration Options
Section titled “Configuration Options”DM Policy
Section titled “DM Policy”Control who can talk to your bot in Direct Messages.
| Policy | Description |
|---|---|
pairing (Default) | New users must enter a one-time code printed in the gateway logs. |
allowlist | Only users in allowFrom (list of user IDs) can interact. |
open | Anyone can talk to the bot (Not recommended for public bots). |
Group Chats
Section titled “Group Chats”To use the bot in groups:
Privacy Mode: By default, bots only see messages mentioning them or replies.
- To see all messages: Talk to @BotFather, use
/setprivacy->Disable. - Note: OpenClaw usually works best when it can see context.
- To see all messages: Talk to @BotFather, use
Group Config:
{channels: {telegram: {// ...groups: {"*": { requireMention: true } // Only reply when @mentioned}}}}
Admin Permissions
Section titled “Admin Permissions”You can designate certain Telegram users as Admins. Admins can:
- Run sensitive tools (if configured).
- Bypass certain policy checks.
{ channels: { telegram: { adminUsers: [123456789] // Your numeric Telegram User ID } }}