POST/v1/messaging/messages

One endpoint sends on every messaging channel: channel chooses the channel and the fields that go with it. WhatsApp is available today; the WhatsApp fields are below.

Authorization

Bearer token

Authorizationrequiredheader

Send your API key as Bearer YOUR_API_KEY.

Requires whatsapp.send to send on the whatsapp channel. A key with whatsapp.full_access can also send. WhatsApp must be turned on for your organization.

Headers

Authorizationrequired

Bearer YOUR_API_KEY

Content-Typerequired

application/json

Idempotency-Keyrequired

A stable key for this send operation, up to 200 characters. Scoped to your project.

Body parameters

application/json

channelrequiredstring

whatsapp. The channel to send on; it decides the other fields.

fromrequiredstring

Phone number of the connected WhatsApp number to send from, in E.164 format, such as +213555000111. It must be connected in the API key's project.

torequiredstring

Recipient phone number in E.164 format: +, the country code, and 7 to 15 digits, such as +213555123456.

templaterequiredobject

The approved template to send.

template.idrequiredstring

Template ID of an approved template of the sender's WhatsApp Business Account, starting with wat_. The template sets the language and category.

template.variablesoptionalobject

Values for the template's variables. Omit it for a template without variables.

template.variables.headeroptionalobject

Header variable values, keyed by variable number or name, such as { "1": "A-1234" }.

template.variables.bodyoptionalobject

Body variable values, keyed by variable number or name, such as { "1": "Amina", "2": "A-1234" }.

Every variable of the template's header and body needs a non-empty string value of up to 1,024 characters. Keys are the variable's number ("1") for numbered variables, or its name ("first_name") for named ones. See Variables.

Response

application/json200 OK

Example identifiers below are illustrative.

data is the message object, without content. A normal send returns the status accepted: WhatsApp accepted the message, which is not yet delivery. Follow it with Retrieve a message or the WhatsApp webhooks.

When WhatsApp doesn't confirm the message in time, the response is still 200 with the status uncertain: the message may have been sent, and it is never resent automatically. See When a message is uncertain.

Retrying with the same Idempotency-Key and the same body returns the original message as it is now, without sending or charging again. Its status may have moved on.

Errors

Errors carry an error category, a code for WhatsApp-specific cases, a readable message, and a correlationId. A refused request sends nothing and charges nothing, unless it says the message was stored as failed.

StatuscodeReturned when
400noneThe body doesn't match the schema: a missing or unavailable channel, an unknown or missing field, or from or to not in E.164 format. details lists the failing fields.
400INVALID_DATAThe Idempotency-Key header is missing, empty, or longer than 200 characters.
400whatsapp_template_variable_missingA variable of the template has no value, or an empty one.
400whatsapp_template_variable_unknownA value was given for a variable the template doesn't have.
400whatsapp_template_variable_too_longA value is longer than 1,024 characters.
401noneThe API key is missing, malformed, revoked, or expired.
403noneThe key lacks the whatsapp.send permission.
403FEATURE_NOT_AVAILABLEWhatsApp is not turned on for your organization.
403paid_usage_disabledThe plan's included messages are used up and paid usage is off.
404whatsapp_number_not_foundNo number with this phone number is connected in the key's project.
404whatsapp_sender_removedThe sender was removed. Connect the number again to send from it.
404whatsapp_template_not_foundNo template with this ID exists for the sender's WhatsApp Business Account.
409whatsapp_idempotency_key_reusedThe key was already used for a different message.
422whatsapp_number_not_readyThe number is not connected, or WhatsApp is limiting or blocking it. Check the sender's page.
422whatsapp_template_not_approvedThe template, or its latest edit, is not approved, or it was deleted in WhatsApp.
422whatsapp_template_not_supportedThe template has content Nexiom Connect can't send yet, such as a media header. The message explains which.
422whatsapp_message_rejectedWhatsApp refused the message; message includes WhatsApp's reason. The message is stored as failed.
422whatsapp_provider_unavailableWhatsApp is busy. The message is stored as failed; retry later with a new key.
429api_rate_limit_per_second_exceededYour organization sent more requests per second than its plan allows.
429api_key_authentication_rate_limitedToo many requests with invalid API keys from your network.
429included_usage_exhaustedThe plan's included messages are used up, and the plan has no paid messages.
429usage_spend_limit_exceededThe message would go past your spending limit.
429wallet_balance_insufficientThe wallet cannot cover a message beyond the included ones.
429service_not_in_planYour plan doesn't include WhatsApp messages.

A 422 stored as failed keeps its idempotency key: retrying with the same key returns that failed message instead of sending again.

Nexiom Connect
Open dashboard