Contents

WhatsApp

Template and session messages on the WhatsApp Business Platform.

These endpoints send through the official WhatsApp Business Platform (Cloud API), with templates approved by Meta. Delivery status arrives through the same message statuses and webhooks as SMS. To send from your own Meta WhatsApp Business Account, see WhatsApp Official; to send from a number linked by QR code, see WhatsApp Connect.

Templates

Messages that start a conversation must use a template approved by Meta. Register each template under WhatsApp templates in the dashboard with exactly the approved name, language and body; SMS21 reviews it and maps your named variables to Meta’s positional parameters.

CategorySend with
Utility (order updates, reminders)POST /whatsapp/template
MarketingPOST /whatsapp/template
Authentication (OTP)POST /otp/send with channel: "whatsapp"
FieldTypeDescription
tostringrequiredRecipient in international format.
templateIdstringrequiredApproved template (wtpl_…).
variablesobjectoptionalValues for the template variables, by name.
curl -X POST https://sms21.in/v1/whatsapp/template \
  -H "X-API-Key: $SMS21_API_KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: booking-88121-confirmed" \
  -d '{"to":"919876543210","templateId":"wtpl_…","variables":{"name":"Asha","booking":"88121"}}'

Session messages

Free-form text (POST /whatsapp/send with to and text, up to 4096 characters) is only delivered within 24 hours of the recipient’s last message to your number. Outside that window WhatsApp rejects it and the message ends as rejected — use a template instead.

WhatsApp OTP

  • Configure an approved authentication template on the project, then call POST /otp/send with channel: "whatsapp".
  • Add fallbackChannel: "sms" to deliver the same code by SMS when WhatsApp definitely fails. Verification is identical for both channels.

Test keys

WhatsApp messages from test keys go to the sandbox and follow the same magic-number results as SMS.