Send Message

Send a WhatsApp text message via the API. Supports template variables for dynamic content.

Endpoint

POST /api/v1/messages

Request body

FieldTypeRequiredDescription
device_idstringYesID of the connected device to send from
tostringYesRecipient phone number (international format, e.g. 628123456789)
contentstringYesMessage text. Use {{1}}, {{2}} for variables.
variablesstring[]NoValues to substitute into template placeholders

Example request

curl -X POST https://wayul.kawilabs.id/api/v1/messages \
  -H "X-API-Key: wy_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "device_id": "dev_01",
    "to": "628123456789",
    "content": "Halo! Kode OTP Anda: {{1}}. Berlaku 5 menit.",
    "variables": ["482913"]
  }'

Response

// 202 Accepted
{
  "message_id": "msg_9f8ec2a1b7e3",
  "status": "queued"
}

Template variables

Use {{1}}, {{2}}, etc. in your content. The variables array maps positionally: {{1}} = variables[0].

Errors

CodeStatusDescription
UNAUTHORIZED401Missing or invalid X-API-Key
DEVICE_NOT_CONNECTED409Device is not connected
QUOTA_EXCEEDED429Monthly message quota exhausted
RATE_LIMITED429Too many requests (60/min per key)
TEXT_ONLY400Only text messages are supported in MVP