docs/TELEGRAM_SETUP.md
This guide covers configuring the Telegram channel for IronClaw, including DM pairing for access control.
The Telegram channel lets you interact with IronClaw via Telegram DMs and groups. It supports:
@YourBot or /command to trigger in groupsironclaw onboard)/newbot and follow the prompts123456789:ABCdefGHIjklMNOpqrsTUVwxyz)ironclaw onboard
When prompted, enable the Telegram channel and paste your bot token. The wizard will:
For instant message delivery, expose your agent via a tunnel:
# ngrok
ngrok http 8080
# Cloudflare
cloudflared tunnel --url http://localhost:8080
Set the tunnel URL in settings or via TUNNEL_URL env var. Without a tunnel, the channel uses polling (~30s delay).
When an unknown user DMs your bot, they receive a pairing code. You must approve them before they can message the agent.
To pair with this bot, run: ironclaw pairing approve telegram ABC12345ironclaw pairing approve telegram ABC12345# List pending pairing requests
ironclaw pairing list telegram
# List as JSON
ironclaw pairing list telegram --json
# Approve a user by code
ironclaw pairing approve telegram ABC12345
Edit ~/.ironclaw/channels/telegram.capabilities.json (or the config injected by the host):
| Option | Values | Default | Description |
|---|---|---|---|
dm_policy | open, allowlist, pairing | pairing | open = allow all; allowlist = config + approved only; pairing = allowlist + 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 | Used for mention detection in groups; when set, only strips this mention from messages |
respond_to_all_group_messages | true/false | false | When true, respond to all group messages; when false, only @mentions and /commands |
If the channel isn't installed via the wizard:
# Build the Telegram channel (requires wasm32-wasip2 target)
rustup target add wasm32-wasip2
./channels-src/telegram/build.sh
# Install
mkdir -p ~/.ironclaw/channels
cp channels-src/telegram/telegram.wasm channels-src/telegram/telegram.capabilities.json ~/.ironclaw/channels/
The channel expects a secret named telegram_bot_token. Configure via:
TELEGRAM_BOT_TOKEN=your_tokenironclaw CLI (if available)For webhook validation, set telegram_webhook_secret in secrets. Telegram will send X-Telegram-Bot-Api-Secret-Token with each request; the host validates it before forwarding.
getUpdates errors. Ensure the bot token is valid.TUNNEL_URL is correct. Telegram requires HTTPS.api.telegram.org)dm_policy is pairing (not allowlist which blocks without reply)bot_username in config to your bot's username (e.g., MyIronClawBot)@YourBot or starts with /ironclaw run