How to Switch Your OTPs from SMS to WhatsApp for Real Cost Savings

·6 min read
How to Switch Your OTPs from SMS to WhatsApp for Real Cost Savings

Yes, switching your OTPs from SMS to WhatsApp will save you money, often cutting your authentication bill by 40% to 60% in Pakistan and India. But you cannot completely turn off SMS because your delivery rates will tank if you do not keep a fallback route for users without active mobile data.

To understand why the savings are so significant, you have to look at how international telecom routing works. If your app servers are hosted on cloud platforms like AWS, Google Cloud, or DigitalOcean outside your target country, your SMS gateway likely routes messages through international carriers. These carriers charge premium "international-to-local" rates to deliver SMS to networks like Jazz, Telenor, Jio, or Airtel. You might think you are paying local rates, but you are often paying between 3.00 PKR and 15.00 PKR per SMS in Pakistan, or up to 4.00 INR in India.

Even if you use a local SMS aggregator with direct operator connections, you are still billed for every single message you attempt to send. If a user clicks "Resend OTP" four times because of a local network delay, you pay for all four messages. WhatsApp does not work this way. Meta charges for WhatsApp Business API messages on a 24-hour conversation model. When you send an OTP, you open an "Authentication" conversation window.

In India, an authentication conversation costs about 0.11 INR. In Pakistan, it is about 2.45 PKR. You can check the current, exact regional rates directly on the official Meta Developer pricing sheet. Inside that 24-hour window, you can send multiple OTPs to that same user for no extra charge. If your user struggles to log in and requests three codes within ten minutes, you only pay for the very first message that opened the conversation.

How to Set Up Your WhatsApp OTP Flow Step-by-Step

Migrating your authentication flow requires changes to both your backend database logic and your frontend user interface. Do not just swap your SMS API endpoint for a WhatsApp API endpoint. You need a structured, dual-channel approach.

Step 1: Set Up Meta Business Manager Verification

You cannot send official OTPs using unofficial "web-scraped" WhatsApp APIs or personal WhatsApp Business accounts. Unofficial gateways get blocked by Meta's spam filters within hours, and your registration flow will break. You must use the official WhatsApp Cloud API.

  • Go to your Meta Business Suite and set up a Business Manager account.
  • Submit your official business registration documents, such as your NTN in Pakistan or GST registration in India, to verify your business.
  • Link a dedicated phone number to your WhatsApp Business API account. This number must not be active on any personal WhatsApp app.

Step 2: Register Your Authentication Template

Meta enforces strict guidelines on what an authentication message can look like. You cannot include marketing text, emojis, or custom links. If you try to write "Your code is 4431. Check out our new winter collection!", the automated review system will reject your template instantly.

Your template must use the official AUTHENTICATION category. It should use Meta's pre-configured button structures, which support either a copy-code button or a one-tap autofill button for Android devices. The template payload looks like this in your API request:

{
  "category": "AUTHENTICATION",
  "name": "otp_template",
  "language": { "code": "en_US" },
  "components": [
    {
      "type": "BODY",
      "add_security_recommendation": true
    },
    {
      "type": "BUTTONS",
      "buttons": [
        {
          "type": "OTP",
          "otp_type": "COPY_CODE"
        }
      ]
    }
  ]
}

Step 3: Build the Fallback Routing Logic

This is where most developers fail. If you build a WhatsApp-only authentication system, your user acquisition will drop. Some users do not have WhatsApp installed, some have run out of mobile data packages, and others are in areas with poor internet coverage where only basic cellular signals work.

Your backend registration endpoint must use this sequence:

  1. The user inputs their mobile number on your app or website.
  2. Your server sends a POST request to the WhatsApp Cloud API to deliver the OTP.
  3. Your server starts a 25-second countdown timer.
  4. Your system listens for webhooks from Meta. If you receive a delivered status webhook within those 25 seconds, you do nothing.
  5. If the timer hits zero and you have not received a delivered status, or if the API returns an error code (such as error 131026 for non-WhatsApp users), your backend must automatically trigger your traditional SMS gateway.

Step 4: Connect the Integration Middleware

If you want to avoid managing raw JSON payloads, configuring webhook listeners, and handling retries yourself, you can use WA Link as an API middleware. It simplifies the connection to Meta's Cloud API and provides a clean dashboard to monitor delivery statuses. However, keep in mind that WA Link does not provide the underlying WhatsApp phone number, and it cannot bypass Meta's business verification requirements. You must still complete the Meta Business Manager setup yourself.

What Goes Wrong and How to Fix It

We have deployed this system for high-volume platforms. Things will go wrong during production. Here is what to watch out for and how to handle it.

The "No Internet" Delivery Loop

If a user has their mobile data turned off, Meta will accept your API request and return a sent status, but the message will not reach the user's phone. If your frontend UI just shows a generic spinner, the user will get frustrated and close your app.

How to fix it: Do not rely on the sent status. Your backend must listen specifically for the delivered status webhook. On the frontend, show a clear "Send via SMS" button that becomes active after 20 seconds. If the user clicks it, trigger the SMS gateway immediately and stop waiting for the WhatsApp webhook.

The Brand-New Number Spam Block

If you register a new phone number on the WhatsApp Business API and immediately send 10,000 OTPs on the first day, Meta's automated security systems will flag your account for suspicious activity. Your quality rating will drop, and your template privileges may be suspended.

How to fix it: Warm up your phone number over two weeks. Start by routing only 10% of your login traffic through WhatsApp. Route the remaining 90% through your traditional SMS gateway. Increase your WhatsApp traffic share to 30% in week two, 60% in week three, and 100% (with SMS fallback) by week four.

DLT and Regulatory Hurdles in India and Pakistan

In India, the Telecom Regulatory Authority (TRAI) enforces strict Distributed Ledger Technology (DLT) rules. You must register your entity, your headers, and your SMS templates on portals like Jio or Vilpower. In Pakistan, the PTA requires alphanumeric sender ID registration, which takes weeks of paperwork.

How to fix it: Use WhatsApp to bypass this bureaucracy for your primary login flow. WhatsApp templates do not require local DLT registration or PTA approval. You only need to comply with Meta's global policies. Keep your SMS gateway active as a fallback, but since its volume will drop by 70%, your operational overhead for managing DLT templates will decrease significantly.

SMS vs WhatsApp OTP Comparison

This table compares the real operational costs and performance of both channels when running in India and Pakistan.

FeatureTraditional SMS GatewayWhatsApp Business API
Cost StructurePay per message sent, regardless of whether it reaches the handset.Pay per 24-hour conversation window. Multiple OTPs inside the window are free.
Average Cost (India)0.12 INR to 4.00 INR (depending on domestic vs international routing).About 0.11 INR per 24-hour conversation.
Average Cost (Pakistan)0.50 PKR to 5.00 PKR (depending on local gateway vs international routes).About 2.45 PKR per 24-hour conversation.
Delivery TrackingUnreliable. Operators often return fake "delivered" receipts.Highly accurate. Real-time webhooks for sent, delivered, and read status.
User ExperienceRequires the user to manually open their inbox and copy a 6-digit code.Supports native "Copy Code" buttons and one-tap autofill.
Fallback RequirementNone. Works on any basic GSM phone without internet.Mandatory. Requires an SMS fallback for users without data connections.

Your Next Steps to Start Saving

Do not try to move your entire user base over to WhatsApp overnight. Start by modifying your backend login endpoint to support dual routing, then run a small pilot. Route exactly 10% of your traffic through the WhatsApp API next Tuesday, watch your database logs for delivery success times, and adjust your fallback timeout based on actual user behavior before scaling up.

See plans and pricing