Channels

SMS

Text messages to any phone, under your approved sender ID.

What you can do

  • Send one text to up to 1,000 numbers in a single request.
  • Follow each message from sent to delivered or failed, by request or by webhook.
  • Try everything first with a test key, free, in the sandbox.

Before you start

An SMS goes out under a sender ID, the name people see it from. Request one in the dashboard under SMS, then Sender IDs. Once it is approved, it shows in your list:

curl https://v3.ghala.io/v1/sender-ids \
  -H "Authorization: Bearer $GHALA_KEY"

Each has a status, and access says whether it is yours (owned) or one Ghala shares (global). The examples below use ACME: put your own in its place.

Send

curl https://v3.ghala.io/v1/messages \
  -H "Authorization: Bearer $GHALA_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-1042-ready" \
  -d '{"channel": "sms", "from": "ACME", "to": ["0700000001", "+255 700 000 004"], "type": "text", "text": "Your order is ready"}'
POST/v1/messagesSend messagemessages:send
  • from is required, and must be a sender ID approved for your workspace.
  • to takes up to 1,000 numbers, written as people type them. A local number is read against your workspace's country, and messages come back with the number as country code and digits: 255712345678.
  • Numbers that will not parse come back in invalid. Numbers on your suppression list are skipped and come back in suppressed.
  • parts is how many SMS parts the text takes. A live send is charged per part, reserved from your wallet before it goes.

The older body still works and makes the same send: {"to": [...], "body": "...", "sender_id": "ACME"}. Use one shape or the other, not both.

Statuses

An SMS goes sent, then delivered or failed. SMS does not report read. See Message statuses.

Test mode

A test key checks your sender ID and numbers like a live send, then hands the message to the sandbox: free, and nothing reaches a phone. 255700000001 is always delivered and 255700000002 always fails. See Test mode.

When it fails

StatuscodeWhen
400missing_fieldno from. field is from
400invalid_addressnone of the numbers is a valid phone number. field is to
403sender_id_not_approvedyour workspace may not send as from
402insufficient_fundsa live send your wallet cannot cover; nothing was sent
502provider_rejectedthe network refused it; recorded as failed, not charged
503provider_unavailablethe network did not answer. It may still have been delivered: check the message's status before sending again

All endpoints

On this page