Chapter 1 · The scenario
Example: Web checkout for a Jaipur handicrafts store
A Jaipur handicrafts store verifies the phone number at web checkout. Because the customer is on a laptop browser, autofill into an app is not an option, so the store's template uses copy code with a 5-minute footer and a 5-minute time-to-live. The customer opens WhatsApp on their phone, taps "Copy code", and types the six digits into the checkout page — the store's UI says "Check WhatsApp on your phone" because linked desktop sessions show a prompt instead of the code. If no delivered status arrives within 20 seconds, the page offers an SMS code.
Chapter 2 · What is copy code authentication?
Copy code authentication is the simplest of the three ways an authentication template can deliver a one-time passcode on WhatsApp. The template is created with a button of type: OTP and otp_type: COPY_CODE. When the message arrives, the user sees Meta's preset text ("482913 is your verification code.") and a button labelled "Copy code" by default. Tapping it puts the code on the device's clipboard; the user switches to your app or website and pastes it.
Its value is that it asks nothing of your app. One-tap autofill and zero-tap only work on Android, need your app's package name and signing-key hash registered in supported_apps, and need a handshake from the app shortly before each send. Copy code has no such conditions, so it works on every primary phone, Android or iOS, for apps and for websites alike. That is also why it is the floor of the system: whenever one-tap or zero-tap conditions are not met, WhatsApp shows the copy-code button instead.
Two 2026 details are worth knowing. Since 15 June 2026, on iOS 26 and later, copy-code messages also trigger a keyboard suggestion, so iPhone users can fill the code from the notification in one tap with no integration work. And on the Cloud API, authentication messages sent to linked devices such as WhatsApp desktop are masked with a prompt to view them on the primary phone, so "works everywhere" means every phone that holds the WhatsApp account, not every screen. Copy code also differs from the copy-code button on a coupon template: that one is a marketing feature for promo codes, while this one carries verification codes at the authentication rate.
Key takeaways
- Copy code authentication is the OTP button type that copies the code to the clipboard so the user can paste it into your app or website.
- It needs no app integration, so it works on every primary phone, Android or iOS, and in web sign-up flows.
- One-tap autofill and zero-tap fall back to the copy-code button whenever their Android conditions are not met.
- Send the identical code twice: as the body parameter and as the button parameter with
sub_type: urlandindex: 0. - Since 15 June 2026, iOS 26 and later also suggest the code on the keyboard, with no extra integration work.
Chapter 3 · How it unfolds
How does copy code authentication work?
Create the template with COPY_CODE
Submit an
AUTHENTICATIONtemplate whose BUTTONS component has oneOTPbutton withotp_type: COPY_CODE. The optionaltextsets the label, up to 25 characters; leave it out to get the localised default.Generate and store the code
Create a random code of up to 15 characters (6 digits is typical), store only a hash with its expiry time, and match the expiry to
code_expiration_minutesif you show the footer.Send the code twice in one payload
Pass the OTP as the body parameter and again as the parameter of the button component, which uses
sub_type: urlandindex: 0because WhatsApp stores the OTP button as a URL-type button.Let the user copy and paste
The tap copies the code to the clipboard. On iOS 26 and later the keyboard can also suggest it. Make your input field accept a pasted code, including surrounding spaces.
Verify and expire
Compare the entered code with the stored hash, allow a small number of attempts, and invalidate the code once used or expired.
Chapter 4 · The facts
Copy code authentication: key facts and limits
| otp_type | COPY_CODE |
|---|---|
| Button label | Optional text, up to 25 characters |
| Code length | Up to 15 characters |
| Works on | Every primary phone, Android and iOS |
| App setup needed | None: no handshake or signature hash |
| iOS 26 and later | Keyboard suggestion since 15 June 2026 |
Chapter 5 · Why it matters
Why does copy code authentication matter?
Most login and payment flows have to work for every user, not just Android users with your app installed. Copy code is the delivery method you can rely on for web sign-ups, iPhone users and anyone whose handshake has timed out, and it is the path every autofill integration silently falls back to. Getting it right — short expiry, clear button label, a paste-friendly input field — decides whether the fallback feels smooth or broken.
Chapter 6 · In code
Copy code authentication in code
import crypto from "node:crypto";export async function sendLoginCode(to) {const otp = crypto.randomInt(0, 1_000_000).toString().padStart(6, "0");// Store only a hash, with the same 5-minute validity as the template footer.await otpStore.set(to, {hash: crypto.createHash("sha256").update(otp).digest("hex"),expiresAt: Date.now() + 5 * 60_000,attempts: 0,});const res = await fetch(`https://graph.facebook.com/v26.0/${process.env.PHONE_NUMBER_ID}/messages`,{method: "POST",headers: {Authorization: `Bearer ${process.env.ACCESS_TOKEN}`,"Content-Type": "application/json",},body: JSON.stringify({messaging_product: "whatsapp",to,type: "template",template: {name: "login_otp_copy",language: { code: "en_US" },components: [{ type: "body", parameters: [{ type: "text", text: otp }] },{type: "button",sub_type: "url", // the OTP button is stored as a URL buttonindex: "0",parameters: [{ type: "text", text: otp }],},],},}),},);return res.json(); // { messages: [{ id: "wamid..." }] }}
The code goes in twice: once for the body text and once for the copy-code button.
Chapter 7 · Where it goes wrong
Common mistakes with copy code authentication
Sending the code only once
Leaving out the button parameter, or sending a different value there, makes the send fail or copies the wrong code. Put the identical OTP in the body parameter and in the button parameter.
Blocking paste in the input field
Split-digit inputs that reject a pasted six-digit string defeat the point of the button. Accept a full paste into the first box and trim spaces.
Telling desktop users to check WhatsApp Web
Authentication messages on linked devices are masked and point users to the primary phone. Word your UI as "Check WhatsApp on your phone".
Long-lived codes
A code that stays valid for 30 minutes and a message that can still be delivered after that both widen the window for misuse. Keep validity short and set
message_send_ttl_secondsto match.
Chapter 8 · Copy Code Authentication FAQs
Copy Code Authentication FAQs
Does copy code work on iPhone?+
Can I change the "Copy code" label?+
Is a copy-code OTP the same as a coupon code button?+
Why does WhatsApp desktop show a prompt instead of the code?+
Chapter 9 · What good teams do
Best practices for copy code authentication
- Keep codes to 6 digits: easy to read, easy to paste and well under the 15-character cap.
- Use a clear button label in the user's language, or leave it blank for the localised default.
- Start with copy code, ship it, then add one-tap for Android app users once the basics are measured.
- Log which delivery path users actually hit so you know how often autofill falls back.