Quick setup
1
Create the bot token in BotFather
Both flows end with a token you paste into OpenClaw — pick one:
- Chat flow: open Telegram and chat with @BotFather. Confirm the handle is exactly
@BotFather. Run/newbot, follow the prompts, and save the token. - Web flow: open BotFather’s web app. It runs in every Telegram client, including web.telegram.org. Create the bot in the UI, then copy its token.
2
Configure token and DM policy
The fastest option is the CLI. It writes the token into your config for you:To edit config by hand instead, put this in Env fallback:
~/.openclaw/openclaw.json:TELEGRAM_BOT_TOKEN (default account only). Named accounts must use botToken or tokenFile.
Telegram does not use openclaw channels login telegram. Set the token in config or env, then start the gateway.3
Restart the gateway
A new channel is only picked up after the Gateway loads the new config:Use
openclaw gateway instead when no Gateway service is installed. That
command runs the Gateway in the foreground of this terminal.4
Approve your first DM
Open Telegram and send any message to your bot. That message creates the
pairing request the next command lists:Pairing codes expire after 1 hour.
5
Add the bot to a group
Add the bot to your group, then get the two IDs group access needs:
- your Telegram user ID, for
allowFrom/groupAllowFrom - the Telegram group chat ID, as the key under
channels.telegram.groups
openclaw logs --follow, a forwarded-ID bot, or Bot API getUpdates. After the group is allowed, /whoami@<bot_username> confirms the user and group IDs.Negative supergroup IDs starting with -100 are group chat IDs. They go under channels.telegram.groups, not groupAllowFrom.Token resolution is account-aware.
tokenFile beats botToken, and botToken beats env. Config always wins over TELEGRAM_BOT_TOKEN, which only resolves for the default account. After a successful startup, OpenClaw caches the bot identity for up to 24 hours, so restarts skip an extra getMe call. Changing or removing the token clears that cache.Telegram side settings
Privacy mode and group visibility
Privacy mode and group visibility
Telegram bots default to Privacy Mode, which limits which group messages they receive.To see all group messages, either:
- disable privacy mode via
/setprivacy, or - make the bot a group admin.
Group permissions
Group permissions
Admin status is controlled in Telegram group settings. Admin bots receive all group messages, useful for always-on group behavior.
Helpful BotFather toggles
Helpful BotFather toggles
/setjoingroups— allow/deny group adds/setprivacy— group visibility behavior