Connected WhatsApp API
Send with WhatsApp
The Campaign Messages API queues WhatsApp messages from your own scripts or integrations. The API key owner needs Inbox Write access. With Personal WhatsApp Own Write, the sender phone must be registered to that person. With Personal WhatsApp All Write, any registered sender phone in the workspace can be used.
Endpoint and request body
Send messages with POST /api/v1/messages/send. The request requires to, sender_phone, and a message object. The to value can be a phone number, group JID, or newsletter JID.
curl -X POST "https://app.querygen.ai/api/v1/messages/send" \
-H "Authorization: Bearer qg_xxxxxxxxxxxxx" \
-H "X-Organization-Id: <organization-id>" \
-H "Content-Type: application/json" \
-d '{
"to": "919876543210",
"sender_phone": "919820160046",
"message": {
"type": "text",
"text": "Hello, your order is ready!"
}
}'Media message
For images, videos, audio files, and documents, set message.type to the media type and provide a publicly accessible media_url.
curl -X POST "https://app.querygen.ai/api/v1/messages/send" \
-H "Authorization: Bearer qg_xxxxxxxxxxxxx" \
-H "X-Organization-Id: <organization-id>" \
-H "Content-Type: application/json" \
-d '{
"to": "919876543210",
"sender_phone": "919820160046",
"message": {
"type": "image",
"media_url": "https://example.com/photo.jpg",
"caption": "Here is your receipt",
"filename": "receipt.jpg"
}
}'Poll message
Polls require 2 to 12 options. Set poll_allows_multiple to true to allow more than one selection.
curl -X POST "https://app.querygen.ai/api/v1/messages/send" \
-H "Authorization: Bearer qg_xxxxxxxxxxxxx" \
-H "X-Organization-Id: <organization-id>" \
-H "Content-Type: application/json" \
-d '{
"to": "919876543210",
"sender_phone": "919820160046",
"message": {
"type": "poll",
"poll_question": "How was your experience?",
"poll_options": ["Excellent", "Good", "Average", "Poor"],
"poll_allows_multiple": false
}
}'Send to a group
curl -X POST "https://app.querygen.ai/api/v1/messages/send" \
-H "Authorization: Bearer qg_xxxxxxxxxxxxx" \
-H "X-Organization-Id: <organization-id>" \
-H "Content-Type: application/json" \
-d '{
"to": "120363019820160046@g.us",
"sender_phone": "919820160046",
"message": {
"type": "text",
"text": "Hello group!"
}
}'Send to a newsletter
curl -X POST "https://app.querygen.ai/api/v1/messages/send" \
-H "Authorization: Bearer qg_xxxxxxxxxxxxx" \
-H "X-Organization-Id: <organization-id>" \
-H "Content-Type: application/json" \
-d '{
"to": "120363999999999999@newsletter",
"sender_phone": "919820160046",
"message": {
"type": "text",
"text": "Today is the menu launch."
}
}'Send response
{
"success": true,
"data": {
"message_id": "msg_abc123",
"campaign_id": "api_campaign_1234567890_user123",
"status": "queued",
"queued_at": "2026-02-28T10:30:00Z"
}
}Send errors
| Status | Meaning |
|---|---|
| 400 | Validation error, missing fields, invalid fields, or sender phone unavailable to the key owner |
| 401 | Missing, invalid, or revoked API key |
| 403 | The key owner lacks the required feature permission or sender access |
| 429 | Rate limit exceeded |