Connect WhatsApp
Link a WhatsApp number to HolaClaw Server as a linked device, invite people, and run it day to day.
- Server
- Channels
This guide links a WhatsApp number to your HolaClaw Server agent. People then message that number, and the agent answers. When you finish, you can talk to the agent in a direct message and in WhatsApp groups you approve.
HolaClaw joins the account as a linked device, the way WhatsApp Web does. There is no bot token and no Meta business account: you link it once from the phone with an 8-character code. The server needs no public address and no open port.
Commands are written as holaclaw …. Run them the way your deployment does, for example docker exec -it holaclaw holaclaw … in the container.
WhatsApp can ban the number
WhatsApp's terms do not allow automated or unofficial clients, and Meta can ban a number it considers abusive. HolaClaw behaves like a person answering their own phone, which reduces the risk but does not remove it. Use a number you can afford to lose, especially while you test.
What you need
- A number of its own for the bot. A second SIM, an eSIM, or the WhatsApp Business app with a second number on the same phone. Do not link your personal number: the bot would see all your chats, your contacts would reach the bot instead of you, and you could talk to it only through "Message yourself".
- That number set up in WhatsApp on a phone. The phone stays the main device. WhatsApp allows four linked devices, and HolaClaw takes one.
- The phone online at least every 14 days or so. WhatsApp unlinks the devices of a phone that has not connected for about that long. If the phone sits in a drawer, keep it charged and on Wi-Fi.
- HolaClaw Server running on a machine that stays on.
How HolaClaw limits the ban risk
Meta does not publish its rules. HolaClaw keeps to what a person would do:
- It never starts a conversation with a stranger. It answers people who wrote first, and tasks deliver only to conversations that already exist.
- It drops strangers before any reply (
dm = "invite"by default). A dropped stranger gets nothing, not even a read receipt. - It sends one message at a time, after a typing indicator and a read receipt, with split messages about a second apart.
- It downloads no history, watches no presence and reads no contact list.
- It rejects calls. A stranger's call is declined silently.
- It has no broadcast lists, no status posts, and never joins a group by link.
Step 1: Add the channel
Add a channel instance to channels.toml. Name it whatsapp: the login commands use that name unless you pass --name.
version = 1
[channels.whatsapp]
type = "whatsapp"
agent = "main"
[channels.whatsapp.access]
dm = "invite"
rooms = "approved"
reply = "mention"There are no WhatsApp-specific keys, and the phone number is not one: linking stores it. Anyone who has the number can message it, so keep dm = "invite". Every key is in the channels.toml reference.
With reply = "mention", the agent still sees the group's recent messages when someone mentions it. The mention only decides when it answers.
Restart the daemon so it loads the channel (restart command for your deployment). Until you do, holaclaw login whatsapp answers that the daemon has no WhatsApp channel of that name.
Step 2: Link the phone
With the daemon running and the bot's phone in your hand, run the login with the bot's number in international format. Spaces, dashes and a leading + are fine; a number that starts with 0 is refused.
holaclaw login whatsapp --phone "+34 600 000 000"It prints a code such as ABCD-EFGH and waits. On the bot's phone:
- Open WhatsApp, then Settings, then Linked devices.
- Tap Link a device.
- Tap Link with phone number instead. There is no QR code for this.
- Type the code from the terminal.
WhatsApp also shows a notification on the phone that opens this screen. Once the phone confirms, the terminal prints whatsapp: linked as +34600000000. The phone lists the device as holaclaw.
The code lasts about 160 seconds. If it expires, run the command again; nothing is left to clean up. Ctrl-C only stops the terminal from waiting: the daemon keeps the code alive until it expires, and holaclaw login whatsapp without --phone shows it again.
For a channel with another name, add --name <name> to login and logout.
Step 3: Check it
holaclaw check
holaclaw statuscheck warns SEC006 while the channel is not linked. Run it on the machine where the daemon keeps its data. In status, a linked channel reads connected, with the bot's number as its detail:
whatsapp whatsapp main connected +34600000000Step 4: Invite people
Start with yourself. Find your identity id and mint an invite:
holaclaw identity list
holaclaw invite create --identity <owner id> --channel whatsappFor someone new, create their identity with its first invite:
holaclaw identity create --name Carla --invite whatsappEither command prints a wa.me link and its QR code. Send the link over any channel, or have the person scan the code. It opens a WhatsApp chat with the bot with the code already typed, so they tap send. The code works once, for 15 minutes by default.
If the channel is not connected when you mint the invite, you get the bare code instead of a link: the person types it to the bot once it is back. Invite people covers roles and removing access.
Use it in a group
The bot cannot join a group by itself. A member adds the bot's number, like any contact. With rooms = "approved":
If a linked owner or admin adds it, the group is approved.
Otherwise, mint a room code and have someone send it in the group, mentioning the bot, as
@<bot> <code>:Terminalholaclaw invite create --room --channel whatsapp
Room codes have no link: they work only typed in the group. In an approved group, mention the bot to talk to it.
Daily use
- Approvals arrive as plain text with a legend: you answer by reacting to the message, since WhatsApp gives unofficial clients no buttons.
- Calls are always rejected. Someone who has already chatted with the bot is told to write instead.
- Media: images, video, voice notes, documents and stickers come in. View-once media shows as a placeholder. Voice notes go out only when the audio is already Ogg/Opus; other audio goes out as a file.
- Updates: WhatsApp can change its protocol. When it does,
statusshowslogged_outwith "WhatsApp rejected this client version; update holaclaw". Upgrade, then link again.
Unlink
holaclaw logout whatsappIt removes the device from the phone and deletes the local session. Removing holaclaw from Linked devices on the phone does the same from the other side. Linking again needs a new code and no restart.
Common problems
| What you see | What to do |
|---|---|
the code expired; run the command again |
Run the login again and type the code sooner. |
already linked as +34… |
Run holaclaw logout whatsapp first if you want to replace the account. |
--phone is required |
No code is waiting, so pass --phone to request one. |
no whatsapp channel named "…" |
Add the channel to channels.toml and restart, or pass --name with the channel's name. |
status shows logged_out, "unlinked from the phone" |
The device was removed on the phone, or WhatsApp logged it out. Run the login again. |
status shows logged_out, "another client is using this session" |
Make sure only one HolaClaw runs with this session, then link again. |
status shows logged_out, "WhatsApp banned this number temporarily" |
Wait out the ban; HolaClaw reconnects by itself afterwards. If it happens again, stop using that number. |
| You restored a backup, or the phone was reset | Backups leave out the WhatsApp session on purpose. Link the channel again. |
Next steps
- Invite people and give them roles.
- Add another channel: Telegram, Google Chat or Slack.
- Troubleshooting
Was this page helpful?
