> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentinbox.md/llms.txt
> Use this file to discover all available pages before exploring further.

# WhatsApp

> Connect your own WhatsApp Business number with Facebook, then prove your own number by sending it a code.

WhatsApp connects a WhatsApp Business number that you own. The agent writes from that number, and people answer it in WhatsApp.

> [!NOTE]
>
> WhatsApp is rolling out. If Configure on agentinbox.md does not offer it, your account does not have it yet, and `channel add whatsapp` says it is not available.

You need a Meta business and a phone number that is not on WhatsApp yet. Facebook walks you through adding one.

```bash theme={null}
npx @agentinbox/cli channel add whatsapp
```

The signup with Facebook only runs in a browser, so the CLI opens a page on agentinbox.md, or prints it without a terminal, and waits up to 15 minutes:

```text theme={null}
https://www.agentinbox.md/configure?setup=whatsapp
```

1. **Connect your WhatsApp Business account.** Click **Continue with Facebook**, pick your Meta business, then the number the agent should use.
2. **Send yourself the code.** Open the wa.me link, or scan the QR code, and send the message it fills in from your own WhatsApp. That proves your number.

The CLI finishes when both are done. Exit code `11` means the wait ran out. Nothing is broken. Run the command again. It resumes at the missing step.

A keyless inbox runs `npx @agentinbox/cli login` first. The page needs an account.

> [!WARNING]
>
> An agent forwards the URL. It does not ask you for your Facebook login or anything from WhatsApp.

An app connected through MCP has no terminal. It calls [`channel_add`](https://docs.agentinbox.md/reference/mcp#channel_add) and gives you the same page.

Invite someone else on WhatsApp:

```bash theme={null}
npx @agentinbox/cli contact invite bob --via whatsapp --async --name "Bob"
```

That prints a wa.me link with a code in it. When Bob sends that message, their number is proved and WhatsApp becomes their default channel. The code works for 10 minutes. The invite page offers WhatsApp too.

## The 24-hour window

WhatsApp lets the agent write to someone only within 24 hours of their last message. After that, a send that would go to them on WhatsApp goes out on another channel they are on instead.

When you asked for WhatsApp with `--via whatsapp`, or WhatsApp is the only channel they have, the agent sends your first message instead, if Meta approved one. The send waits, and goes out as soon as they reply or tap **View message**. The CLI and MCP say so: an `ask` keeps waiting for the answer, and a plain message reads as not delivered yet.

Without an approved first message, the send is refused, and nothing goes out, to them or to anyone else in the same send. The error says when their window closed and names another channel they are on, to send with `--via`. When they have none, it says to `contact invite` them.

The window opens again as soon as they write to the agent.

A `reply` into a WhatsApp conversation with a closed window works the same way: the first message goes into the conversation, and the reply follows when they write back. A reply that `to` sends to people outside the conversation, or that anyone in it may answer, is refused instead.

## Your first message

Set it as the last step of the WhatsApp setup on agentinbox.md. It starts as this, and you can change the words:

```text theme={null}
You have a message from {{agent_name}}. Reply here to view it.
```

`{{agent_name}}` becomes your agent's name when it is sent. The message always ends with a **View message** button.

Meta reviews it, usually within minutes, sometimes up to 24 hours. The setup and Configure show where the review stands, and why Meta rejected it if it did. Keep it a plain notice: offers or promotions get rejected, or charged as marketing.

Meta charges these messages to your WhatsApp Business account, so it needs a currency and a payment method in Meta's Business settings. Without them, Meta either refuses the send, or takes the first message and reports it undelivered a moment later. Either way the CLI and MCP say so, with Meta's reason, and the message still goes out if the person writes first.

An edit goes to Meta again. The approved version keeps working until the new one is approved.

## Buttons

WhatsApp shows at most 3 buttons. An `approve` can have one extra action beside Approve and Deny. An `approve` with two or more extra actions, or a `choose` with more than 3 options, goes out on another channel the person is on. It is refused the same way as above when you asked for WhatsApp or they have no other channel. See [Ask, approve, and choose](https://docs.agentinbox.md/questions.md).

## Strangers

With [Who can reach](https://docs.agentinbox.md/permissions.md) set to Anyone, someone who is not a contact can write to the agent's WhatsApp number first. They show up in the inbox by their number. With Contacts only, their messages are dropped.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.