Skip to content

WhatsApp OTP API

The EmacronAI CRM OTP API lets you send one-time passwords via WhatsApp and verify them server-side. Delivery and cost depend on your selected package, destination, account configuration, approved template, and provider terms. Review current package pricing before enabling OTP.

For separate projects, create a WhatsApp OTP-only key in Settings → API Keys and assign an approved Copy Code template. The key uses that assignment for every send, delivers over WhatsApp only, and verifies requests from its own project. Use a key with whatsapp:otp, or an existing key with whatsapp:send for the legacy flow. Keep the key on your server. When you rotate it, use the replacement key to verify any outstanding requests.

See pricing

Current price

Depends on package, destination, and provider terms

Provider reported

Delivery status

Varies with sender, recipient, and account conditions

10 minutes

OTP expiry

Fixed per request

Meta billing: Standard WhatsApp OTPs use an AUTHENTICATION template. Meta bills these separately at the destination market's current authentication rate; the monthly service-message allowance does not cover them. OTPless is different: the user sends an inbound pre-filled message, then the business sends a service reply. From October 1, 2026, each business phone number has 1,000 delivered service messages per month included; additional service replies may be charged to the connected Meta account. Emacron Lead Finder credits are not used.

Authentication

All requests require a Bearer token. Get your API key from Settings → API Keys in your dashboard.

Authorization: Bearer YOUR_API_KEY

Send & verify OTP

Two API calls: send, then verify.

import { createClient } from '@emacrontechnologies/outreachagent';
// npm install @emacrontechnologies/outreachagent

const oa = createClient(process.env.OUTREACHAGENT_API_KEY);

// 1. Send OTP
const { request_id } = await oa.otp.send({
  phone: '+919876543210',
  context: 'login',
});

// 2. Verify OTP (after user enters it)
try {
  const { valid } = await oa.otp.verify(request_id, userEnteredOtp);
  if (valid) console.log('Phone verified ✅');
} catch (error) {
  // A wrong or expired code is an HTTP 400 error, not a resolved false result.
  if (error.status === 400) console.log('Invalid or expired OTP ❌');
  else throw error;
}

Install: npm install @emacrontechnologies/outreachagent

Endpoint reference

POST/whatsapp/otp/send

By default, Emacron generates, sends, and later verifies a six-digit code. Your backend supplies the phone number and keeps the returned request_id bound to its application session. For a code generated securely by your backend, set code_source: "client" and provide code; Emacron sends and verifies that code over WhatsApp. Client mode has no SMS fallback. Provider acceptance does not confirm delivery.

Request body

FieldTypeRequiredDescription
phonestringYesE.164 format. Example: +919876543210
phone_number_idstringNoProject keys use the assigned sender. If supplied, this ID must match. Legacy callers can choose a connected sender.
contextstringNoPurpose label, such as login or signup.
code_sourcestringNoplatform (default) or client. Client mode requires code and uses WhatsApp only.
codestringClient mode4–15 ASCII letters or digits generated securely by your backend. Never send from browser code.
POST/whatsapp/otp/verify

Verify an OTP. Success returns HTTP 200 with valid: true. An invalid code returns HTTP 400 with valid: false; SDK clients throw on that response.

Request body

FieldTypeRequiredDescription
request_idstringYesThe request_id returned by /whatsapp/otp/send
codestringYesThe OTP entered by the user

Error codes

HTTPcodeDescription
400VALIDATION_ERRORMissing or invalid field (e.g. phone not in E.164 format)
401UNAUTHORIZEDMissing or invalid API key
422INVALID_OTPOTP does not match or has expired
429RATE_LIMIT_EXCEEDEDToo many OTP requests for this phone number. Wait 1 hour.
500INTERNAL_ERRORServer error. Retry with exponential backoff.

Rate limits

EndpointLimit
POST /whatsapp/otp/send5 per phone per workspace per 10 minutes
POST /whatsapp/otp/send1,000 per workspace per hour
Project OTP sends250 per project per hour, within the workspace limit
POST /whatsapp/otp/verify5 attempts per request_id
All API endpoints1,000 requests per hour per API key (workspace-configurable)

Node.js SDK

The official npm package wraps the REST API with full TypeScript types, auto-retry, and clean error handling.

npm install @emacrontechnologies/outreachagent

Downloads