SMS fallback & priority
Make sure important messages get through. Zend can automatically fall back between SMS and WhatsApp when the first channel can't deliver, and lets you set queue priority and schedule sends — all on the same POST /messages request.
Automatic fallback
Fallback is driven by the order of preferred_channels. List the channels to try, in order: Zend sends on the first, and if it terminally fails, automatically advances to the next — reversing the first channel's charge so you're only ever billed for the channel that actually delivered.
curl -X POST https://api.tryzend.com/messages \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"to": "+233593152134",
"body": "Important notification: Your order has been shipped!",
"preferred_channels": ["sms", "whatsapp"],
"template_id": "tmpl_order_update"
}'
Here Zend tries SMS first; if it fails, it falls back to WhatsApp. The direction follows the array exactly — reverse it to ["whatsapp", "sms"] to try WhatsApp first and fall back to SMS. To turn fallback off, list a single channel.
Note
["sms","whatsapp"] is SMS→WhatsApp, ["whatsapp","sms"] is WhatsApp→SMS. There is no separate on/off flag — the presence of a second channel is what enables fallback.Warning
template_id (Meta requires business-initiated WhatsApp messages to use an approved template). Include one whenever whatsapp appears in preferred_channels. The SMS leg still uses your plain body (or the template's SMS variant).Request fields
sms and whatsapp. The first is tried first; any that follow are fallbacks. Defaults to ["sms"].whatsapp appears in preferred_channels.{ "1": "Ada", "2": "#1234" }.Note
channel_used when you check status. See SMS delivery & webhooks.Message priority
priority controls how quickly a message is picked up from the queue for processing. It is independent of channel selection.
{
"to": "+233593152134",
"body": "URGENT: System maintenance in 30 minutes",
"preferred_channels": ["sms"],
"priority": "urgent"
}
Levels, from lowest to highest: low, normal, high, urgent. Defaults to normal.
Scheduling
Set scheduled_for to an ISO 8601 timestamp to send a message at a specific time instead of immediately.
{
"to": "+233593152134",
"body": "Reminder: Your appointment is in 1 hour",
"preferred_channels": ["sms"],
"scheduled_for": "2024-01-15T13:00:00Z"
}
Request fields
low, normal, high, or urgent. Defaults to normal.Cost control
To keep a message on the cheapest channel only, list a single channel so it is never re-attempted on a pricier one:
{
"to": "+233593152134",
"body": "Your monthly statement is ready",
"preferred_channels": ["sms"]
}
Tips for keeping SMS costs down:
- List only
["sms"]for non-critical messages so they never fall back to a more expensive channel. - Keep messages under 160 characters — each additional part is billed at the full SMS rate.
- Reserve multi-channel fallback for messages that genuinely justify the extra cost, like OTPs.
Deprecated fields
Earlier versions of this API used two fields that are no longer needed:
fallback_enabled(boolean) — fallback is now controlled entirely by thepreferred_channelsorder, so this has no effect.delivery_priority(cost/speed/reliability) — channels are ordered bypreferred_channelsand pricing is fixed per channel, so this has no effect.
Both are still accepted for backward compatibility (they won't cause an error) but are ignored. You can safely remove them from your requests.
Next steps
- Send SMS — the basics: sending, sender IDs, and message limits.
- SMS delivery & webhooks — confirm which channel delivered and track final status.