Send message
Send one body to up to 1,000 numbers, now.
SMS by default. WhatsApp carries an approved template and nothing else:
name one from GET /v1/messages/templates and fill its placeholders in
order.
Instagram sends one message to one person who wrote first: to is
their Instagram-scoped id, from GET /v1/conversations?channel=instagram.
Every type goes the same way and answers {status, channel, messages}. A test key is refused with not_configured.
Send an Idempotency-Key. Without one, each request is a new send, so a
retry after a timeout may send and charge twice.
Send from and content, or the older body, sender_id and
template. Both make the same send; one request in both is refused.
A 503 provider_unavailable does not prove the messages were not sent.
Look for them before sending again.
Idempotency-Key?stringA fresh value per request; retry with the same one. The same key and
request answers with the first response and Idempotency-Replayed: true; the same key on a different request is 409 idempotency_key_reused; while the first is still running, 409 idempotency_in_progress. A 5xx frees the key only when nothing
reached the provider; any other answer is replayed. Kept 24 hours,
per workspace.
1 <= length <= 255X-Request-Id?stringYour id for this request; it becomes the request_id of any error. Without it the server makes one.
application/json- body
The unified form is flat: {channel, from, to, type, text | template}, the same on
/v1, /api/v1 and /api/v2. from and content, or the older body, sender_id
and template, still work, never mixed. SMS needs a sender ID and text; WhatsApp needs a template.
Instagram takes one to, from only when the workspace has several accounts, and the
types and fields below that describes.
to?array<string>items <= 1000from?stringThe sender ID, for SMS; must be approved for the workspace.
content?text for SMS, template for WhatsApp.
body?stringThe text, for SMS. The older shape of content.
sender_id?stringFor SMS; must be approved for the workspace. The older shape of from.
channel?stringA channel from GET /v1/channels.
"sms""sms""whatsapp""instagram"type*stringThe unified form's kind of content. Instagram takes text, quick_replies, image, video, audio, file, reaction and cards.
"text""template""quick_replies""image""video""audio""file""reaction""cards"text?stringThe text, when type is text or quick_replies. Instagram: 1 to 1000 bytes.
url?stringInstagram image, video, audio or file: an https link, up to 2048 bytes.
urimessage_id?stringInstagram reaction: the message reacted to.
emoji?stringInstagram reaction: the reaction; empty takes it away.
quick_replies?array<>Instagram, with text: up to 13 buttons. Also taken on type: text.
items <= 13cards?array<>Instagram cards: 1 to 10.
1 <= items <= 10template?|For WhatsApp, a name from GET /v1/messages/templates; in the unified form, {name, language, params}.
template_language?stringIgnored; the language is the one the operator set up.
template_params?array<string>Fill the template's placeholders in the order it declares them.
curl -X POST 'https://v3.ghala.io/v1/messages' \ -H 'Content-Type: application/json' \ -d '{ "to": [ "0712345678", "+255 713 000 000" ]}'{ "job_id": "string", "status": "queued", "messages": [ { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "phone": "string", "body": "string", "content": { "type": "text", "text": "string" }, "parts": 0, "sender_id": "string", "from": "string", "channel": "sms", "campaign_id": "78614b6c-fe7c-41e2-8e25-c9b3a3c91904", "run_id": "dded282c-8ebd-44cf-8ba5-9a234973d1ec", "provider_message_id": "string", "request_id": "string", "status": "queued", "error": "string", "failure_reason": "rejected", "price_minor": 0, "submitted_at": "2019-08-24T14:15:22Z", "delivered_at": "2019-08-24T14:15:22Z", "read_at": "2019-08-24T14:15:22Z", "failed_at": "2019-08-24T14:15:22Z", "created_at": "2019-08-24T14:15:22Z", "test": true } ], "invalid": [ "string" ], "suppressed": [ "string" ], "parts": 0, "charged_minor": 0}