Skip to content
Home› Blog› OpenClaw WhatsApp Setup: QR Linking, Allowlists and Fixes

OpenClaw WhatsApp Setup: QR Linking, Allowlists and Fixes

Link OpenClaw to WhatsApp with the QR login, let only approved numbers and groups reach the agent, keep the gateway online, and fix the common failures, with a straight look at the account risk of an unofficial client.

HostAiHub Team ·Nov 14, 2026 ·14 min read
OpenClaw WhatsApp Setup: QR Linking, Allowlists and Fixes

To connect OpenClaw to WhatsApp, install the WhatsApp plugin, run openclaw channels login --channel whatsapp on the machine that runs the gateway, and scan the QR code from Linked devices in WhatsApp on your phone. The OpenClaw WhatsApp channel then behaves like WhatsApp Web: a linked device that receives the account's messages and answers through your agent. Before you hand the number to anyone, set dmPolicy and allowFrom so only people you approve reach the agent, and put it on a spare number, because this is an unofficial client.

Every command and config key below was checked against the OpenClaw docs and source for release 2026.11.3 (10 November 2026), plus WhatsApp's own help center.

Short version
  • Use a dedicated number. OpenClaw links as an unofficial WhatsApp Web client, and WhatsApp says that can lead to a ban or restriction.
  • Install with openclaw plugins install @openclaw/whatsapp, run openclaw channels login --channel whatsapp, then scan from Linked devices. The first QR code lasts about a minute.
  • Set dmPolicy: "allowlist" and put your numbers in allowFrom. The default, pairing, sends strangers a code and keeps their messages away from the agent.
  • In groups the sender must be allowed and, by default, has to @mention the bot.
  • The gateway is the linked device. When it sleeps the bot goes quiet, and on return it only answers messages up to 20 minutes old.
  • Open WhatsApp on the phone at least every 14 days. A 401 "logged out" means scan a new QR.

What you need before you connect OpenClaw to WhatsApp

  • OpenClaw that already answers. Run openclaw dashboard and send a message in the Control UI chat. A bot that never replies looks exactly like a WhatsApp problem, even when the real fault is a bad model key. Rule that out first.
  • A phone number for the agent. Ideally a spare phone with its own SIM or eSIM. The WhatsApp plugin's own setup text recommends "a separate phone + eSIM". You'll scan the QR code with this phone, and WhatsApp needs it now and then to keep the link alive.
  • Your own number in E.164 format, like +15551234567. That's the format allowFrom expects.
  • A machine that stays on. More on that below.

WhatsApp support isn't part of core OpenClaw. It ships as a separate plugin, @openclaw/whatsapp, released in step with OpenClaw (also 2026.11.3), and it's built on Baileys 7.0.0-rc14.

How the OpenClaw WhatsApp channel works

WhatsApp lets one account have a phone plus up to four linked devices, and each linked device "connects to WhatsApp independently", per WhatsApp's linked devices page. OpenClaw becomes one of those devices. The plugin uses Baileys, an open-source TypeScript library that talks the WhatsApp Web protocol over a WebSocket, with no browser involved. The OpenClaw gateway owns that socket: it keeps the connection up, checks who sent each message, and hands approved ones to the agent.

How a WhatsApp message reaches OpenClaw 1 The sender's phone you, or someone you approved end-to-end encrypted 2 WhatsApp servers relay it to every linked device Baileys WebSocket, outbound only 3 OpenClaw gateway the linked device: access check approved senders only 4 Agent session, memory, tools prompt, sent with your API key 5 Model provider Anthropic, OpenAI and others the reply goes back up the same path
The gateway only makes outgoing connections, so you need no domain, webhook or open port. If that one process stops, nothing in this chain runs.

