In OpenClaw, why does linking WhatsApp need a QR scan from a phone while Telegram needs only a bot token?
answer
- a person's account versus a bot account
- WhatsApp Web as a linked device
- channels login shows the QR
- BotFather token into channels add
- session files under credentials/whatsapp
basics
~20 sOpenClaw reaches WhatsApp through WhatsApp Web as a linked device of a real phone account, so channels login shows a QR the phone must scan; Telegram has a native bot API, so a BotFather token in config is enough.
solid answer
~40 sWhatsApp has no bot token for a personal assistant: OpenClaw drives **WhatsApp Web** (Baileys) as a **linked device** of an existing phone account, so `openclaw channels login --channel whatsapp` prints a QR you scan from the phone, and the session lands in `~/.openclaw/credentials/whatsapp/<accountId>/creds.json`. Telegram is a bot platform: you create a bot with **@BotFather**, then `openclaw channels add --channel telegram --token <bot-token>` (or `botToken`, `tokenFile`, or `TELEGRAM_BOT_TOKEN` for the default account) is the whole link; Telegram has no `channels login` step. The WhatsApp plugin installs on demand and keeps more state on disk, which is why the docs suggest Telegram first. Either way, `openclaw channels status --probe` confirms the link, and the first DM still meets the pairing policy, which is separate from the QR.
code
bash · 8 lines# Telegram: the token is the link
openclaw channels add --channel telegram --token <bot-token>
# WhatsApp: link as a device of the phone account (scan the QR)
openclaw channels login --channel whatsapp
# Confirm both accounts with live checks
openclaw channels status --probego deeper
Recall the two link mechanisms: a QR scan from the phone for WhatsApp with openclaw channels login, and a BotFather token for Telegram with openclaw channels add.
Explain why the mechanisms differ: WhatsApp Web makes OpenClaw a linked device of a person's account, while Telegram issues bot credentials. Know the token precedence and where the WhatsApp session file lives.
Show you know where each link breaks in operation: an expired QR on a headless host, a revoked linked device, a regenerated token returning 401, and why the credentials folder is as sensitive as a password.
Frame channel choice as a cost decision: token channels are cheap and isolated, device-linked channels carry phone-number identity, on-disk sessions and more failure modes, which matters when choosing what a team supports.
## Two kinds of account behind the same Gateway OpenClaw's **Gateway** is the long-running process that holds every chat connection and hands messages to the agent. Each messaging app is a **channel**, and each channel has one or more **accounts**. What it costs to link an account depends on what the platform offers an outside program: - **A bot platform** issues a credential to a program that is not a person. Telegram, Slack and Discord work this way, so linking means pasting a token. - **A person's account** has no bot credential. WhatsApp (for this use), Signal and iMessage work this way, so OpenClaw has to act as one more device or client of a real account. That single difference explains why an operator adding WhatsApp and Telegram on the same evening finds that one needs a phone in hand and the other needs a copy-paste. ## WhatsApp: a linked device of a phone account OpenClaw talks to WhatsApp through **WhatsApp Web** using the Baileys library; there is no separate Twilio WhatsApp channel. The Gateway owns the socket and its reconnect loop. - **Plugin on demand.** The WhatsApp runtime ships outside the core package as `@openclaw/whatsapp`. `openclaw onboard`, `openclaw channels add --channel whatsapp` and `openclaw channels login --channel whatsapp` offer to install it the first time. - **QR-only login.** `openclaw channels login --channel whatsapp` (add `--account work` for a named account) shows a QR. You scan it from **WhatsApp > Linked devices** on the phone, exactly as you would link a desktop client. - **Headless hosts.** On a VPS you need a reliable way to get the live QR to the phone; screenshots or chat attachments can expire in transit. Run `channels login` in a terminal on the Gateway host; an agent's `exec` tool blocks this interactive flow, and the `whatsapp_login` agent tool exists for logging in from chat. - **State on disk.** The linked session is saved as `~/.openclaw/credentials/whatsapp/<accountId>/creds.json` with a `creds.json.bak` backup. That file is the device; whoever holds it can act as the linked device. - **Live listener.** Outbound sends need an active listener for the account and fail fast without one. ## Telegram: a bot token Telegram ships as a bundled plugin, so there is no install step. 1. Chat with **@BotFather** (or open its web app), run `/newbot`, and copy the token. 2. Run `openclaw channels add --channel telegram --token <bot-token>`, or set `channels.telegram.botToken` in `~/.openclaw/openclaw.json`. 3. With the default hot reload the running Gateway picks the change up; otherwise start it with `openclaw gateway`. 4. Check with `openclaw channels status --probe`. Token resolution is account-aware: `tokenFile` beats `botToken`, `botToken` beats the environment, and `TELEGRAM_BOT_TOKEN` only resolves for the **default** account. Telegram does **not** use `openclaw channels login`; running it for Telegram is rejected as an unsupported action. Long polling is the default transport, with webhook mode optional. A wrong token shows up as `getMe returned 401` at startup. ## The other channels in one line each | Channel | What linking costs | Where it usually breaks | |---|---|---| | WhatsApp | QR scan from the phone, plugin install, session files on disk | The phone removes the linked device; QR expires on a headless host | | Telegram | BotFather token | Wrong or regenerated token (`getMe returned 401`) | | Slack | A Slack app: `appToken` with `connections:write` plus `botToken` in Socket Mode, or `botToken` plus `signingSecret` and a public URL in HTTP mode | Missing scopes or events in the app manifest | | Discord | A bot in the Developer Portal, its token in `channels.discord.token`, Message Content Intent enabled | Message Content Intent not enabled for normal guild messages | | Signal | `signal-cli` linked or registered to a number | Linking a personal number, so the bot ignores its owner's own messages | | iMessage | `imsg` on a signed-in Mac with Full Disk Access and Automation | macOS permissions granted to the wrong process | ## What the link does not decide Linking proves OpenClaw can reach the account; it does not decide who may talk to the agent. The first DM from an unknown sender meets the channel's DM policy, which defaults to **pairing**, and approval runs through `openclaw pairing approve`. That approval is a different step from the WhatsApp QR, even though both feel like pairing. Who may message the bot, and how groups are gated, belong with the access-control material. ## Practical takeaways - Start with Telegram when you just want to see the assistant answer; it has the fewest moving parts. - Treat the WhatsApp credentials folder like a password: it is a live login to a phone account. - Verify every new account with `openclaw channels status --probe` rather than by sending a test message and guessing.
- Can TELEGRAM_BOT_TOKEN in the Gateway's environment supply the token for a second, named Telegram account?No. The environment fallback only resolves for the default account. Named accounts need `channels.telegram.accounts.<id>.botToken` or `tokenFile`. Resolution order is `tokenFile`, then `botToken`, then the environment, so config always wins over `TELEGRAM_BOT_TOKEN`.
- What should you plan for when linking WhatsApp on a headless server?Login is QR-only, so you need a dependable path for the live QR to reach the phone; screenshots and chat attachments can expire before you scan. Run `openclaw channels login --channel whatsapp` in a terminal on the Gateway host, because an agent's `exec` tool blocks the interactive flow; from chat, the `whatsapp_login` tool is the supported route.
Telegram hands you a staff badge made for a robot; WhatsApp only lets you in as a second screen of someone's phone, so the phone has to be there to approve it.
- WhatsApp is linked with a bot token, just like a Telegram bot.
- Running openclaw channels login for Telegram is how the bot gets connected.
- Scanning the WhatsApp QR also approves who may message the assistant.
- TELEGRAM_BOT_TOKEN in the environment overrides the token written in openclaw.json.
- The WhatsApp session is stored inside openclaw.json with the channel settings.