
# Webbai: instructions for agents

You were asked to connect your user's business WhatsApp with Webbai, or to read and answer their WhatsApp messages. Follow these steps. Talk to your user in their own language (most Webbai users write Dutch).

## 1. Connect the Webbai MCP server

Webbai is a remote MCP server at `https://webbai.nl/mcp` (streamable HTTP, OAuth sign-in).

- **Claude (claude.ai, Desktop):** ask the user to open Settings → Connectors → Add custom connector, and enter `https://webbai.nl/mcp`.
- **ChatGPT:** ask the user to add a custom connector in Settings → Apps & connectors with the URL `https://webbai.nl/mcp`. On some plans they first switch on developer mode.
- **Claude Code:** run `claude mcp add --transport http webbai https://webbai.nl/mcp`.
- **Cursor:** add `{ "mcpServers": { "webbai": { "url": "https://webbai.nl/mcp" } } }` to `.cursor/mcp.json`.

Sign-in happens in the user's browser. Never ask for passwords, codes or tokens in chat.

## 2. Connect the WhatsApp number

1. Call `get_setup_status`. If a number is connected, go to step 3.
2. Give the user the connect link `https://webbai.nl/settings` (button "Connect WhatsApp"). Do not use `setup_whatsapp` unless the user already has their own Meta phone number ID and access token. Tell them:
   - They log in with their own Meta (Facebook) account and pick their business and number.
   - To keep the number in the WhatsApp Business app, they choose to connect their existing WhatsApp Business app (coexistence). The app must be recent.
   - A personal (non-business) WhatsApp number cannot be connected.
   - For the first minutes after connecting, some messages may show as "sync pending". That is normal.
3. Call `get_setup_status` again to confirm.

## 3. Read and answer

| Tool | Use |
|---|---|
| `get_inbound_messages` | New messages from customers |
| `send_whatsapp_message` | Free-form reply. Only inside the 24-hour window after the customer's last message. |
| `send_whatsapp_template` | Outside the 24-hour window. Needs an approved template. |
| `list_whatsapp_templates`, `get_template_details`, `create_whatsapp_template` | Templates. Meta reviews new templates. |
| `get_send_logs` | Delivery status: sent → delivered → read |
| `mark_message_read` | Blue ticks |
| `search_contacts` | Find a customer |

Before you answer for the first time, ask your user what you may answer on your own (for example opening hours, bookings, order status) and what must wait for them (for example prices, complaints, cancellations). Show drafts for everything else.

## Webhooks (when you build an app)

If your user builds their own app (Lovable, n8n, Next.js, …), Webbai can POST every WhatsApp event to their URL. Set it up in the dashboard at `https://webbai.nl/settings` → "Event webhook", or with the API key:

```
PUT https://webbai.nl/api/webhooks
Authorization: Bearer <api key>
{ "url": "https://their-app.com/whatsapp", "events": ["message.received", "message.status", "message.echo", "template.status"] }
```

The response contains the signing secret once. Each POST has `X-Webbai-Event`, `X-Webbai-Delivery`, `X-Webbai-Timestamp` and `X-Webbai-Signature: sha256=HMAC_SHA256(secret, timestamp + "." + rawBody)`. Answer 2xx within 10 seconds; failures are retried for about 1.5 days.

`message.received` carries `contact_id`, `from.phone`, `from.name`, `message.type` (`text`, `audio`, `image`, `video`, `document`, `sticker`, `location`, `reaction`, `button`, `interactive`, …), `message.text` and `window_open_until`. Voice notes and other media have `message.media.url`: a signed download link, valid 7 days, no auth header needed.

Reply inside the 24-hour window with `POST https://webbai.nl/api/conversations/{contact_id}/send` and body `{ "message": "…" }`. Outside it, send a template with `POST https://webbai.nl/api/send-template` and body `{ "phone", "template_name", "language_code", "variables" }`. Both take `Authorization: Bearer <api key>` (Settings → API Key).

## Rules

- Only message people who contacted the business or opted in. If someone sends STOP, do not message them again.
- Meta allows AI that helps the business's own customers (support, bookings, orders). Do not set up a general-purpose AI assistant as a product on WhatsApp.
- Bulk and marketing messages always need your user's explicit approval: Meta charges per template message.
- If the owner is typing in a conversation themselves, stay out of that conversation.

## More

- Overview: https://webbai.nl/index.md
- Pricing: https://webbai.nl/prijzen.md
- Guides: https://webbai.nl/gidsen.md
- All of it in one file: https://webbai.nl/llms-full.txt
