Template Messages
Send pre-approved authentication templates for OTP (One-Time Password) delivery. Templates must be created and approved in your WhatsApp Manager before use.
Authentication Templates
POST
/api/messages/auth-template
Send OTP codes using Meta's authentication template format. Two button types are supported:
| Button Type | Description | Platform |
|---|---|---|
copy_code | Displays a "Copy Code" button the user can tap to copy the OTP | All platforms |
one_tap | Auto-fills the OTP in your Android app (requires package name and signature hash) | Android only |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
to | string | Yes | Recipient phone number with country code |
templateName | string | Yes | Name of the approved authentication template |
languageCode | string | Yes | Template language code (e.g., "en_US") |
otp | string | Yes | The one-time password to send |
buttonType | string | Yes | "copy_code" or "one_tap" |
packageName | string | one_tap only | Android app package name |
signatureHash | string | one_tap only | Android app signature hash |
phoneNumberId | string | No | Send from a specific number |
Copy Code Example
{
"to": "15551234567",
"templateName": "auth_otp_template",
"languageCode": "en_US",
"otp": "847294",
"buttonType": "copy_code"
}JSON
One-Tap Example (Android)
{
"to": "15551234567",
"templateName": "auth_otp_template",
"languageCode": "en_US",
"otp": "847294",
"buttonType": "one_tap",
"packageName": "com.yourcompany.app",
"signatureHash": "a1b2c3d4e5f6g7h8i9j0"
}JSON
C# Example
var payload = new
{
to = "15551234567",
templateName = "auth_otp_template",
languageCode = "en_US",
otp = "847294",
buttonType = "copy_code"
};
var json = JsonSerializer.Serialize(payload);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync(
"https://app.waconnect.me/api/messages/auth-template", content);C#
⚠
Templates must be pre-approved. Create and submit authentication templates for approval in WhatsApp Manager > Message Templates before using this endpoint.