Sequential fallbacks in bat/messagelist
Fallbacks are backup channels for one message. The main message is sent first. If it is not delivered or its waiting time runs out, the next channel in the list is sent, and so on until the first successful delivery.
Setting up the chain
The channel order is set by the fallbacks array inside the message. Every fallbacks element is a separate message with its own from, to, type, ttl and content.
{
"callbackUrl": "https://example.com/smsbat/status",
"messages": [
{
"from": "WABA_PHONE",
"to": "RECIPIENT_PHONE",
"type": "whatsapp",
"ttl": 60,
"whatsAppMessage": { "type": "text", "text": "Your order is ready." },
"fallbacks": [
{
"from": "ALPHA_NAME",
"to": "RECIPIENT_PHONE",
"type": "viber_trans",
"ttl": 30,
"text": "Viber fallback"
},
{
"from": "ALPHA_NAME",
"to": "RECIPIENT_PHONE",
"type": "sms",
"ttl": 30,
"text": "SMS fallback"
}
]
}
]
}
The order here is WhatsApp → Viber Business → SMS.
ttl of each step
ttl sets the delivery waiting time of each step, in seconds. If the message is not delivered within that time, the system moves on to the next channel. Set the ttl of the main message and of every fallback according to how long you are ready to wait at each step.
Sender for each channel
| Channel | type | What to pass in from |
|---|---|---|
whatsapp | WhatsApp Business number. | |
| Viber Business | viber_trans, viber_promo, viber_carousel and so on | The approved alpha name. |
| SMS | sms | An alpha name allowed for your organization. |
WhatsApp in the chain
A regular WhatsApp message (text, media and so on) needs the 24-hour session window after the customer’s last incoming message, even when WhatsApp is a fallback step. Without a session window, use an approved template. See WhatsApp via bat/messagelist.
Example: Viber → WhatsApp → SMS
{
"callbackUrl": "https://example.com/smsbat/status",
"messages": [
{
"from": "ALPHA_NAME",
"to": "RECIPIENT_PHONE",
"type": "viber_trans",
"ttl": 60,
"text": "Viber message",
"fallbacks": [
{
"from": "WABA_PHONE",
"to": "RECIPIENT_PHONE",
"type": "whatsapp",
"ttl": 30,
"whatsAppMessage": { "type": "text", "text": "Your order is ready." }
},
{
"from": "ALPHA_NAME",
"to": "RECIPIENT_PHONE",
"type": "sms",
"ttl": 30,
"text": "SMS fallback"
}
]
}
]
}
If there is no session window at the time of the WhatsApp step, replace whatsAppMessage with an approved template.
What the callback reports
A message with a chain produces one final delivery callback:
deliverystatusis the result of the whole chain.fallbackslists the fallback channels that were actually sent, in the order tried. For example["sms"]when the SMS step delivered,[]when the main channel delivered.partscountand the billing fields refer to the channel that delivered the message.- The reason the previous channel failed is not reported when a later step delivered the message.
| Scenario | Callbacks |
|---|---|
| Viber failed, SMS delivered | 1: delivered, fallbacks: ["sms"], extendedStatuses: [] |
| Viber failed, SMS failed | 1: undeliverable, extendedStatuses: [] |
Ready-made requests for both chains are in the Postman collection, folder “Приклади fallback” (fallback examples).