Send your first WhatsApp API message with curl
Send your first WhatsApp Business API message with curl: what you need, the three requests, why the first message must be a template and how to fix errors.
To send your first WhatsApp Business API message, you need an API key, your API base URL, the ID of the connected number and an approved template. Then you send one POST request, signed with your API key, to the messages endpoint. The first message must be a template, because free-form text is only allowed inside a customer service window that the recipient has to open.
This guide shows the three requests almost every integration starts with: check your key, send a template and check the message status. The examples use curl, a command-line tool for making web requests, and Hello’s API. The same ideas apply to Meta’s Cloud API in general, so the explanations carry over if you build elsewhere. If you are still deciding between the app and the API, read WhatsApp Business app vs API first.
What do you need before the first message?
Gather four things before you open a terminal:
| You need | What it is | Where to get it in Hello |
|---|---|---|
| API key | A secret sent as a Bearer token | Integrations in the dashboard |
| API base URL | Where your requests go | Integrations, next to the key |
| Phone number ID | The numeric ID of the number you send from | Accounts page |
| Approved template | A message WhatsApp has reviewed | Templates in Hello |
Two identifiers are easy to confuse. The phone number ID identifies the sending number and goes in the URL path; it is not the number itself. The WABA ID identifies the WhatsApp Business Account that owns the number and is used when you manage templates. Mixing them up is one of the quickest ways to get a not-found error (404 ACCOUNT_NOT_FOUND).
You also need a number connected through Meta’s Embedded Signup, the Facebook sign-in flow you use when you add a number in Hello. If your number is already on the WhatsApp Business app, coexistence lets you keep using the app while the API sends from the same number.
Finally, the recipient must have opted in. Meta’s policy expects it before you start a conversation, so test with your own number. How to collect and record opt-in covers the wording.
How do you send your first WhatsApp API message?
Store your three values in shell variables, so that every command below can reuse them as written:
export HELLO_API_URL="<API base URL from the dashboard>"export HELLO_API_KEY="hello_live_xxxxxxxxxxxxxxxx"export PHONE_NUMBER_ID="<phone number ID from the Accounts page>"Step 1: check your key
curl "$HELLO_API_URL/v1/ping" \ -H "Authorization: Bearer $HELLO_API_KEY"A healthy key returns { "status": "ok", "test_mode": false }. A 401 means the key is missing, wrong or disabled, and a 403 TEST_MODE_KEY_UNSUPPORTED means it is a legacy test-mode key, so create a live one. Fix this before anything else, because every later error is harder to read if authentication is the real cause.
Step 2: send a template message
curl -X POST "$HELLO_API_URL/v1/$PHONE_NUMBER_ID/messages" \ -H "Authorization: Bearer $HELLO_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "to": "+447700900123", "type": "template", "template": { "name": "order_shipped", "language": { "code": "en" }, "components": [ { "type": "body", "parameters": [ { "type": "text", "text": "Asha" }, { "type": "text", "text": "#10432" } ] } ] } }'Use the name and language of a template that is approved on your account. Write to with a leading + and the country code; a number without them is rejected. Pass one parameter per {{1}}, {{2}} variable, in order. Hello adds the message to its send queue and replies with 202 and an ID:
{ "messaging_product": "whatsapp", "contacts": [{ "input": "+447700900123", "wa_id": "447700900123" }], "messages": [{ "id": "", "message_status": "queued", "hello_id": "b7e1d2c3-4f5a-4b6c-8d9e-0a1b2c3d4e5f" }]}Add ?sync=true (or set your API key to synchronous) if you want to wait up to 25 seconds for WhatsApp to accept it in the same request.
Step 3: check the status
curl "$HELLO_API_URL/v1/messages/b7e1d2c3-4f5a-4b6c-8d9e-0a1b2c3d4e5f" \ -H "Authorization: Bearer $HELLO_API_KEY"The status field moves from queued to sent, delivered and read, or to failed with an error_code and error_message. A 202 is not a delivery guarantee: a queued message can still fail, for example if WhatsApp rejects the template parameters.
Why must the first WhatsApp API message be a template?
Meta lets you send free-form messages only during a customer service window, which opens when a person messages or calls you and lasts 24 hours. Outside it, only pre-approved templates are allowed. A brand-new contact has never messaged you, so no window exists, and a template is the only way in.
Once the person replies, the window opens and you can send text, images, documents and the other types without a template. That is why the request in step 2 uses "type": "template", and why sending "type": "text" to a cold contact fails. The 24-hour window explained has a worked timeline.
Templates also carry a category, utility, marketing or authentication, which affects review and what Meta bills. A shipping update belongs in utility; promotional wording in a utility template risks re-categorisation. See WhatsApp template categories before you write yours.
What do the common errors mean?
These are the errors you are most likely to see on a first send. Meta’s documentation describes the WhatsApp-side codes, and Hello adds its own checks before the request is queued.
| You see | Likely cause | Fix |
|---|---|---|
401 UNAUTHORIZED |
Wrong, deleted or disabled key | Create a live key in Integrations |
403 OUTSIDE_24H_WINDOW |
Non-template message to someone with no open window | Send an approved template first |
403 TEMPLATE_NOT_APPROVED |
Template is pending or rejected | Wait for approval or use another template |
404 ACCOUNT_NOT_FOUND |
Wrong phone number ID, or you used the WABA ID | Copy the ID from the Accounts page |
400 TEMPLATE_LANGUAGE_REQUIRED |
Template exists in several languages and none was given | Set template.language.code |
404 TEMPLATE_NOT_FOUND or TEMPLATE_LANGUAGE_NOT_FOUND |
Wrong name or language code | List your templates and copy the exact values |
400 VALIDATION_ERROR |
Bad JSON or to missing + and country code |
Fix the request as the message says |
If a send is accepted but later fails, the status response carries WhatsApp’s reason. Meta documents several codes you may meet there:
- 131047: the recipient last replied more than 24 hours ago, so send a template.
- 132000: the number of variable values does not match the template.
- 132001: the template does not exist in that language or is not approved.
- 131026: the message could not be delivered, for instance because the recipient is not on WhatsApp, has not accepted the latest terms or uses an outdated app.
Hello also enforces your plan before queuing a send, so a quota, country or template-category limit returns a 403 with a specific code. The errors reference lists every one with its fix.
What changed recently?
Two Meta updates are worth knowing when you set up a new integration.
- 13 May 2026: Meta’s Cloud API changelog describes a public preview of Embedded Signup version 4, which adds a flow that starts from the phone number. This affects how a number is connected, not how you send.
- 18 February 2026: Twilio reported the introduction of WhatsApp usernames and business-scoped user IDs. Meta says usernames launch later in 2026, and sources differ on timing, so check Meta’s documentation if your integration stores customer identifiers.
Meta’s per-message charges are set by message category and the recipient’s country, and are billed directly to your WhatsApp Business Account. Read Meta’s current pricing page before you plan volumes.
What should you do after the first message works?
Treat the first send as proof that the setup works, then make it dependable:
- Keep the returned ID. Store it against the order or booking so you can check its status later.
- Retry safely. Send an
Idempotency-Keyheader so a retry returns the original message instead of sending a duplicate. - Plan for failure. Decide what to do from the error
code, not the message text, because the wording can change. - Choose a use case. Order notifications, appointment reminders and invoices as documents each start with the same template request.
- Move beyond templates. After a customer replies, the message type docs show how to send images, documents, buttons and lists inside the window.
If you are unsure why a message failed, check the sequence in order: key, number ID, template status, recipient format, then window.
Sources
- Meta: send messages with the Cloud API
- Meta: Cloud API error codes
- Meta: Cloud API changelog
- Meta: WhatsApp Business Platform pricing
- Meta: business-scoped user IDs
- Twilio: usernames and BSUID changelog
For developers: the Hello API docs cover authentication, checking your key with ping, sending a text message and the message object.
Frequently asked questions
Why can’t I send a normal text as my first WhatsApp API message?
Because free-form messages are only allowed while a customer service window is open, which starts when the person messages you and lasts 24 hours. A new contact has not done that, so Meta allows only an approved template. Send a template first, then reply freely once they respond.
What is a phone number ID and where do I find it?
It is the numeric ID WhatsApp assigns to the number you send from, and it goes in the request path. It is not the phone number itself. In Hello you find it on the **Accounts** page. The WABA ID, used for templates, is a different identifier.
Can I test the WhatsApp API without messaging real customers?
Yes. Send to your own WhatsApp number or a colleague’s who has agreed to receive tests. Meta still expects recipients to have opted in, so do not use customer numbers for experiments. A single test message to yourself proves your key, number and template work end to end.
Why does the API accept my request but the message never arrives?
Acceptance is not delivery. A queued message can still fail, for example if the recipient is not on WhatsApp, has not accepted WhatsApp’s latest terms, or the template parameters do not match. Check the message status with the returned ID and read the failure reason instead of assuming success.