Hermes Agent WhatsApp Setup: QR Pairing, Allowlist, Cloud API
Connect Hermes Agent to WhatsApp: pair with hermes whatsapp by QR, allowlist numbers, set group policy, protect the session folder, or use the Cloud API.
Hermes has two WhatsApp routes. The usual one is a built-in bridge that logs in as a WhatsApp Web linked device: run hermes whatsapp (or hermes gateway setup and pick WhatsApp), choose bot or self-chat mode, and scan the QR code from your phone under Settings, Linked Devices. Then put your own number, country code first and no +, in WHATSAPP_ALLOWED_USERS in ~/.hermes/.env, or the gateway answers no one, and run it as a service with hermes gateway install. The login lives in ~/.hermes/platforms/whatsapp/session and gives full access to that WhatsApp account. Nous warns the bridge “carries a small risk of account restrictions” and suggests a dedicated number. The second route is Meta’s official Business Cloud API (hermes whatsapp-cloud), which needs a Meta Business account and a public HTTPS webhook. As of Hermes v0.23.5 (November 28, 2026).
Which route: the bridge or the Cloud API
| WhatsApp Web bridge | Business Cloud API | |
|---|---|---|
Command | hermes whatsapp | hermes whatsapp-cloud |
Signs in as | A linked device on an ordinary WhatsApp number | A business number in a Meta app |
Meta account | None needed | Meta Business account and an app with WhatsApp enabled |
Inbound network | Nothing; the bridge listens on loopback only | A public HTTPS URL for Meta’s webhook |
Groups | Yes, by policy | No; direct messages only for now |
Messaging first | Possible, but Nous advises against it | Free-form only within 24 hours of the user’s last message; Hermes does not send templates yet |
Account risk | “a small risk of account restrictions” | The official route |
For a personal agent you talk to from your phone, the bridge is what Nous’s WhatsApp page walks through, and most of this guide is about it. The two can run at once on different numbers. The Cloud API is covered at the end.
Bot number or self-chat
The wizard asks which mode you want first:
- Bot (Nous’s recommendation): “Dedicate a phone number to the bot. People message that number directly.” It must be a number not already registered with WhatsApp. Nous lists Google Voice (free, US only), a prepaid SIM (which has to be used every 90 days to stay active) and VoIP numbers such as TextNow or TextFree, some of which WhatsApp blocks.
- Self-chat: “Use your own WhatsApp. You message yourself to talk to the agent.” No second number, but the session Hermes holds is then a login to your personal account.
That second point is the reason to think before choosing. Whichever account you pair is the account the session folder can read and send from, and if WhatsApp restricts it, it is that account that loses out.
Pair it
The bridge needs Node.js 20 or later and npm on the machine running Hermes; the wizard installs the rest. Then:
hermes whatsappCopied- Choose bot or self-chat.
- On the phone that holds the number, open WhatsApp, go to Settings, then Linked Devices, and tap Link a Device.
- Point the camera at the QR code in the terminal. The wizard confirms and exits, and the session is saved.
hermes gateway setup offers the same walk-through when you pick WhatsApp. If the code will not scan, the terminal is usually too narrow: Nous asks for at least 60 columns and Unicode support. Codes refresh about every 20 seconds; if the wizard times out, run hermes whatsapp again.
On a server with no screen
The QR code is drawn as text in the terminal you ran the command in, so pairing a server is the same as pairing a laptop: run hermes whatsapp in your SSH window, widen it, and scan from the phone. The exception is an account that WhatsApp asks to confirm with a passkey. That path opens WhatsApp Web in a real browser (Chrome or Edge) and is, in Nous’s words, “not available through dashboard onboarding or a headless SSH session”, so it has to be done on a machine with a desktop:
hermes whatsapp --passkey-browser "/absolute/path/to/browser"CopiedWho may message it
With nothing set, Hermes “denies all incoming messages as a safety measure.” That is the right starting point, because whoever is let in is driving an agent with a terminal on your machine. Add the allowed numbers to ~/.hermes/.env in an editor:
WHATSAPP_ENABLED=true
WHATSAPP_MODE=bot
WHATSAPP_ALLOWED_USERS=15551234567CopiedNumbers carry the country code with no +, separated by commas. If a number is not being matched, send /whoami from that phone and Hermes replies with the exact ID to list. WHATSAPP_ALLOWED_USERS=* or WHATSAPP_ALLOW_ALL_USERS=true opens the agent to anyone who has the number; Nous’s messaging page calls allowing everyone “NOT recommended for bots with terminal access.” The file holds every key Hermes uses, so keep it to your user:
chmod 600 ~/.hermes/.envCopiedA stranger who messages the number gets a pairing code by default, which you can approve from the server; codes “expire after 1 hour, are rate-limited, and use cryptographic randomness.” To review and approve them:
hermes pairing listCopiedthen hermes pairing approve with the platform and code it shows. If you would rather strangers hear nothing at all, set this in ~/.hermes/config.yaml:
whatsapp:
unauthorized_dm_behavior: ignoreCopiedGroups
Groups are governed separately from the DM allowlist, by WHATSAPP_GROUP_POLICY:
| Policy | What happens |
|---|---|
pairing (default) | Nothing from any group reaches the agent |
allowlist | Only the groups in WHATSAPP_GROUP_ALLOWED_USERS, given as group JIDs such as 120363001234567890@g.us |
open | Every group the number is a member of |
An admitted group hands the agent to everyone in it, so the same test applies as for the allowlist: only a group of people you would give your terminal to. Without WHATSAPP_REQUIRE_MENTION=true, Hermes answers every message in an admitted group; with it, only @mentions, replies to the bot and /commands. The docs give the JID format but no command to look one up.
The session folder is your WhatsApp login
Pairing writes ~/.hermes/platforms/whatsapp/session. Nous is direct about it: “it grants full access to the WhatsApp account.” It holds the encryption keys and device credentials of the linked device, so a copy of the folder carries that access with it. Hermes creates it owner-only (0700); keep it out of git, shared drives and backups that other people can open. Inside a container the folder’s mode is whatever the mount or the service’s umask sets, so restrict it there yourself, and mount it as a persistent volume, or every new container needs a fresh scan.
Keep it running
hermes gateway in a terminal is enough for a test; on a Linux server, install it as a user service and let it outlive your login:
hermes gateway install
sudo loginctl enable-linger $USER
hermes gateway status
journalctl --user -u hermes-gateway -fCopiedThe guide to user services and linger explains the second line, and installing Hermes on a server covers the system-service alternative. The bridge listens on loopback only (port 3000 for the main profile), so nothing has to be opened to the internet. A second Hermes profile pairs its own number with hermes -p <profile> whatsapp and gets its own bridge port. On macOS, if the service reports Node.js missing, that is launchd not inheriting your shell’s PATH; Nous’s fix is to run hermes gateway install and then hermes gateway start.
When the session drops
Short disconnections reconnect on their own. A link that is gone shows as connection errors in the gateway log, and the fix in every case is to pair again, which prints a fresh QR code:
hermes whatsappCopied- Logged out after a quiet spell. WhatsApp “unlinks devices after long inactivity”; keep the phone on and connected so the link stays alive.
- Stopped after a WhatsApp update, or reconnect loops. The protocol changed under the bridge. Update Hermes for the latest bridge (updating Hermes), then re-pair.
- Lost after a container restart. The session folder was not on a persistent volume.
- Connected but silent. The sender is not allowlisted, or the group policy is still
pairing. SetWHATSAPP_DEBUG=truein.envand restart the gateway to see raw events inbridge.log.
What WhatsApp and Nous say about unofficial clients
Nous’s page states that WhatsApp “does not officially support third-party bots outside the Business API” and that the bridge “carries a small risk of account restrictions.” Its advice: use a dedicated number, “Don’t send bulk/spam messages”, and “Don’t automate outbound messaging to people who haven’t messaged first.”
WhatsApp’s Terms of Service (the version for users outside the European Region) say:
You must not (or assist others to) directly, indirectly, through automated or other means, access, use, copy, adapt, modify, prepare derivative works based upon, distribute, license, sublicense, transfer, display, perform, or otherwise exploit our Services in impermissible or unauthorized manners, or in ways that burden, impair, or harm us, our Services, systems, our users, or others, …Copiedand they list among impermissible communications “bulk messaging, auto-messaging, auto-dialing, and the like.” Its help page About unofficial WhatsApp apps describes them as versions “developed by third-parties without WhatsApp’s approval” and says:
Your WhatsApp account might also be temporarily or permanently banned, or it could lead to restrictions on your account, including the ability to link devices.CopiedHow those words apply to a bridge that links as a device is for you to judge; the dedicated number is what keeps your own account out of it either way.
The official route: Business Cloud API
Nous’s Cloud API page covers Meta’s supported path. You need a Meta Business account, a Meta app with WhatsApp enabled, its phone number ID and an access token, and a public HTTPS address Meta can deliver messages to. Nous recommends Cloudflare Tunnel (cloudflared) for that address, with ngrok or your own domain behind a reverse proxy as the alternatives.
Know this before the gateway starts it: the webhook is served at /whatsapp/webhook on port 8090, and by default it listens on all interfaces, IPv4 and IPv6, so on a machine with a public address the port is reachable from the internet unless a firewall closes it. WHATSAPP_CLOUD_WEBHOOK_HOST chooses the interface; with the tunnel on the same machine, 127.0.0.1 keeps the port off the network. And set the app secret: with WHATSAPP_CLOUD_APP_SECRET present the endpoint “accepts only signed requests”. The wizard asks for each credential:
hermes whatsapp-cloudCopiedThey land in .env as WHATSAPP_CLOUD_PHONE_NUMBER_ID, WHATSAPP_CLOUD_ACCESS_TOKEN, WHATSAPP_CLOUD_APP_SECRET and WHATSAPP_CLOUD_VERIFY_TOKEN, with the allowed numbers in WHATSAPP_CLOUD_ALLOWED_USERS (without it, “every inbound message is denied”).
Two limits as of v0.23.5: the Cloud adapter handles direct messages only, and since Meta allows free-form messages only within 24 hours of the user’s last message and Hermes does not yet send message templates, the agent cannot message someone whose last message is more than a day old. The same allowlist reasoning, and the same gateway service, apply as for Hermes on Telegram and on Discord; one gateway serves all of them. If you are moving a WhatsApp number over from OpenClaw, its side of the link is in connecting OpenClaw to WhatsApp.