Skip to main content

Endpoint

FieldValue
MethodPOST
Path/api/messages/send-otp
Content-Typeapplication/json
This endpoint sends OTP messages only through Modawer’s official WhatsApp account. It is the easiest way to start sending OTP messages without linking your own WhatsApp sender.
To send OTPs from your own connected WhatsApp Business account, see Send OTP from Your WhatsApp Account.

Request body

{
  "recipient": "9647701234567",
  "otp": "123456",
  "channels": ["WhatsApp"]
}
FieldTypeDescription
recipientstringPhone number that receives the OTP message.
otpstringOne-time password value inserted into the otp_code_1 authentication template.
channelsMessageChannel[]Optional delivery channels. Defaults to ["WhatsApp"]. Supported values are "WhatsApp" and "Telegram".

Required header

X-API-KEY: your-app-token

Success response

{
  "queued": true
}

cURL example

curl -X POST "https://modawer.com/api/messages/send-otp" \
  -H "Content-Type: application/json" \
  -H "X-API-KEY: your-app-token" \
  -d '{
    "recipient": "9647701234567",
    "otp": "123456",
    "channels": ["WhatsApp"]
  }'

JavaScript example

const response = await fetch("https://modawer.com/api/messages/send-otp", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-API-KEY": "your-app-token",
  },
  body: JSON.stringify({
    recipient: "9647701234567",
    otp: "123456",
    channels: ["WhatsApp"],
  }),
});

const data = await response.json();