Guides

Authentication OTP Templates

Send Meta AUTHENTICATION templates for login / verification codes through POST /templates/send with a single OTP in body_variables.

Cloud templates only OTP templates require an approved AUTHENTICATION template on a Cloud API channel. Device/QR channels do not send Meta authentication templates.

1. Create the template (dashboard)

  1. Templates → Create → category AUTHENTICATION.
  2. Configure the OTP button (copy code / one-tap) per Meta’s authentication template rules.
  3. Submit for Meta approval and wait until status is approved.

2. Send the code

Pass exactly one body_variables entry: the numeric OTP (4–8 digits). Washeej validates the payload and attaches the matching button parameter when the template requires it.

cURL
curl -X POST "https://app.washeej.com/v1/templates/send" \
  -H "client-id: YOUR_CLIENT_ID" \
  -H "client-secret: YOUR_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "template_id": "YOUR_AUTH_TEMPLATE_ID",
    "mobile_code": "966",
    "mobile": "500000000",
    "whatsapp_account_id": YOUR_CLOUD_ACCOUNT_ID,
    "body_variables": ["482913"]
  }'

3. Validation rules

  • Category must be AUTHENTICATION.
  • body_variables length must be 1.
  • Code must match /^\d{4,8}$/.
  • Wrong shape → validation_error with a clear message.

4. Operational tips

  • Generate codes in your auth service; never reuse long-lived OTPs in examples on production numbers.
  • Prefer a dedicated Cloud number for transactional OTP traffic.
  • Monitor message.failed / billing_blocked for deliverability and Meta billing issues.
  • List templates with GET /templates and filter to your Cloud whatsapp_account_id.