Skip to content

Send Message

POST
/wab

Sends a WhatsApp message to a recipient number through the specified agent.

The type field in the request body determines the message variant. See the request body examples for all supported types.

Message payload. The type field determines which additional fields are required.

typeRequired fields
templatetemplateName, templateData, language
textmessage
imageurlcaption optional
fileurl, filename
audiourl
videourl
locationlongitude, latitudename, address optional
stickerurl
contactscontact
One of: discriminator: type
Template

Send a pre-approved WhatsApp template message.

Templates must be approved by Meta before use. Use templateData to fill in the dynamic placeholders defined in your template.

object
agent
required

WhatsApp Business phone number of the sending agent (E.164 without +)

string
5215628341366
number
required

Destination WhatsApp phone number (E.164 without +)

string
525510101234
type
required

Message type — determines which additional fields are required

string
Allowed values: template text image file audio video location sticker contacts
type
required
string
Allowed values: template
language
required

Template language code

string
Allowed values: en es fr de it pt
es
templateName
required

Exact name of the approved template

string
ejemplo_nota_1
templateData
required
object
body
object
placeholders

Values to fill in the body {{1}}, {{2}}, … variables in order

Array<string>
[
"2024-01-01",
"John Doe",
"$ 1500"
]
header

Required when the template header contains a media or document component

object
type

Header media type

string
Allowed values: IMAGE VIDEO DOCUMENT
DOCUMENT
mediaUrl

Publicly accessible URL of the header media

string format: uri
https://www.buildquickbots.com/whatsapp/media/sample/pdf/sample01.pdf
filename

File name displayed to the recipient (required when type is DOCUMENT)

string
document.pdf
placeholders

Values for header text variables (max 1 item for text headers)

Array<string>
<= 1 items
[
"John Doe"
]
Examples

Template with document header

{
"type": "template",
"agent": "5215589427963",
"number": "525510101234",
"templateName": "ejemplo_nota_1",
"language": "es",
"templateData": {
"body": {
"placeholders": [
"2024-01-01",
"John Doe",
"My Business",
"$ 1500"
]
},
"header": {
"type": "DOCUMENT",
"mediaUrl": "https://www.buildquickbots.com/whatsapp/media/sample/pdf/sample01.pdf",
"filename": "document.pdf"
}
}
}

Message successfully enqueued

object
error
boolean
code
integer
200
message
string
Message enqueued successfully
Example
{
"error": false,
"code": 200,
"message": "Message enqueued successfully"
}

Agent field must be specified

object
error
boolean
true
code

HTTP-style error code returned by the API

integer
400
message

Human-readable error description

string
Agent or User are invalid
Example
{
"error": true,
"code": 304,
"message": "Agent field must be specified to send WAB message"
}

Number field must be specified

object
error
boolean
true
code

HTTP-style error code returned by the API

integer
400
message

Human-readable error description

string
Agent or User are invalid
Example
{
"error": true,
"code": 305,
"message": "Number field must be specified to send WAB message"
}

Phone number must be in E.164 format

object
error
boolean
true
code

HTTP-style error code returned by the API

integer
400
message

Human-readable error description

string
Agent or User are invalid
Example
{
"error": true,
"code": 306,
"message": "Please use number in E.164 format"
}

Type field must be specified

object
error
boolean
true
code

HTTP-style error code returned by the API

integer
400
message

Human-readable error description

string
Agent or User are invalid
Example
{
"error": true,
"code": 307,
"message": "Type field must be specified to send WAB message"
}

Agent or user are invalid

object
error
boolean
true
code

HTTP-style error code returned by the API

integer
400
message

Human-readable error description

string
Agent or User are invalid
Example
{
"error": true,
"code": 400,
"message": "Agent or User are invalid"
}

WhatsApp agent not found or invalid

object
error
boolean
true
code

HTTP-style error code returned by the API

integer
400
message

Human-readable error description

string
Agent or User are invalid
Example
{
"error": true,
"code": 404,
"message": "Whatsapp agent isn't valid or not found"
}

Internal error enqueuing message

object
error
boolean
true
code

HTTP-style error code returned by the API

integer
400
message

Human-readable error description

string
Agent or User are invalid
Example
{
"error": true,
"code": 500,
"message": "Error enqueuing message"
}

Useful for guiding users to view code examples in different developer languages.

developer@developer:~#
curl -X POST "https://api.example.com/wab" \
-H "Accept: application/json" \
-H "Connection: keep-alive" \
-H "Content-Type: application/json" \
-H "Authorization: Basic <base64-encoded-credentials>" \
-d '{}'