Features
- Webhook mode (recommended): Instant message delivery via tunnel
- Polling mode: No tunnel required, ~30s delay
- DM pairing: Approve unknown users before they can message the agent
- Group mentions:
@YourBotor/commandto trigger in groups
Prerequisites
- IronClaw installed and configured (
ironclaw onboard) - A Telegram bot token from @BotFather
Step 1: Create a Telegram Bot
- Open Telegram and message @BotFather
- Send
/newbotand follow the prompts - Choose a name (e.g., “My IronClaw Bot”)
- Choose a username (e.g., “my_ironclaw_bot”)
- Copy the bot token (format:
123456789:ABCdefGHIjklMNOpqrsTUVwxyz)
Step 2: Configure via Setup Wizard
- Enable Telegram channel: Select “Yes”
- Enter bot token: Paste the token from BotFather
- Webhook secret: Press Enter to auto-generate (or provide your own)
- Tunnel URL (optional): If you want webhook mode, configure a tunnel
Step 3: Choose Delivery Mode
Webhook Mode (Recommended)
Instant message delivery. Requires exposing your agent via a tunnel. Set up tunnel:Polling Mode
No tunnel required. The agent checks for new messages every ~30 seconds. To use polling: Don’t configure aTUNNEL_URL. IronClaw falls back to polling automatically.
Step 4: Test the Bot
- Open Telegram and search for your bot by username
- Send a message: “Hello!”
- Check IronClaw logs for the message
- The agent should respond
DM Pairing
By default, unknown users must be approved before they can message the agent.How It Works
- Unknown user sends a message to your bot
- Bot replies:
To pair with this bot, run: ironclaw pairing approve telegram ABC12345 - You approve:
ironclaw pairing approve telegram ABC12345 - User is added to the allow list; future messages are delivered
Pairing Commands
Pairing Policies
Edit~/.ironclaw/channels/telegram.capabilities.json (or configure in the database):
| Option | Values | Default | Description |
|---|---|---|---|
dm_policy | open, allowlist, pairing | pairing | open = allow all; allowlist = config + approved only; pairing = send pairing reply to unknown |
allow_from | ["user_id", "username", "*"] | [] | Pre-approved IDs/usernames. * allows everyone. |
owner_id | Telegram user ID | null | When set, only this user can message (overrides dm_policy) |
bot_username | Bot username (no @) | null | For mention detection in groups |
respond_to_all_group_messages | true/false | false | When true, respond to all group messages; when false, only @mentions and /commands |
Policy Examples
Open to everyone:Group Chat
Add your bot to a group and mention it to interact:- Set
bot_usernamein config to enable mention detection - Set
respond_to_all_group_messages: trueto respond to all messages (not just mentions)
Manual Installation
If the channel isn’t bundled or you want to build from source:Secrets
The channel expects these secrets:- telegram_bot_token: Required. Your bot token from BotFather.
- telegram_webhook_secret: Optional. Used to validate webhook requests.
- Setup wizard:
ironclaw onboard - Environment:
export TELEGRAM_BOT_TOKEN=your_token - Database: Stored encrypted if using the wizard
Webhook Secret
For webhook validation, Telegram sendsX-Telegram-Bot-Api-Secret-Token with each request. IronClaw validates it before forwarding to the channel.
To set a custom secret:
Troubleshooting
Messages Not Delivered
Polling mode:- Check logs for
getUpdateserrors - Verify bot token:
curl https://api.telegram.org/bot<TOKEN>/getMe - Ensure IronClaw is running
- Verify tunnel is running and accessible
- Check
TUNNEL_URLis correct and includeshttps:// - Test webhook:
curl https://api.telegram.org/bot<TOKEN>/getWebhookInfo - Telegram requires HTTPS (no self-signed certs)
Pairing Code Not Received
- Verify
dm_policyispairing(notallowlist) - Check the channel can send messages (logs should show “Sent pairing message”)
- Ensure HTTP allowlist includes
api.telegram.orgin capabilities
Group Mentions Not Working
- Set
bot_usernamein config to your bot’s username (no@) - Ensure the message contains
@YourBotor starts with/ - Verify the bot is a member of the group
”Connection Refused” on Startup
Webhook mode: Start your tunnel beforeironclaw run
Polling mode: No tunnel needed; ignore tunnel-related warnings
Bot Token Invalid
Error: “Invalid bot token”- Verify the token format:
123456789:ABCdefGHIjklMNOpqrsTUVwxyz - Check for extra spaces or newlines
- Get a new token: Message @BotFather and send
/token
Advanced Configuration
Custom Polling Interval
Edittelegram.capabilities.json:
Rate Limits
Edittelegram.capabilities.json:
Multiple Bots
Run multiple IronClaw instances with different bot tokens:Security Considerations
- Keep bot token secret: Never commit to git or share publicly
- Use webhook secret: Prevents unauthorized webhook requests
- Enable DM pairing: Prevents spam and unauthorized access
- Set owner_id: For maximum security, restrict to a single user
- Monitor logs: Watch for suspicious activity
Next Steps
- Learn about building channels to create your own
- Explore building WASM tools for custom capabilities
- Set up MCP servers for external integrations