A few consequences follow from that design:

  • The phone isn't a relay. Messages reach the gateway even while the phone is off. But WhatsApp's linking guide is blunt: "You'll need to log in to WhatsApp on your primary phone every 14 days to keep linked devices connected."
  • The phone still sees everything. Incoming messages and the agent's replies both show up there, because the agent sends as that account. OpenClaw connects with Baileys' markOnlineOnConnect turned off, which keeps notifications arriving on the phone, and with syncFullHistory off, so it doesn't pull your old chat history.
  • There's no bot account. The agent is whatever number you link. People see that number's name and photo.

Is it safe for your number?

Be clear about what this is. The OpenClaw WhatsApp channel is not WhatsApp's business API. It's a third-party client signed in as a linked device, and WhatsApp's page on unofficial apps doesn't mince words: "Using these apps or linking your WhatsApp account to unofficial versions of WhatsApp violates our Terms of Service." The same page says an account "might also be temporarily or permanently banned", or restricted, including losing the ability to link devices. Baileys' README says the project isn't affiliated with WhatsApp and asks people not to spam with it.

That doesn't make it reckless. OpenClaw's docs call the channel production-ready. WhatsApp just doesn't publish thresholds, so nobody outside Meta knows exactly where the line sits. What it does say, on its restricted accounts page, is that restrictions follow activity "showing signs of engaging in spam, automated, or bulk messaging". An assistant that answers a handful of approved people looks nothing like that. A bot that cold-messages strangers does.

So the practical rules are short. Use a number you could afford to lose; OpenClaw's own security guide recommends a separate number for phone-based channels so your personal conversations stay out of the agent's reach. Let the agent answer rather than broadcast. Keep access tight, which the rest of this guide covers.

When the WhatsApp Business Platform is the better tool

If you're a business that wants an assistant answering customers, use Meta's official WhatsApp Business Platform (the Cloud API) instead. It's built for that job: a business number under a Meta business portfolio, up to 80 messages per second by default, approved templates, and no unofficial-client risk. You can reply freely for 24 hours after a customer's last message; outside that window, only templates. Pricing is per delivered message, and since 1 October 2026 each business number gets 1,000 free service messages a month, per Meta's pricing page.

Two limits matter. Meta's platform terms (section 4.7, last updated 23 September 2026) bar AI providers when AI is the main product, so a general-purpose assistant doesn't belong there, while a business using AI for its own customer service is fine. And OpenClaw can't use it anyway: its docs say the WhatsApp channel runs over WhatsApp Web and there is no separate Twilio WhatsApp channel.

OpenClaw linked deviceWhatsApp Business Platform
Connects asA WhatsApp Web linked device (Baileys)The official Cloud API
Best forA personal or small-team assistant for people you approveA business answering its customers at volume
NumberAny WhatsApp number; a spare is safestA business number in a Meta business portfolio
WhatsApp feesNone; you pay for the modelPer delivered message, 1,000 free service messages per number a month
Account riskUnofficial client: ban or restriction possibleSanctioned, though policy enforcement still applies
General-purpose AI assistantWhat OpenClaw is built to beBarred as a primary product (section 4.7)

