Skip to content
Guide

Sending verification codes (OTP) over WhatsApp

How authentication templates work, what the copy-code and one-tap buttons do, and the security basics for one-time codes.

24msg team · Published

A verification flow in four steps
  1. The user asks for a code

  2. Your server creates a code and sends the template

  3. The user copies it or taps autofill

  4. Your server checks the code and expiry

The authentication template

Authentication is its own template category and exists only for one-time codes. Meta provides a standard layout with the code, an optional security note and an optional expiry line. Links and media are not allowed, which keeps the message simple to trust.

Copy code and one-tap autofill

The copy-code button puts the digits on the clipboard in one tap and works for any app or website. One-tap autofill fills the code straight into your app, but it needs an integration in your Android app. Choose the button that matches where the user signs in.

Security basics

Create codes with a secure random generator and keep them valid for only a few minutes. Allow each code once, limit attempts, and rate-limit how often a number can request a new one. Do not write codes to logs, do not reveal whether an account exists, and never ask users to send the code back in a chat.

Delivery, fallbacks and cost

Track delivery status and offer a resend after a short cooldown, with SMS or a voice call as a fallback for people who are not on WhatsApp or have no data. Meta prices authentication messages per message and by market, so estimate your volumes before launch.

Key points

  • Use the authentication category; Meta fixes the layout.
  • Pick copy code for any channel, one-tap autofill for your Android app.
  • Short expiry, single use, attempt limits and a fallback channel.

WhatsApp rules and limits are set by Meta and can change. This article reflects them as of its publication date.

Keep reading

All articles