# Send WhatsApp Template (v2)

> Send a pre-approved WhatsApp template with file/media header support via multipart form data.

Developers · REST API

Send a pre-approved WhatsApp template message with support for uploading a media
header file directly (multipart form data).

**POST** `/stable/open/whatsapp/send-template`

Base URL: `https://api.myalice.ai`. This endpoint accepts
`multipart/form-data`. Authenticate with the `X-Myalice-Api-Key` header.

## Form fields

**`template_id` (string) — required**

The ID of the template.

**`channel_id` (string) — required**

The ID of the WhatsApp channel.

**`customer_phone` (string) — required**

Customer phone number with country code.

**`file` (binary)**

The media file to send as the template header.

**`header_type` (string)**

One of `none`, `text`, `document`, `image`, `video`.

**`body_vars` (object)**

Key–value pairs for the variables in the template body.

**`button_vars` (object)**

Key–value pairs for the variables in the template buttons.

**`customer_attributes` (object)**

Key–value pairs to store against the customer record.

## Example

```bash cURL
curl -X POST "https://api.myalice.ai/stable/open/whatsapp/send-template" \
  -H "X-Myalice-Api-Key: YOUR_API_KEY" \
  -F "template_id=102323213" \
  -F "channel_id=1022" \
  -F "customer_phone=+628123456789" \
  -F "header_type=document" \
  -F "file=@invoice.pdf"
```

```json Response
{
  "success": true,
  "data": { "status": "ongoing" }
}
```

## Errors

**`401 / 402 / 403` (object)**

Unauthorized. Body: `{ "detail": string }`.

---
HTML: https://userevora.com/docs/developers/rest-api/send-whatsapp-template-v2
