Dev.to AI πŸ€– Ai πŸ‘ 0 πŸ“– 4 min read

Which OTP Channel for Which Country? A Routing Guide with Code (WhatsApp, Telegram, Email, SMS)

"Just send an SMS" used to be the whole answer to phone verification. Today you can send a code over WhatsApp, Telegram, email or SMS, and the best choice depends on the country your user is in. In this guide we'll compa

"Just send an SMS" used to be the whole answer to phone verification. Today you can send a code over WhatsApp, Telegram, email or SMS, and the best choice depends on the country your user is in. In this guide we'll compare the channels, then build a small routing function in Node.js that picks the channel per country and falls back automatically.

I'm the maker of Authly, which sends OTPs over WhatsApp, Telegram and Email, so I'll use it for the examples. The thinking applies to any provider.

The channels at a glance

Channel Reaches Strengths Watch out for
WhatsApp Users who have WhatsApp Very widely used in many markets (India, Brazil, much of Latin America, the Middle East and Africa), good open rates Recipient must have WhatsApp, message rules apply, price varies by country
Telegram Users who have Telegram Simple, flat pricing at Authly ($0.015 per OTP) Smaller audience in some markets
Email Anyone with an inbox Cheap, works worldwide Slower, can land in spam, not a "phone" verification
SMS Almost any phone Widest reach Higher cost in many countries, carrier filtering, sender registration, the main target of SMS pumping fraud

Authly doesn't send SMS. If you need SMS as a last resort for users with none of the other channels, use a separate SMS provider for that case.

Step 1: look at where your users are

Before you pick anything, list your top 10 countries by signups and the volume of OTPs you send to each. A country mix of 70% India and 30% US has very different needs from one that's mostly Europe.

Step 2: check the price per country

Prices per delivered WhatsApp OTP on Authly's pricing page at the time of writing:

Region Rate
India $0.008
US and Canada $0.012
Pakistan $0.020
Middle East $0.034
UK $0.045
Europe $0.070

Telegram is a flat $0.015 per OTP everywhere. Always check the current rates for your own countries.

Step 3: define routes

A route is a primary channel plus a fallback. Put them in a lookup keyed by country calling code:

// routes.js
export const ROUTES = {
  "+91":  { channel: "whatsapp", fallbackChannel: "telegram" }, // India
  "+92":  { channel: "whatsapp", fallbackChannel: "telegram" }, // Pakistan
  "+971": { channel: "whatsapp", fallbackChannel: "telegram" }, // UAE
  "+44":  { channel: "whatsapp", fallbackChannel: "telegram" }, // UK
  "+1":   { channel: "whatsapp", fallbackChannel: "telegram" }, // US and Canada
};

export const DEFAULT_ROUTE = { channel: "whatsapp", fallbackChannel: "telegram" };

export function routeFor(phone) {
  // Longest matching prefix wins (so "+971" beats "+9")
  const prefix = Object.keys(ROUTES)
    .filter((p) => phone.startsWith(p))
    .sort((a, b) => b.length - a.length)[0];
  return prefix ? ROUTES[prefix] : DEFAULT_ROUTE;
}

Here every country starts with WhatsApp and falls back to Telegram. Later you'll change individual entries based on data. For example, if your numbers show that WhatsApp performs poorly for one country, you can move that country to a different primary channel.

Step 4: use the route when sending

import Authly from "authly-otp";
import { routeFor } from "./routes.js";

const authly = new Authly(process.env.AUTHLY_API_KEY);

export async function sendCode(phone) {
  const route = routeFor(phone);
  const { otpId } = await authly.otp.send({
    to: phone,
    ...route,
    lang: "en",
  });
  return { otpId, route };
}

Step 5: estimate cost before you commit

A small calculator helps you compare route choices with your own numbers:

// Rates per delivered WhatsApp OTP, from the pricing page (check current rates)
const WHATSAPP_RATES = { "+91": 0.008, "+1": 0.012, "+92": 0.02, "+971": 0.034, "+44": 0.045 };

export function monthlyCost(volumes) {
  // volumes example: { "+91": 5000, "+1": 3000, "+92": 2000 }
  let total = 0;
  for (const [prefix, count] of Object.entries(volumes)) {
    total += count * (WHATSAPP_RATES[prefix] ?? 0);
  }
  return Number(total.toFixed(2));
}

console.log(monthlyCost({ "+91": 5000, "+1": 3000, "+92": 2000 })); // 116

(5,000 Γ— $0.008 + 3,000 Γ— $0.012 + 2,000 Γ— $0.020 = $116.)

Step 6: measure, then adjust

Routing is a guess until you measure it. Log every send and every verification, with the country and channel:

// pseudo-code: write these events to your database or analytics
track("otp_sent",     { country, channel: route.channel });
track("otp_verified", { country, channel: route.channel });

Then look at the send-to-verify ratio per country and channel. If a country's ratio is much lower than the rest, check the phone-number formatting, the channel, and whether the traffic is real or abuse (see my post on SMS pumping). Change that country's route and compare again after a week.

Step 7: give users a way out

Even a good route fails for some people, for example someone without WhatsApp. In your UI, add a visible option next to the resend button:

  • "Send by Telegram"
  • "Send by email"
  • "Change number"

A manual choice covers the cases that automation misses.

Checklist

  • [ ] Know your top 10 countries and their volumes
  • [ ] Check the price per channel for each country
  • [ ] Define a route (primary plus fallback) per country, with a default
  • [ ] Estimate monthly cost with real volumes
  • [ ] Log sends and verifications by country and channel
  • [ ] Review the send-to-verify ratio weekly and adjust routes
  • [ ] Offer a manual channel choice in the UI
  • [ ] Keep an SMS provider as a last resort only if your market needs it

Wrapping up

There's no single best OTP channel. The right answer depends on where your users are, what each channel costs there, and how they actually behave, so start with a sensible default, measure, and adjust per country.

I'm the maker of Authly, and the docs show how to send over each channel with the SDK. Which countries are hardest for your OTP delivery? Tell me in the comments, and I'll cover the most common ones in a follow-up.

πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.