Send Message API
Environment: Live
Send batch WhatsApp messages using templates.
# Send Message API
Send batch WhatsApp messages using an approved template name. The unique reference (ref) is optional; however, without it, the message status cannot be tracked.
## Endpoint
- **Method**: POST
- **URL**: https://api.moolre.com/open/whatsapp/send
## Headers
| Header | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| X-API-VASKEY | string | Yes | Your WhatsApp API VAS key. |
## Request Body
| Parameter | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| template_name | string | Yes | The name of the approved WhatsApp template. |
| language | string | Yes | The language code for the template (English only). |
| messages | array | Yes | An array of message objects containing recipient, optional ref, and placeholders. Note: If ref is omitted, the status cannot be checked later. |
## Response (200 (Success) Success)
All messages were sent successfully.
```json
{
"status": 1,
"code": "WAS200",
"message": "suceess",
"error": [],
"data": [],
"meta": {
"requestid": "req_c68f4c66115c26725c796242",
"notices": []
}
}
```
## Response (200 (Duplicate Refs) Warning)
Some messages were not sent due to non-unique references.
```json
{
"status": 1,
"code": "WAS200",
"error": "Some ref are not unique, corresponding messages will not be sent",
"message": "",
"data": [
{
"recipient": "233240000004",
"ref": "879883HGU334553GF887799HF20004"
},
{
"recipient": "233240000005",
"ref": "879883HGU334553GF887799HF20006"
}
],
"meta": {
"requestid": "req_c68f4c66115c26725c796242",
"notices": []
}
}
```
## Response (401 (Insufficient Balance) Insufficient Balance)
The account has insufficient balance to send WhatsApp messages.
```json
{
"status": 0,
"code": "WAS401",
"message": "Insufficient balance to send messages. Please top up your WhatsApp bundle.",
"meta": {
"requestid": "req_c68f4c66115c26725c796242",
"notices": []
}
}
```
## Fields every response can carry
These fields are additive: existing fields keep their names, order and types.
| Field | Meaning |
| :--- | :--- |
| meta | Always present, last in the object. meta.replayed is true only when the response is the stored answer to a repeated Idempotency-Key (absent otherwise). meta.requestid is the unique id of the request (also the X-Request-Id response header): quote it when you contact support. meta.notices is always an array, empty when there is nothing to report; each notice is { code, message, docs? }, for example that a deprecated way of sending credentials was used. See [Deprecations](https://docs.moolre.com/guides/deprecations). |
There is no outcome field. Decide the result from status, code and, on payment and transfer endpoints, data.txstatus (0 pending, 1 succeeded, 2 failed). These codes mean the result is unknown and may still succeed, so treat them as pending and check the status: PY01, PY02, TR01, TR02, TP11, TP18, APY10, APY16, ASL06, IS30, SYS500. Status 1 with TR08, OBGH01, OTGH01, OBNG01, GHQ03 or OM03 is final success; any other status 1 is an accepted, unfinished request.
Send X-Moolre-Http-Status: strict to receive real HTTP status codes (400, 401, 403, 404, 409, 422, 429, 5xx) instead of HTTP 200. See [Responses and request IDs](https://docs.moolre.com/guides/responses).