Skip to main content

📥 Request Body​

Use the following parameters to configure your message. Requests must be sent in JSON format.

ParameterTypeStatusDescription
phonestringRequiredTarget number in international format (e.g., 628123456789).
messagestringRequiredText message content or caption if sending media.
media_urlstringOptionalPublic URL of the media file (Image/Video/Document) to be sent.
media_typestringOptionalType of media: image, video, or document. If media_url is provided but media_type is omitted, Wagy will automatically detect the media type based on the downloaded file content.
retry_intervalintOptionalTime delay (seconds) between attempts if the first delivery fails.
expires_inintOptionalMessage validity in seconds. After this, the message will not be sent.
expires_atstringOptionalAbsolute expiration time in RFC3339 format.
scheduled_atstringOptionalScheduled delivery time in RFC3339 format (e.g., 2026-07-20T10:00:00Z). If left empty, the message is sent immediately.
Expiration Priority

Use either expires_in or expires_at. If both are sent, Wagy will use expires_at as the primary reference and ignore expires_in.

Scheduled Message Expiration

If you specify expires_in along with scheduled_at, the expiration time will be calculated relative to the scheduled time (scheduled_at), rather than the time the message is queued.

Full Request Example​

{
"phone": "628123456789",
"message": "Hello, here is your shopping invoice!",
"media_url": "https://yourdomain.com/files/inv-001.pdf",
"media_type": "document",
"retry_interval": 120,
"scheduled_at": "2026-07-20T10:00:00Z",
"expires_in": 3600
}

📤 Responses​

1. Success (200 OK)​

{
"status": "success",
"data": {
"message_id": 1024,
"status": "PENDING",
"quota_type": "pro",
"remaining": 499
},
"message": "Message queued"
}

2. Error Codes​

CodeMessageExplanation
400Invalid JSON payloadIncorrect JSON format or missing required parameters.
401UnauthorizedInvalid API Key or mismatch with the device_id.
402Quota exhaustedThe message balance (Free/PRO) for that device has reached its limit.
404Device not founddevice_id is not registered in the Wagy system.

💡 Use Cases & Payloads​

{
"phone": "628123456789",
"message": "Hello, this is a text message from Wagy!"
}
Queue Note

Each message sent via the API is not immediately sent to WhatsApp; instead, it enters a Queue. Wagy will process the delivery with a natural delay.


Send single message

POST 

/:device_id/send

Enqueue a WhatsApp message for delivery through a specific device.

Request​

Responses​

Pesan berhasil masuk antrean