WhatsApp one-time codes
Your server can ask the API to send a 6-digit code to a customer’s WhatsApp, then check the code the customer types. A typical use: a customer opens “Check order status” on your website from a device you have not seen before.
- Secret key only. Call these endpoints from your server. Publishable keys get
403 secret_key_required. - Codes are sent from the ALWS WhatsApp number (+91 78001 42555, shown as “Alws”) using an approved WhatsApp template.
- Indian mobile numbers only: 10 digits, optionally with
+91,91or a leading0. - A code is valid for 5 minutes and works once. After 5 wrong tries it is locked; request a new code.
- At most 3 codes per phone number per 15 minutes, per restaurant.
- ALWS stores only a fingerprint (hash) of each code.
Send a code
Section titled “Send a code”POST /otp/send · secret key
{ "phone": "+91 98765 43210", "purpose": "order_status" }purpose is optional; order_status is the only value today.
Response 200:
{ "otpId": "-OD1x7Qm2Lk9", "expiresInSeconds": 300, "channel": "whatsapp" }Errors: 400 invalid_request (phone missing or shorter than 6 characters), 422 invalid_phone, 429 otp_rate_limited (with Retry-After), 502 otp_send_failed (WhatsApp did not accept the
message, for example the number is not on WhatsApp).
Check a code
Section titled “Check a code”POST /otp/verify · secret key
{ "otpId": "-OD1x7Qm2Lk9", "code": "482915" }Response 200:
{ "verified": true, "phone": "9876543210" }phone is the 10-digit number the code was sent to. Errors: 422 otp_invalid (with details.attemptsLeft),
422 otp_expired (expired, already used, or not found), 429 otp_too_many_attempts.
After a successful check, your server decides what to show, for example only the orders placed with that phone number. Keep the result in your own short-lived, HttpOnly session so the customer is not asked for a new code on every page.
