When to use this flow
Use this flow when you want OTP messages to be sent from your own connected WhatsApp Business account instead of Modawer’s official WhatsApp sender.
This flow uses the raw WhatsApp template endpoint with an AUTHENTICATION template from your connected WABA.
For the built-in Modawer sender, use Send OTP Message.
This page is only for sending OTPs through a customer’s connected WhatsApp Business account.
Endpoint
| Field | Value |
|---|
| Method | POST |
| Path | /api/messages/send/raw |
| Content-Type | application/json |
X-API-KEY: your-app-token
Request body
{
"whatsappBusinessId": "123456789012345",
"phoneNumberId": "1058560794000297",
"channels": ["WhatsApp"],
"payload": {
"recipient": "9647701234567",
"to": "9647701234567",
"type": "template",
"template": {
"name": "otp_code_login",
"language": {
"code": "ar"
},
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "123456",
"parameter_name": "1"
}
]
}
]
}
}
}
| Field | Type | Required | Description |
|---|
whatsappBusinessId | string | Yes | Connected WhatsApp Business Account ID (WABA ID) that owns the sender phone number and template. |
phoneNumberId | string | Yes | WhatsApp phone number ID that should send the OTP message. |
channels | MessageChannel[] | No | Optional message flow. Only applicable when the selected template is AUTHENTICATION. |
payload | object | Yes | Raw WhatsApp template payload to queue. |
payload.recipient | string | Yes | Phone number that receives the OTP. |
payload.to | string | Yes | WhatsApp recipient phone number. Usually the same value as payload.recipient. |
payload.type | string | Yes | Use "template". |
payload.template.name | string | Yes | Name of an approved WhatsApp template with category AUTHENTICATION. |
payload.template.language.code | string | Yes | Template language code, such as "ar" or "en_US". |
payload.template.components | object[] | Yes | Template components and OTP parameters required by your approved authentication template. |
Authentication template selection
The selected template must be an approved WhatsApp template with category AUTHENTICATION.
Use the Modawer Portal to:
- Link your WhatsApp Business account.
- Select the connected WhatsApp account.
- Select the sender WhatsApp phone number.
- Select an
AUTHENTICATION template.
- Copy the generated cURL from API Playground.
Marketing, Utility, and other non-authentication templates are valid for normal WhatsApp template sending, but they should not be used for this OTP flow.
Message Flow / Channels
channels controls the message flow. It is optional and only applicable when using AUTHENTICATION templates.
Supported values:
| Value | Description |
|---|
"WhatsApp" | Send through WhatsApp. |
"Telegram" | Use Telegram as part of flow. |
Examples:
If channels is omitted, the backend defaults to WhatsApp.
Do not include channels for non-AUTHENTICATION templates. For normal Marketing or Utility template messages, use the regular Send WhatsApp template page.
Success response
cURL example
curl -X POST "https://modawer.com/api/messages/send/raw" \
-H "Content-Type: application/json" \
-H "X-API-KEY: your-app-token" \
-d '{
"whatsappBusinessId": "123456789012345",
"phoneNumberId": "1058560794000297",
"channels": ["WhatsApp"],
"payload": {
"recipient": "9647701234567",
"to": "9647701234567",
"type": "template",
"template": {
"name": "otp_code_login",
"language": {
"code": "ar"
},
"components": [
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "123456",
"parameter_name": "1"
}
]
}
]
}
}
}'
End-to-end checklist
- Your app is linked to a WhatsApp Business account.
whatsappBusinessId matches the connected WABA.
phoneNumberId belongs to that WABA.
- The selected template category is
AUTHENTICATION.
channels is included only when using an AUTHENTICATION template.
- The OTP value is passed in the template component expected by your approved template.