Connect OpenClaw to WhatsApp step by step

  1. Install the plugin. openclaw channels add --channel whatsapp and openclaw channels login --channel whatsapp both offer to install it the first time, or do it yourself:
    openclaw plugins install @openclaw/whatsapp
  2. Write the access policy before you link. Open ~/.openclaw/openclaw.json (it's JSON5, so comments are fine) and add a WhatsApp block. Replace the numbers with yours and your teammates':
    {
      channels: {
        whatsapp: {
          dmPolicy: "allowlist",                          // only allowFrom numbers get answers
          allowFrom: ["+15551234567", "+447700900123"],   // E.164
          groupPolicy: "allowlist",
          groupAllowFrom: ["+15551234567"],
        },
      },
    }
    The gateway watches this file and applies changes on its own.
  3. Start the QR login on the gateway host.
    openclaw channels login --channel whatsapp
    The terminal prints "Open the WhatsApp app, go to Linked Devices, then scan this QR:" and draws the code.
  4. Scan it with the agent's phone. On Android, open the menu, then Linked devices, then Link a device. On iPhone it's Settings, Linked devices, Link device. WhatsApp may ask for your fingerprint, face or PIN. The terminal should answer with "Linked! Credentials saved for future sends."
  5. Start the gateway and check the link. If the gateway already runs as a service, the CLI asks it to start the account after login. Otherwise start it with openclaw gateway and check from a second terminal:
    openclaw channels status --probe
  6. Message the agent from your own phone. Keep openclaw logs --follow open while you do. If nothing comes back, jump to the troubleshooting table.

Prefer prompts? openclaw channels add --channel whatsapp does the same in wizard form. It asks "Link WhatsApp now (QR)?", then "WhatsApp phone setup", where you pick "Separate phone just for OpenClaw" or "This is my personal phone number", then the DM policy and an optional allowlist of E.164 numbers.

Scanning the OpenClaw WhatsApp QR code on a remote server

The first code lives for 60 seconds. After that Baileys swaps in a fresh one every 20 seconds until WhatsApp stops issuing them, then the login ends with status 408 ("QR refs attempts ended"). OpenClaw retries once with a new socket; after that, run the login command again.

Over SSH the terminal QR usually scans fine if the window is big enough to draw it. The OpenClaw docs warn against relaying it as a screenshot or chat attachment, because it can expire in transit. The Control UI's Channels page can show the QR in your browser instead, which is the easy route on a hosted instance. In the official Docker setup, run docker compose run --rm openclaw-cli channels login. And if login fails with a 408 before any QR appears, check your proxy: the gateway process needs HTTPS_PROXY, and NO_PROXY must not match mmg.whatsapp.net.

Where the session lives

The link is saved to ~/.openclaw/credentials/whatsapp/default/creds.json, with a backup copy next to it as creds.json.bak (default is the account ID unless you named one). Anyone who copies that folder can act as your linked device, so treat it like a password: keep it out of git, out of support tickets and out of shared backups. Running two processes on the same credentials causes a "session conflict", covered in the table further down.

Lock it down to approved senders

Direct messages are controlled by channels.whatsapp.dmPolicy together with allowFrom:

dmPolicyWhat strangers getUse it when
pairing (default)A one-time code; their message is not processed until you approveYou want to add people as they ask
allowlistNothing; only allowFrom numbers are admittedA dedicated number for a known set of people
openFull access; requires "*" in allowFromAlmost never with an agent that has tools
disabledNothing; no DMs are processed, even from allowFromGroups only, no DMs

For a dedicated number, allowlist is the cleanest choice: strangers get silence, and blocked messages show up in the gateway log as Inbound message blocked (reason=...) (at most once a minute per reason, without the sender's number). Pairing is a reasonable default too, since nothing reaches the agent until you say so.

Who reaches the agent over WhatsApp Who reaches the agent You number in allowFrom Answered A teammate pairing code approved Answered A stranger dmPolicy: pairing A code only, no agent access A stranger dmPolicy: allowlist Silence, a log line only
With pairing or allowlist, a stranger's message never reaches the agent. Only open with "*" lets anyone in.

Approving people with pairing

Under pairing, a new sender gets an 8-character code (uppercase, with no 0, O, 1 or I to misread). Codes expire after an hour, and each account holds at most three pending requests; further ones are ignored until a slot frees up. Approve in the Control UI under Settings, Channels, DM access requests, or from the CLI:

openclaw pairing list whatsapp
openclaw pairing approve whatsapp K7MP4XQ2 --notify

One trap. If no command owner is configured yet, the first CLI approval also makes that sender the owner (commands.ownerAllowFrom), who can approve commands, change configuration and restart the gateway. Pair yourself first. Approval also covers DMs only: a paired teammate still can't trigger the bot in groups until you add them to groupAllowFrom.

Using your personal number instead

It's supported. The wizard's personal mode writes dmPolicy: "allowlist", puts your number in allowFrom and sets selfChatMode: true, so messages you send to your own chat become agent input. Other people's DMs to you stay blocked. The catch: the agent replies as you, from your account, and that account is the one exposed to the unofficial-client risk above. A spare number keeps both problems away from your real life.

Read receipts, reactions and media

Accepted messages get blue ticks by default; set sendReadReceipts: false to stop that. Replies are split at 4,000 characters (textChunkLimit), and mediaMaxMb caps incoming and outgoing media at 50 MB by default, with images resized to fit.

OpenClaw in WhatsApp groups

There's nothing extra to install for groups. With a dedicated number, add that number to the group like any other member; with your personal number, it's already in your groups. What decides whether the agent speaks is three checks, in order.

Three gates for a WhatsApp group message A group message must clear three gates 1 Is the group admitted? No groups map: every group is. With one: only listed JIDs or "*". 2 Is the sender allowed? groupPolicy allowlist checks groupAllowFrom, else allowFrom. 3 Was the bot mentioned? An @mention, a reply to the bot, or mentionPatterns. On by default. OpenClaw replies in the group Up to 50 unanswered messages ride along as context.
The order OpenClaw checks a group message in. Sender checks run before the mention check, so quoting an allowed person doesn't let anyone else in.

Out of the box, with no groups map, every group the number belongs to is eligible; groupPolicy defaults to allowlist; and if groupAllowFrom is empty, OpenClaw falls back to the numbers in allowFrom. So with the config from step 2, you can @mention the bot in any group it's in, and nobody else can wake it.

To limit it to one group and a few people, add a groups map keyed by the group's JID:

{
  channels: {
    whatsapp: {
      groupPolicy: "allowlist",
      groupAllowFrom: ["+15551234567", "+447700900123"],
      groups: {
        "120363406415684625@g.us": { requireMention: true },
      },
    },
  },
}

To find a JID, run openclaw logs --follow --json, send a message in the group, and look for a chatId ending in @g.us. Once groups are configured, openclaw directory groups list --channel whatsapp lists them.

A mention means tapping the bot's contact in the @ menu, replying to one of its messages, or matching a regex in agents.entries.<id>.groupChat.mentionPatterns. Voice notes from allowed senders are transcribed first, so saying the bot's name out loud works too. Set requireMention: false on a group, or send /activation always there (owner only), if you want it to answer everything.

One thing people miss: group chatter the bot didn't answer is buffered, and up to 50 of those messages go along as context the next time it's triggered (historyLimit). That's handy for "summarise this thread", but it means the group's conversation goes to your model provider and adds tokens. Lower historyLimit, or set it to 0, in busy or sensitive groups. Our breakdown of what an agent costs per month shows how resent context adds up.

Keep the session alive 24/7

The gateway is the linked device. When a laptop sleeps, the socket drops: the phone keeps receiving messages and the agent sees none of them. When the machine wakes, the gateway notices the gap and reconnects its channels. Messages that arrived while it was away get an answer only if they're at most 20 minutes old at reconnect. A message sent at midnight to a laptop that slept until 8:00 never gets a reply.

Where the gateway runsWhen WhatsApp gets answersHow to keep it up
LaptopOnly while it's awake and onlineopenclaw gateway install, and expect gaps
Linux VPS or home serverAround the clockopenclaw gateway install plus linger, so it survives logout
DockerWhile the container runsA restart policy, a persistent state volume, one gateway per volume
Managed hostingAround the clockThe host runs the gateway; you scan the QR

On a server, install the gateway as a service and check it:

openclaw gateway install
openclaw gateway status
sudo loginctl enable-linger $(whoami)   # Linux: keep the user service running after you log out
openclaw channels status --probe

Once it's running, OpenClaw looks after the connection itself. A watchdog watches both raw transport traffic and message activity, and leaves a quiet but healthy session alone. When the socket does drop, it reconnects with backoff from 2 to 30 seconds, up to 12 tries, and the gateway's channel restarts and health monitor take over after that. Two states stop for good until you act: a logout (status 401) and a session conflict (status 440). After a logout, the gateway's /readyz check returns 503 with WhatsApp listed as failing.

The phone has duties too. Open WhatsApp on it at least every 14 days. The account allows four linked devices and OpenClaw takes one (the experimental MeowCaller voice-call add-on takes a second). WhatsApp also disconnects linked devices that have been inactive for 30 days, so a gateway left off for a month needs a new QR.

The life of a linked WhatsApp session The life of a linked session 1 Linked QR scanned, creds.json saved 2 Active gateway online, watchdog on lid closed, network drop, crash 3 Gateway offline messages wait at WhatsApp back within 20 min: answered reconnects or WhatsApp ends the link 4 Logged out (401) removed from Linked devices phone not opened for 14 days 30 days offline, or a ban Re-link with a new QR back to step 1
Short outages heal on their own. A logout doesn't: the gateway stops listening on WhatsApp and waits for you to scan a new QR.

How to log out or re-link

To unlink cleanly:

openclaw channels logout --channel whatsapp

That clears the saved session for the account and, if the gateway is reachable, stops its listener first. The CLI doesn't promise that WhatsApp revoked anything on its side, so also check Linked devices on the phone and remove any stale entry. It works the other way round too: remove the device from the phone and the gateway gets a 401, stops the WhatsApp listener and logs "WhatsApp session logged out. Run openclaw channels login --channel whatsapp to relink." Running that login clears the dead session and shows a fresh QR.

When a session keeps disconnecting even though the host's network is fine, the docs suggest backing up the account folder before you re-link:

cp -a ~/.openclaw/credentials/whatsapp/default ~/.openclaw/credentials/whatsapp/default.bak
openclaw channels logout --channel whatsapp --account default
openclaw channels login --channel whatsapp --account default

Troubleshooting: OpenClaw WhatsApp not working

Start with three commands. Most answers are in the second one.

openclaw channels status --probe
openclaw logs --follow
openclaw doctor
What you seeLikely causeWhat to do
The QR expires before you can scan itFirst code lasts 60 s, then 20 s each; WhatsApp stops issuing them after a fewRerun openclaw channels login --channel whatsapp with the phone ready, or use the Control UI's QR
status=408 Request Time-out before any QRThe gateway can't reach WhatsApp through your proxyGive the gateway process HTTPS_PROXY; keep mmg.whatsapp.net out of NO_PROXY
"WhatsApp session logged out" (401)Device removed on the phone, phone unused for 14 days, 30 days offline, or WhatsApp enforcementopenclaw channels login --channel whatsapp and scan again
"session conflict" (440) and the channel stopsTwo processes using the same credentials, such as a copied ~/.openclaw folderStop the other copy; for a fresh QR run logout, then login
whatsapp_connection_owner_busyA lock file left behind by a crashopenclaw doctor names it; follow its offline recovery steps
Linked, but DMs get no answerSender not in allowFrom, or a pairing request is waitingLook for Inbound message blocked in the logs; openclaw pairing list whatsapp
Works in DMs, silent in a groupgroupPolicy, groupAllowFrom, the groups map or the mention ruleCheck the three gates in order; also look for duplicate keys in openclaw.json
Every message gets two repliesTwo gateways linked to the same number, each as its own deviceKeep one; remove the other under Linked devices on the phone
Reply shows in the transcript but never arrivesWhatsApp didn't accept the sendSearch the logs for auto-reply delivery failed; check channels status --probe
Repeated disconnects or "max attempts reached"Host connectivity or timing problemsFix connectivity, restart the gateway, then back up and re-link if it keeps flapping
"You have been logged out for using an unofficial app", a ban or a restrictionWhatsApp enforcement on the accountNo config fix; see WhatsApp's help pages, request a review in the app, and expect no device linking while restricted

The ban row is the one to plan for rather than fix. It's why the agent belongs on a number whose loss you could shrug off.

Before you give the number out: dmPolicy is allowlist or pairing, there's no "*" in allowFrom, groupPolicy isn't open, you're the command owner, and the ~/.openclaw folder (credentials, config and the state database that stores pairing approvals) isn't readable by anyone else. Run openclaw security audit and fix what it flags. Our security checklist for self-hosted agents covers the rest.

Or let us keep the gateway online

The fiddly part of WhatsApp isn't the QR code; it's keeping one process awake for months. If you don't already have a server running around the clock, HostAiHub runs OpenClaw for you: a private instance on a free SSL subdomain, deployed automatically, with start, stop and restart from the dashboard, automatic upstream updates and persistent storage, so the saved WhatsApp session isn't wiped when the instance restarts. You bring your own Anthropic or OpenAI key and can change it later in the dashboard.

You still link WhatsApp yourself, because the QR has to be scanned from your own phone. On first visit the Control UI asks you to set up your own login; after that you start the WhatsApp login and scan the code. Setup help is included in every plan, so if anything in this guide doesn't match what you see, open a ticket and we'll go through it with you. Hosting doesn't change WhatsApp's rules, so the dedicated number and the allowlist still apply. Plans are $10 a month, $100 a year or $250 once for lifetime; see pricing. If you'd rather run it yourself, our guide on how to host OpenClaw walks through the options.

Frequently asked questions

Does OpenClaw use the official WhatsApp Business API?

No. OpenClaw's WhatsApp channel connects as a WhatsApp Web linked device through the Baileys library, and its docs say there is no separate Twilio WhatsApp channel either. Businesses that need the official API should use Meta's WhatsApp Business Platform instead.

Can I connect OpenClaw to my personal WhatsApp number?

Yes. The setup wizard has a personal-number mode that allowlists your own number and turns on self-chat, so you talk to the agent in your own chat. The agent then replies as you, and your main account carries the unofficial-client risk, so a separate number is the safer choice.

How do I stop strangers from messaging my OpenClaw agent on WhatsApp?

Set channels.whatsapp.dmPolicy to "allowlist" and list approved numbers in E.164 format in allowFrom. Strangers then get no reply and the gateway logs the blocked message. The default pairing mode also keeps them away from the agent until you approve their code.

Does my phone need to stay online for OpenClaw to answer on WhatsApp?

Not for each message, because linked devices connect to WhatsApp independently. WhatsApp does require you to log in on the primary phone at least every 14 days, or linked devices are disconnected. The OpenClaw gateway itself has to stay running.

Why does my OpenClaw WhatsApp QR code keep expiring?

The first QR code is valid for 60 seconds and each replacement for about 20 seconds, and WhatsApp only issues a few. Have the phone open on Linked devices before you run openclaw channels login --channel whatsapp, and on a remote server use a terminal large enough to show the code or the Control UI's QR login.

Where does OpenClaw store the WhatsApp session?

In ~/.openclaw/credentials/whatsapp/<accountId>/creds.json, with a creds.json.bak backup beside it; the default account ID is default. Anyone with a copy of that folder can act as your linked device, so keep it private.

Can OpenClaw get my WhatsApp number banned?

It can happen. WhatsApp's help center says linking an account to unofficial versions of WhatsApp violates its Terms of Service and can lead to temporary or permanent bans or restrictions. Using a dedicated number, answering only approved people and never bulk-messaging keeps the risk lower, but nobody can rule it out.

Deploy your own AI agent — no servers to manage

We auto-install OpenClaw, Hermes and n8n to your own private, SSL-secured subdomain. Bring your own LLM key.