SMS engineering

SMS to WhatsApp Failover: Building Multi-Channel Fallback

How to send on one channel and fall back to another when a message is not delivered: timeouts, delivery reports, avoiding duplicates, OTP invalidation, and cost control.

Updated · 3 min read

No single channel reaches every user every time. SMS fails when a phone is off or a route is congested; WhatsApp fails when a user has no data or no app. Fallback means you send on a primary channel, watch what happens, and use a second channel only when the first does not deliver. Done well, it recovers users without spamming them.

The basic logic

  1. Send the message on the primary channel.
  2. Wait for a delivery report, up to a timeout that suits the message type.
  3. If the message is delivered, stop.
  4. If it fails, or no delivery report arrives before the timeout, send on the secondary channel.
  5. Record which channel succeeded.

Choose the primary channel per message type

MessagePrimaryFallbackTimeout
Login or payment OTPSMSWhatsApp10–20 seconds, or when the user taps "Didn't get it?"
Order confirmation with buttonsWhatsAppSMSA few minutes
Delivery updateUser's preferred channelThe otherSeveral minutes
Security alertSMSWhatsApp1–2 minutes

SMS-first fits critical messages because it reaches every phone. WhatsApp-first fits messages that need a reply. See SMS vs WhatsApp in Egypt.

Fallback for OTPs

Codes need special care:

  • Generate a new code for the fallback message and invalidate the old one. Two valid codes on two channels doubles the attack surface.
  • Tell the user where the new code went: "We sent a new code to your WhatsApp."
  • Let the user trigger fallback with a clear option, not only automatically. See designing the OTP resend flow.

Avoid double messages

The biggest risk is that both channels deliver, and the user gets the same message twice. To limit it:

  • Use timeouts that match real delivery times on the primary channel, measured per country. Too short and you fall back unnecessarily.
  • Treat a late delivered report after fallback as information, not as a reason to send again.
  • For non-urgent messages, use longer timeouts.

Delivery reports are the trigger

Fallback depends on accurate, timely delivery reports. If a route returns reports late or not at all, your fallback either fires too often or never. Measure report latency per route, and handle webhooks idempotently. See SMS delivery reports and SMS webhooks.

  • Use WhatsApp as a fallback only for users who opted in to WhatsApp messages. See WhatsApp opt-in.
  • Outside the 24-hour window, WhatsApp fallback needs an approved template. See the 24-hour window.
  • Respect promotional time windows if the message is marketing.

Measure the value

Track how many messages were delivered only because of fallback, by country and channel, and what they cost. In markets with uneven SMS delivery, fallback often recovers a meaningful share of OTPs that would otherwise have been lost.