Telegram
WednesdayAI connects to Telegram via the Bot API using long polling (default) or webhooks. Setup requires a bot token from BotFather — there is no QR scanning or phone-number linking. The channel runs via grammY with per-chat sequencing.Prerequisites
- A Telegram bot token from BotFather
- Node.js 24+ on the gateway host
- Outbound HTTPS access to
api.telegram.orgfrom the gateway
Quick setup
Create a bot in BotFather
Open Telegram and message
@BotFather. Run /newbot, follow the prompts, and save the bot token (format: 123456789:AABBCCxyz...).Configure the bot token and access policy
TELEGRAM_BOT_TOKEN=...To read the token from a file instead: channels.telegram.tokenFile: "/run/secrets/telegram-token".Finding Telegram user IDs
Allowlists require numeric Telegram user IDs, not usernames.@username entries in allowFrom or groupAllowFrom are not valid at runtime. If your config has them, run openclaw doctor --fix to resolve them to numeric IDs (requires a live bot token). openclaw doctor --fix can also recover allowlist entries from pairing-store files when migrating to allowlist mode.
Access control
DM policy
dmPolicy | Effect |
|---|---|
"pairing" | New senders receive a one-time pairing code; ignored until approved (default) |
"allowlist" | Only IDs in allowFrom can DM (must have at least one entry) |
"open" | Any sender allowed (requires allowFrom: ["*"]) |
"disabled" | Bot ignores all DMs |
dmPolicy: "allowlist" with empty allowFrom is a config validation error — it would silently block all DMs.
Per-account override: channels.telegram.accounts.<id>.dmPolicy and channels.telegram.accounts.<id>.allowFrom override channel-level defaults for that account. Named accounts do not inherit accounts.default.allowFrom — they inherit channels.telegram.allowFrom when account-level values are unset.
Group policy
- Group membership (
channels.telegram.groups) — if present, acts as an allowlist;"*"allows all groups. If absent withgroupPolicy: "open", all groups pass. - Sender policy (
groupPolicy+groupAllowFrom) — ifgroupAllowFromis unset, falls back toallowFrom.
Mention gating
Group messages require a mention by default. To disable per group or globally:@botusername, configured mentionPatterns, or reply-to-bot. Session-level toggle (owner-gated): /activation always or /activation mention.
BotFather settings
Privacy mode (group visibility)
Privacy mode (group visibility)
Telegram bots default to Privacy Mode — they only see messages that mention them or start with
/. If the bot must see all group messages:- BotFather:
/setprivacy→ select your bot → Disable - Or make the bot a group admin
openclaw channels status warns when Privacy Mode may be causing missed messages.Helpful BotFather commands
Helpful BotFather commands
/setjoingroups— allow or deny the bot from being added to groups/setprivacy— toggle group message visibility/setcommands— the gateway sets this automatically whencommands.nativeis enabled
Native and custom commands
a-z, 0-9, _, length 1–32.
setMyCommands failed at startup means outbound DNS/HTTPS to api.telegram.org is blocked.
Live streaming
| Mode | Behavior |
|---|---|
partial (default) | DMs: native draft streaming via sendMessageDraft. Groups: preview message + in-place edits. |
block | Legacy preview mode (full block send with edits). |
progress | Maps to partial on Telegram. |
off | No streaming; final reply only. |
sendMessageDraft) is available for all bots since Bot API 9.5 (March 2026). If it is unavailable or rejected, WednesdayAI falls back to sendMessage + editMessageText automatically.
Webhook mode
Default is long polling. To use webhooks:webhookHost:webhookPort. If your public endpoint differs, place a reverse proxy in front and point webhookUrl at the public URL.
Restart the gateway for webhook changes to take effect.
Multi-account setup
default if present, otherwise the first configured account id (sorted). Per-account dmPolicy, allowFrom, groupAllowFrom, and capabilities overrides are supported. Named accounts inherit channels.telegram.allowFrom (not accounts.default.allowFrom) when unset.
Inline buttons
callback_data: <value>.
Reaction notifications
own = reactions to messages the bot sent (best-effort via sent-message cache). Reaction events still respect dmPolicy/allowFrom/groupPolicy — unauthorized senders are dropped.
Actions and config writes
editMessage and createForumTopic actions default to true but can be disabled: actions: { editMessage: false, createForumTopic: false }
Delivery settings
Network and proxy
OPENCLAW_TELEGRAM_DISABLE_AUTO_SELECT_FAMILY=1, OPENCLAW_TELEGRAM_DNS_RESULT_ORDER=ipv4first.
Disabling without removing config
systemctl --user restart openclaw-gateway.
Troubleshooting
Bot does not see group messages
Bot does not see group messages
- Check BotFather:
/setprivacy— must say Disabled (or make the bot a group admin) - Remove and re-add the bot in the group after changing privacy mode
channels.telegram.groupsmust include the group ID (or"*")requireMention: falseif you want responses without mentions
Group messages silently ignored
Group messages silently ignored
Check
channels.telegram.groups — the group must be listed or "*" used. Get the group ID from openclaw logs --follow (field chat.id). Run openclaw doctor for duplicate key issues in openclaw.json.Commands work partially or not at all
Commands work partially or not at all
Confirm the sender’s numeric ID is in
allowFrom. Command authorization applies even when groupPolicy: "open". setMyCommands failed means DNS/HTTPS to api.telegram.org is blocked.Network instability or polling drops
Network instability or polling drops
Check for IPv6 routing issues: On VPS hosts with unstable egress, route through a proxy:
dig +short api.telegram.org AAAA. If broken, force IPv4:Forum topic messages going to wrong session
Forum topic messages going to wrong session
Forum topics use session key
agent:<id>:telegram:group:<chatId>:topic:<threadId>. Check that replyToMode is set correctly and that the topic has the right per-topic overrides under groups.<chatId>.topics.<threadId>.Configuration reference
Full field index forchannels.telegram.*:
-
Auth:
enabled,botToken,tokenFile,accounts.* -
Access:
dmPolicy,allowFrom,groupPolicy,groupAllowFrom,groups,groups.*.topics.* -
Commands:
commands.native,commands.nativeSkills,customCommands -
Streaming:
streaming -
Delivery:
textChunkLimit,chunkMode,linkPreview,mediaMaxMb,timeoutSeconds,replyToMode,retry.* -
History:
historyLimit,dmHistoryLimit,dms.<id>.historyLimit -
Actions:
actions.reactions,actions.sendMessage,actions.deleteMessage,actions.sticker -
Capabilities:
capabilities.inlineButtons -
Reactions:
reactionNotifications,reactionLevel -
Network:
proxy,network.autoSelectFamily,network.dnsResultOrder -
Webhook:
webhookUrl,webhookSecret,webhookPath,webhookHost,webhookPort -
Misc:
configWrites,defaultTo - Reference: config