Send WABA Message
Send a message via WhatsApp Business API (WABA). You can send either a template message (for starting a conversation or after the 24-hour window) or a session message (plain text within an active conversation).
Requires a WABA channel connected to your 2Chat account. Get template UUIDs from the Get WABA Templates endpoint.
Request body (common fields)
| Field | Description | Required |
|---|---|---|
to_number | Recipient number in E.164 format (e.g. +595981048477). | Yes |
from_number | Your WABA number in E.164 format (e.g. +5215512345432). | Yes |
For template messages, also send:
| Field | Description | Required |
|---|---|---|
template_uuid | Template UUID from Get WABA Templates. | Yes |
params | Template variable values. Required for template messages; use an empty object {} (or e.g. {"body": []}) if the template has no variables. | Yes |
params.body | Array of strings replacing {{1}}, {{2}}, … in the template body. | If template has body variables |
params.header | Header variable (if template has a text header variable). | If applicable |
params.buttons | Button payloads (e.g. for dynamic URL or OTP). | If applicable |
For session messages (within 24-hour window), send:
| Field | Description | Required |
|---|---|---|
text | Plain text message. | Yes |
You must send either a template message (template_uuid and params; params is required even if empty) or a session message (text), not both in the same request.
Send a template message
Use when starting a conversation or when the 24-hour session has expired. Replace template placeholders with values in params.body (and optionally params.header or params.buttons).
- cURL
- Python
- JavaScript
curl --request POST \
--url 'https://api.p.2chat.io/open/waba/send-message' \
--header 'Content-Type: application/json' \
--header 'X-User-API-Key: your_api_key_here' \
--data '{
"to_number": "+595981048477",
"from_number": "+5215512345432",
"template_uuid": "TMP1b44a079-c75c-4403-bc8f-a75c4ce5cd23",
"params": {
"body": ["Maria", "TRK-98452"]
}
}'
import requests
import json
url = "https://api.p.2chat.io/open/waba/send-message"
payload = {
"to_number": "+595981048477",
"from_number": "+5215512345432",
"template_uuid": "TMP1b44a079-c75c-4403-bc8f-a75c4ce5cd23",
"params": {
"body": ["Maria", "TRK-98452"]
}
}
headers = {
"Content-Type": "application/json",
"X-User-API-Key": "your_api_key_here"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const axios = require('axios');
axios.post('https://api.p.2chat.io/open/waba/send-message', {
to_number: '+595981048477',
from_number: '+5215512345432',
template_uuid: 'TMP1b44a079-c75c-4403-bc8f-a75c4ce5cd23',
params: {
body: ['Maria', 'TRK-98452']
}
}, {
headers: {
'Content-Type': 'application/json',
'X-User-API-Key': 'your_api_key_here'
}
})
.then(response => console.log(response.data))
.catch(error => console.error(error));
Send a session message
Use when replying within the 24-hour customer session. Send only text (no template_uuid or params).
- cURL
- Python
- JavaScript
curl --request POST \
--url 'https://api.p.2chat.io/open/waba/send-message' \
--header 'Content-Type: application/json' \
--header 'X-User-API-Key: your_api_key_here' \
--data '{
"to_number": "+595981048477",
"from_number": "+5215512345432",
"text": "Hi, how can we help you today?"
}'
import requests
import json
url = "https://api.p.2chat.io/open/waba/send-message"
payload = {
"to_number": "+595981048477",
"from_number": "+5215512345432",
"text": "Hi, how can we help you today?"
}
headers = {
"Content-Type": "application/json",
"X-User-API-Key": "your_api_key_here"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const axios = require('axios');
axios.post('https://api.p.2chat.io/open/waba/send-message', {
to_number: '+595981048477',
from_number: '+5215512345432',
text: 'Hi, how can we help you today?'
}, {
headers: {
'Content-Type': 'application/json',
'X-User-API-Key': 'your_api_key_here'
}
})
.then(response => console.log(response.data))
.catch(error => console.error(error));
Response
Example success response:
{
"success": true,
"batched": true,
"message_uuid": "MSG126d9055-9dad-415f-b934-ff909773a8ef"
}
| Field | Description |
|---|---|
success | true when the message was accepted |
batched | true when the message was successfully queued for sending |
message_uuid | Internal UUID of the message for tracking |
Errors return an appropriate HTTP status and a JSON body with error details.