Use WhatsApp as an additional channel for one-time passwords and account verification where your users already have WhatsApp. Generate and check the code in your own backend, and send it with one REST call.
Discover the advantages of using WhatsApp as your communication channel
Send secure OTP codes for login verification, transaction approval, and sensitive account actions with automatic expiry.
Add an extra layer of security with WhatsApp-based 2FA that users prefer over traditional SMS verification.
Verify new user accounts during registration by sending confirmation codes directly to their WhatsApp number.
Confirm phone number ownership by sending verification codes through WhatsApp, ensuring the number is active and reachable.
WhatsApp encrypts messages between devices. Treat the code as sensitive anyway: keep it short-lived, single-use and never log it.
Messages usually arrive within seconds when the phone is online, but delivery is not guaranteed. Keep a fallback such as email or SMS for users who do not receive the code.
Get up and running in three simple steps
Generate a secure one-time password in your application backend and store it with an expiry time for validation.
Call our REST API to send the code to the user's WhatsApp number in a short, clear message.
When the user enters the code, validate it against your stored OTP, check it has not expired, and invalidate it after one use. Rate limit attempts and resends.
See how easy it is to implement with just a few lines of code
import { randomInt } from "node:crypto";
// Use a cryptographically secure random number, never Math.random(), for codes.
const otp = randomInt(100000, 1000000);
const response = await fetch(
"https://quackapi.com/v1/messages/chat",
{
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": "wa_your_api_key_here"
},
body: JSON.stringify({
deviceId: 1,
to: "923001234567",
body: `Your QuackAPI verification code is: ${otp}. This code expires in 5 minutes. Do not share this code.`
})
}
);
const result = await response.json();
console.log(result); // { success: true, messageId: 43, status: "queued" }Create your free QuackAPI account and start sending WhatsApp messages in minutes. No credit card required.