Skip to main content

WhatsApp

The WhatsApp sending rules below are set by Meta.

You cannot send free text​

WhatsApp does not permit business-initiated free-text messages. Every message you send through the API is an approved template, referenced by name, with values filled into its placeholders.

Before you send:

  1. Connect a WhatsApp Business account in the Arsel Dashboard under WhatsApp > Setup, and top up your WhatsApp wallet.
  2. Create your templates under WhatsApp > Templates, or with the Templates API.
  3. Wait for Meta to approve each one. Approval is not instant and templates can be rejected. Get Template reports the current status.
  4. Send by template name.

Sending​

curl -X POST "https://api.arsel.sa/v1/whatsapp/send" \
-H "Authorization: Bearer $ARSEL_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: booking-5521-confirmation" \
-d '{
"to": "+966512345678",
"template_name": "booking_confirmation",
"language": "ar",
"parameters": { "booking_ref": "5521", "date": "12 March" }
}'

to is a single recipient in E.164 format, not an array.

Filling in parameters​

What belongs in parameters depends on the template's category:

CategoryWhat to pass
AUTHENTICATIONThe one-time code as code. If the template has a copy-code button, the value is repeated into it automatically, so pass it once.
UTILITYOne entry per {{placeholder}} in the template body, keyed by placeholder name.
MARKETINGSame as UTILITY, but subject to the recipient's marketing opt-out.
When language is required

If you omit language, Arsel resolves the template by name alone. If that name is approved in more than one language, the request returns 409 Conflict, so send the language code explicitly whenever a name exists in multiple languages.

Parameters are never readable back

parameters is absent from every response, because for an authentication template it holds the one-time code. If you need the code later, store it yourself.

Delivery status​

202 means the provider accepted the message, not that it arrived. Poll GET /whatsapp/:id:

StatusMeaning
queuedAccepted by Arsel, not yet handed to the provider
sentThe provider accepted it and returned a message ID
deliveredConfirmed delivered to the recipient's device
readThe recipient opened the message
failedSee failure_reason

read may never arrive, because recipients can disable read receipts. Use delivered as your success condition.

Billing​

Each message is charged at the rate for the destination country and template category. The charge is held when the message is accepted and settled from the delivery receipt. A message the provider rejects is not charged.

Reference​

Send WhatsApp · List · GetTransactional endpoints
TemplatesCreate, list, get, edit, delete