We are making changes to the WhatsApp Business Platform pricing model. See Pricing Updates on the WhatsApp Business Platform.
This document explains how to send approved authentication templates with one-time password buttons.
Use the WhatsApp Business Phone Number > Messages endpoint to send an authentication template message with a one-time password button.
POST /<WHATSAPP_BUSINESS_PHONE_NUMBER_ID>/messages
{ "messaging_product": "whatsapp", "recipient_type": "individual", "to": "<CUSTOMER_PHONE_NUMBER>", "type": "template", "template": { "name": "<TEMPLATE_NAME>", "language": { "code": "<TEMPLATE_LANGUAGE_CODE>" }, "components": [ { "type": "body", "parameters": [ { "type": "text", "text": "<ONE-TIME PASSWORD>" } ] }, { "type": "button", "sub_type": "url", "index": "0", "parameters": [ { "type": "text", "text": "<ONE-TIME PASSWORD>" } ] } ] } }
Placeholder | Description | Sample Value |
---|---|---|
| The customer's WhatsApp phone number. |
|
| The one-time password or verification code to be delivered to the customer. Note that this value must appear twice in the payload. Maximum 15 characters. |
|
| The template's language and locale code. |
|
| The template's name. |
|
Upon success, the API will respond with:
{ "messaging_product": "whatsapp", "contacts": [ { "input": "<INPUT>", "wa_id": "<WA_ID>" } ], "messages": [ { "id": "<ID>" } ] }
Placeholder | Description | Sample Value |
---|---|---|
String | The customer phone number that the message was sent to. This may not match |
|
String | WhatsApp ID of the customer who the message was sent to. This may not match |
|
String | WhatsApp message ID. You can use the ID listed after "wamid." to track your message status. |
|
curl -L 'https://graph.facebook.com/v21.0
/105954558954427/messages' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer EAAJB...' \
-d '{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "12015553931",
"type": "template",
"template": {
"name": "verification_code",
"language": {
"code": "en_US"
},
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "J$FpnYnP"
}
]
},
{
"type": "button",
"sub_type": "url",
"index": "0",
"parameters": [
{
"type": "text",
"text": "J$FpnYnP"
}
]
}
]
}
}'
{ "messaging_product": "whatsapp", "contacts": [ { "input": "12015553931", "wa_id": "12015553931" } ], "messages": [ { "id": "wamid.HBgLMTY1MDM4Nzk0MzkVAgARGBI4Qzc5QkNGNTc5NTMyMDU5QzEA" } ] }