Startup India · DPIITNVIDIA Inception
WabotOpen app

Send OTP codes on WhatsApp

Many people check WhatsApp before SMS, which makes it a natural channel for login codes. There are two ways to send them, and the right one depends on how many you send.

  1. 1User asks for a code
  2. 2Your server creates the OTP
  3. 3Wabot API sends it on WhatsApp
  4. 4User types the code

Ways to send an OTP

SMSOfficial WhatsApp APIWabot
Setup in IndiaDLT sender and template registrationMeta business verification and an approved templateLink your number with a QR scan
CostPer SMSPer authentication messageNo per-message fee
Copy-code buttonNoYesNo
Sent fromA registered sender IDYour verified business numberYour own WhatsApp number
Best forUsers without WhatsAppHigh-volume logins and paymentsLow-volume codes, internal tools, testing

Send an OTP from Python

Create a random six-digit code, store it with an expiry, and send it with one call to the Wabot API.

import secrets, time, requests

API_KEY = "YOUR_KEY"
MY_NUMBER = "919812345678"
codes = {}  # phone -> (code, expires_at); use your database in production

def send_otp(phone):
    code = f"{secrets.randbelow(1_000_000):06d}"
    codes[phone] = (code, time.time() + 600)
    requests.post(
        "https://api.wabot.online/send",
        headers={"X-API-Key": API_KEY},
        json={"number": MY_NUMBER, "to": phone, "isGroup": "N",
              "message": f"{code} is your Acme login code. It expires in 10 minutes. Do not share it."},
        timeout=30,
    ).raise_for_status()

def check_otp(phone, entered):
    code, expires = codes.pop(phone, (None, 0))  # single use
    return code == entered and time.time() < expires

Start a 7-day free trial and send your first code in minutes.

Start free trial

OTP message templates

  • Login code

    [code] is your [App] login code. It expires in 10 minutes. Don’t share it with anyone.

  • Verify your number

    Your [App] verification code is [code]. If you didn’t ask for it, ignore this message.

  • Confirm an action

    Use [code] to confirm [action] on [App]. [App] will never call you to ask for this code.

When to use the official API instead

Wabot sends from a regular WhatsApp number, so WhatsApp’s normal limits and spam checks apply. If you send thousands of codes a day, or codes that approve payments, use WhatsApp’s official authentication templates, which are built for that volume and add a copy-code button.

Send your first OTP today

Link a number, copy your API key and send codes from your own WhatsApp. 7-day free trial, no card.

7-day free trial · No card · Your own WhatsApp number

Frequently asked questions

Can I send OTPs on WhatsApp for free?

Free for 7 days during the trial, which sends up to 1,000 messages a day per number. After that, Wabot has no per-message fee on any plan.

Is it OK to send OTPs from a normal WhatsApp number?

Sending codes that people asked for is normal messaging. At high volume it can trigger WhatsApp’s spam limits, so use the official API for large-scale logins.

How long should an OTP last?

Five to ten minutes is common. Make each code single-use and limit wrong attempts.

More from Wabot