> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# WhatsApp messaging

> Send template messages, update order status and issue refunds.

Send approved templates, with or without media, through your WhatsApp Business Account (WABA).

| API | Endpoint | Best for |
| - | - | - |
| Template send | `POST /api/whatsapp/msg` | Approved templates, text-only or with an image, video or document. |
| Order status update | `POST /api/whatsapp/{source}/order-status/update` | Updating order status in WhatsApp Commerce flows. |
| Order refund | `POST /api/whatsapp/{account}/payment/refund` | Triggering a payment refund in WhatsApp Commerce. |

User blocking is covered in [WhatsApp user management](/docs/guides/whatsapp-user-management.md).

## Send a template message

All templates must be approved in Meta Business Manager before sending. The template ID, language and media URL must match the approved template exactly.

| Parameter | Required | Description |
| - | - | - |
| `source` | Yes | Your WhatsApp Business Account number. |
| `destination` | Yes | Destination mobile number. |
| `template.id` | Yes | Your approved WhatsApp template ID. |
| `template.params` | No | Values for the template variables, in order. |
| `media_url` | No | Publicly hosted media URL. |

> [tab] With media
>
> ```bash theme={null}
> curl --location 'https://api.yourcpaas.com/api/whatsapp/msg' \
>   --header 'Content-Type: application/json' \
>   --header 'Accept: application/json' \
>   --header 'Authorization: Bearer YOUR_TOKEN' \
>   --data '{
>     "source": "WHATSAPP_NUMBER",
>     "destination": "91XXXXXXXXXX",
>     "template": { "id": "TEMPLATE_ID" },
>     "media_url": "https://example.com/file.pdf",
>     "correlation_id": ""
>   }'
> ```

> [tab] Without media
>
> ```bash theme={null}
> curl --location 'https://api.yourcpaas.com/api/whatsapp/msg' \
>   --header 'Content-Type: application/json' \
>   --header 'Accept: application/json' \
>   --header 'Authorization: Bearer YOUR_TOKEN' \
>   --data '{
>     "source": "WHATSAPP_NUMBER",
>     "destination": "91XXXXXXXXXX",
>     "template": { "id": "TEMPLATE_ID", "params": ["Var1", "Var2"] },
>     "correlation_id": ""
>   }'
> ```

> [!NOTE]
>
> If the template has variables, pass the required `params` even when you also send media.

```json Success theme={null}
{
  "status": "success",
  "message": "Message sent successfully.",
  "data": {
    "message_id": "wamid.RpbCVV2HEWfRuwiXDz5EqRRLmTy0laGmDSIH",
    "receiver": "91XXXXXXXXXX",
    "status": "submitted"
  }
}
```

`message_id` is the WhatsApp message ID returned by Meta. `status` is `submitted` or `failed`.

```json Error theme={null}
{ "status": "error", "error_code": 422, "error_message": "Template not found or inactive" }
```

Typical errors: template not found or inactive (check approval status in Meta Business Manager), invalid phone number format, invalid language code (use a valid BCP-47 code such as `en_US`, `hi` or `en`), and a media URL that is not accessible (use a direct, public HTTPS link).

## Update order status

Notify customers of fulfilment events in a WhatsApp Commerce flow. The `{source}` path segment is your WABA number.

| Parameter | Required | Description |
| - | - | - |
| `order_id` | Yes | Unique order identifier from your system. |
| `status` | Yes | `confirmed`, `shipped`, `delivered` or `cancelled`. |
| `status_notes` | No | Extra status notes for the customer. |

```bash theme={null}
curl --location 'https://testqa.gtsstaging.com/api/whatsapp/919691926438/order-status/update' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer 01a08b1a-6d76-73a0-85a8-3f4674bc1ede|spuuSqW8hfgWcwWQeNYFRuqrEsbSjo7aC4tYL2fv02ed4fa7' \
--data '{
    "order_reference_id": "ORDER_1772450067_OUJCQjQA",
    "status": "shipped",
    "status_notes": "Your order will be delivered soon"  }'

```

```json Success theme={null}
{
  "status": "success",
  "message": "Order status updated successfully.",
  "data": { "order_id": "ORD-9876", "updated_status": "shipped", "notified_at": "2026-03-26 10:15:32" }
}
```

| Field | Error | Resolution |
| - | - | - |
| `order_id` | The order\_id field is required. | Add the order ID to the request body. |
| `status` | Invalid order status value | Use `confirmed`, `shipped`, `delivered` or `cancelled`. |
| `receiver` | Invalid phone number format | Ensure the mobile number is correct. |

## Refund an order

Starts the refund and notifies the customer on WhatsApp with the refund details. The `{account}` path segment is the account identifier supplied to you at onboarding.

| Parameter | Required | Description |
| - | - | - |
| `order_reference_id` | Yes | Order to refund. |
| `amount` | Yes | Amount in the order currency. |

```bash theme={null}
curl --location 'https://testqa.gtsstaging.com/api/whatsapp/919691926438/payment/refund' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer 01a08b1a-6d76-73a0-85a8-3f4674bc1ede|spuuSqW8hfgWcwWQeNYFRuqrEsbSjo7aC4tYL2fv02ed4fa7' \
--data '{
    "order_reference_id": "ORDER_1763043873_NzNCQjUA",
    "amount": 1.18,
    "speed": "normal"
}'

```

```json Success theme={null}
{
  "status": "success",
  "message": "Refund initiated successfully.",
  "data": {
    "refund_id": "REF-20260326-890",
    "order_id": "ORD-9876",
    "refund_amount": "1499.00",
    "currency": "INR",
    "refund_status": "processing"
  }
}
```

`refund_status` is `processing`, `completed` or `failed`.

| Field | Error | Resolution |
| - | - | - |
| `order_id` | The order\_id field is required. | Add the order ID. |
| `refund_amount` | The refund\_amount field is required. | Specify the amount to refund. |
| `currency` | Invalid currency code | Use a valid ISO 4217 code such as `INR` or `USD`. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.