Skip to navigation

Send a message

Sends an outgoing message to a conversation, a contact, or a phone number. The API creates the contact and the conversation when they do not exist. Before it accepts plain content, the API checks the service window of the conversation. A 201 means that the API saved the message and put it in the delivery queue. It does not mean that the channel delivered it.

Authentication

api_access_tokenstring

An API key that an administrator creates in Settings > Developer. The personal access token of a user does not work. A key reaches every inbox, conversation, and contact in the account that created it, and nothing in other accounts.

Path parameters

account_idintegerRequired

The id of your account. It is the number after /accounts/ in the dashboard URL.

Request

This endpoint expects an object.
conversation_idintegerOptional

The conversation number in the dashboard URL (display_id). The conversation gives the inbox, so inbox_id is not necessary.

contact_idintegerOptional

The id of a contact. The API uses the most recent conversation of the contact on inbox_id with a status other than resolved, or it opens a new conversation. The contact must have an address that the channel can reach. If it has none, the API returns contact_not_messageable.

phone_numberstringOptionalformat: "^\+[1-9]\d{1,14}$"

A phone number in E.164 format, for example +971500000000. The API creates the contact if it does not exist. Only WhatsApp, Twilio, and SMS inboxes accept a phone number.

inbox_idintegerOptional

The inbox that sends the message. Necessary if the request has no conversation_id.

contentstringOptional

The text of the message. Optional when template_params is present on a WhatsApp inbox: the API then makes the text from the body of the approved template. A Twilio inbox always needs content.

template_paramsobjectOptional

Sends an approved WhatsApp template instead of free text. A template is necessary to start a conversation on WhatsApp, or to send after the 24-hour service window closes. When this field is present, the API does not check the service window on any channel. Send it only on an inbox that has approved templates.

contactobjectOptional

The fields of a new contact. The API reads them only with phone_number, and only when no contact has that number.

Response

The API saved the message and put it in the delivery queue.
idintegerOptional
The id of the message.
conversation_idintegerOptional

The conversation number in the dashboard URL (display_id).

contact_idintegerOptional
The id of the contact.
inbox_idintegerOptional
The id of the inbox.
statusenumOptional

The delivery status at the time of the response. A new message is sent. The dashboard shows the later status.

Allowed values:
contentstringOptional
The text of the message.
created_atintegerOptional
The time of the message, as a Unix timestamp in seconds.

Errors

401
Unauthorized Error
404
Not Found Error
422
Unprocessable Entity Error