Connect a number in your WhatsApp Business Account with
POST /v0/senders or the
dashboard’s Senders page.
The shared WhatsApp sandbox is not open; test on Telegram first with the same handler.TypeScript
On serverless platforms that stop work when the response is sent, run the reply with your platform’s background helper (for example
after() in Next.js or waitUntil()), or answer in the webhook response itself as shown below.1. Build it on Telegram today
There is no WhatsApp sandbox yet. Run the same code on the Telegram sandbox bot:- Get a test key, with no account:
curl -X POST https://api.flow.engineer/v0/sandbox/keys(ornpx @flow-engineer/messaging init). Set itskeyasFLOW_MESSAGING_KEY. See Keys and sign-in. - Join the Telegram sandbox from your phone with the bot’s
address.link(see Build a Telegram agent). - Register your webhook, or on your laptop read events from the live stream (
GET /v0/stream, see Local development), and send a message.
2. Answer fast: reply in the webhook response
For short answers, skip the extra API call and return the reply from the webhook handler:TypeScript
HTTP response body
200 {} at once and send with the kinds’ endpoints, such as POST /v0/conversations/{conversation_id}/basic.
3. Voice notes
WhatsApp users send a lot of voice notes. Each one arrives as avoice message with the audio file (url, file_id):
POST /v0/conversations/{conversation_id}/voice with an audio url or file_id.
4. Buttons and lists
WhatsApp shows up to 3 reply buttons (buttons). For 4 to 10 choices, send a list: more than 3 buttons answer 422 unsupported_content with param buttons, and Flow does not turn them into a list for you.
TypeScript
message.received with a button_reply message: { "kind": "button_reply", "button_id": "upi", "label": "UPI" }. Labels are at most 20 characters.
5. The 24-hour window and templates
WhatsApp allows free-form messages only within 24 hours of the person’s last message. After that, and to message someone first, you must send an approved template.- Every event carries
conversation.window_open_until. - A free-form send outside the window fails with
409outside_window. - Subscribe to
conversation.window_closingto get a warning 1 hour before it closes.
TypeScript
POST /v0/templates, with a realistic sample for each placeholder (examples), and reviewed by WhatsApp; you receive template.status_changed when one is approved, rejected or paused. See Going live.
6. What WhatsApp supports
7. Going live on WhatsApp
Connect a number in your business’s own WhatsApp Business Account yourself, withPOST /v0/senders ("channel": "whatsapp") and a live key, or on the dashboard’s Senders page: see Going live for the steps in Meta Business Manager and the setup to enter in your Meta app. The Flow team can also connect a number for you, either one Flow provides or one in your own account. With your own account, add a payment method in WhatsApp Manager: Meta bills its fees to your business directly. On a number Flow provides, Meta’s per-message fees are passed through (see Pricing). Once the number is connected it appears in GET /v0/senders with your live key, and your agent’s code stays the same.
Related
- The send gate: windows, new-contact limits and quality.
- Streaming replies and Content types.
- Frameworks: Vercel AI SDK, OpenAI Agents SDK, LangChain.