Messages
Send an approved template at any time, or a text inside the 24-hour window after the customer's last message, then follow the message until it is delivered or read.
These examples use a placeholder address. Your console shows the exact address of the API for your workspace.
- A text message needs a message from the customer in the last 24 hours on that conversation. Otherwise the call fails with
outside_customer_windowand you must send a template. - A live send appears in the business's Inbox like a message from the team, and its status changes produce
message.status_updatedevents. - Statuses of an outbound message:
queued,sent,delivered,read,failed,uncertain.uncertaincarries the errordelivery_uncertainand means Meta may have received the message before the connection dropped: check the conversation before sending it again, the API never retries it on its own.
POST /messages
Sends a WhatsApp message from one of your connections and returns it with the queued status. Send either a template, at any time, or a text, inside the 24-hour customer window.
- Exactly one of
textandtemplatemust be present, matchingtype. - The number of
template.variablesmust equal thevariable_countof the template. - Repeating the call with the same
Idempotency-Keyand body does not send a second message. See idempotency.
- Required scope
messages.send- HTTP
- Success: HTTP 202
Parameters
| Name | Description |
|---|---|
Idempotency-Keystring (1 to 255 characters) | Identifies this send. 1 to 255 printable ASCII characters. |
connection_idstring (UUID) | The id of the connection to send from. It must be active. |
tostring (E.164) | The recipient, in E.164 format, with or without the leading +. |
typetext | template | text or template. |
text.bodystring (1 to 4,096 characters) | The text of the message, 1 to 4,096 characters. Only for type: text. |
template.namestring | The name of an approved template. Only for type: template. |
template.languagestring | The language code of that template, such as fr. |
template.variablesstring[] (0 to 10) | The values of the template variables, in order. Each is 1 to 1,024 characters. |
client_referencestring (1 to 128 characters) | Your own reference, returned on the message and in its events. |
Errors
- invalid_request
- idempotency_key_required
- idempotency_conflict
- not_found
- connection_inactive
- invalid_phone_number
- outside_customer_window
- template_not_found
- template_not_approved
- template_variables_mismatch
- daily_send_limit_reached
- service_unavailable
Any authenticated endpoint can also return the authentication, scope and rate limit errors listed on the errors page.
GET /messages/{id}
Returns a message and its current status.
- A live key can read the messages sent through the developer API by any application of the workspace, and the inbound customer messages of its WhatsApp connections. Any other id is
404 not_found. - A sandbox key reads the sandbox messages of its own application.
- Required scope
messages.read- HTTP
- Success: HTTP 200
Parameters
| Name | Description |
|---|---|
idstring (UUID) | The id of the message. |
Errors
Any authenticated endpoint can also return the authentication, scope and rate limit errors listed on the errors page.