💰 Service replies stop being free on 1 OctoberMore
1msg official logo

New device login OTP via WhatsApp API

The scenario sends the user a WhatsApp authentication template with a one-time verification code when a login attempt is flagged as coming from a new device.

Common errors

StatusAPI responseCauseFix
200Message was not sent: template is not definednamespace, template or language is missing from the request body.Send all three. Take namespace and the exact template name from GET /templates; language is an object: {"policy": "deterministic", "code": "en"}.
200template name (…) does not exist in <language>The template is approved in a different language than the one requested.Use the exact language code the template was approved in (for example es_MX is not the same as es). Check it in GET /templates.
200Message was not sent: provide chatId, phone, bsuid, or usernameNo recipient the channel could resolve.Pass exactly one recipient: phone (country code plus number, digits only), chatId (for example [email protected]) or bsuid.

All error codes →

Common questions

Related

OTP Verification
Migrate OTP from SMS to WhatsApp API
Delivers a one-time verification code through a WhatsApp authentication template when your product switches OTP delivery from SMS to WhatsApp.
OTP Verification
OTP to confirm secure actions via WhatsApp API
The scenario sends a WhatsApp authentication template with a one-time verification code when the user must confirm a secure action before it executes.
OTP Verification
Access verification code via WhatsApp API
Sends a one-time access confirmation code through a WhatsApp authentication template when the user must verify identity before using a protected service.
OTP Verification
Login authorization OTP via WhatsApp API
Sends a one-time authorization code through a WhatsApp authentication template when the user must confirm sign-in or access.
OTP Verification
New sign-in confirmation code via WhatsApp API
Sends a one-time login confirmation code through a WhatsApp authentication template when your backend detects a sign-in from a new device, browser, or location.
OTP Verification
Two-factor authentication (2FA) via WhatsApp API
The scenario sends a WhatsApp authentication template with a one-time verification code when two-factor authentication is required after primary login.
OTP Verification
Phone number verification code via WhatsApp API
Delivers a one-time code via WhatsApp authentication template when the user adds or changes a phone number.
OTP Verification
Password reset OTP via WhatsApp API
Sends a one-time recovery code through a WhatsApp authentication template when the user starts password reset.

Build for WhatsApp in hours
without infrastructure hassle