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

# Send Template Messages

> Request structure and component reference for sending approved WhatsApp templates, with links to every template type.

Template messages are pre-approved message formats. You need them to start a new conversation, or to reach a customer outside the 24-hour service window. You send them through the same endpoint as every other message, with `type: "template"`.

This page covers the request structure and the component reference shared by every template. Each template type has its own page with complete examples.

> [card] [Media headers](https://docs.gateway.connexease.com/api-reference/templates/media-headers.md)
>
> Text, image, video, document, and location headers.

> [card] [Buttons](https://docs.gateway.connexease.com/api-reference/templates/buttons.md)
>
> Dynamic URL, quick reply, and copy code buttons.

> [card] [Authentication (OTP)](https://docs.gateway.connexease.com/api-reference/templates/authentication.md)
>
> One-time passcode templates.

> [card] [Limited-time offer](https://docs.gateway.connexease.com/api-reference/templates/limited-time-offer.md)
>
> Offer banner with a per-message expiration.

> [card] [Carousel](https://docs.gateway.connexease.com/api-reference/templates/carousel.md)
>
> Swipeable cards with their own media and buttons.

> [card] [Flow](https://docs.gateway.connexease.com/api-reference/templates/flow-templates.md)
>
> Open a WhatsApp Flow from a template button.

> [card] [Request Contact Info](https://docs.gateway.connexease.com/api-reference/templates/request-contact-info.md)
>
> Ask a customer to share their phone number.

> [card] [Marketing Messages Lite](https://docs.gateway.connexease.com/api-reference/templates/marketing-messages-lite.md)
>
> Route marketing templates through MM Lite.

## Endpoint

```text theme={null}
POST https://api.gateway.connexease.com/v1/wa/message
```

Authentication, query parameters (`mmlite`, `is_fake`), and the response format are the same as for every other message type. See [Send Message](https://docs.gateway.connexease.com/api-reference/send-message.md).

> [!NOTE]
>
> Create templates and wait for Meta's approval before you send them. You can create them in the panel ([Create Template](https://docs.gateway.connexease.com/dashboard/app/templates.md)) or through the [Public API](https://docs.gateway.connexease.com/public-api-reference/template/create-template.md).

***

## Request body

**messaging\_product** `string` *required*

Always `"whatsapp"`.

**to** `string` *required*

Recipient phone number including country code, without `+`, spaces, or dashes. E.g. `905321234567`.

**type** `string` *required*

Always `"template"`.

**template.name** `string` *required*

The name of the approved template.

**template.language.code** `string` *required*

The language the template was approved in. E.g. `en`, `en_US`, `tr`. Must exactly match the approved template.

**template.components** `array`

Values for the template's variables, media, and buttons. Omit it when the template has no variables, no media header, and no buttons that need values.

### Component object

| Field | Type | Required | Values | Description |
| - | - | - | - | - |
| `type` | string | Yes | `header`, `body`, `button`, `limited_time_offer`, `carousel` | Component type |
| `sub_type` | string | Conditional | `url`, `quick_reply`, `copy_code`, `flow` | Only for `type: "button"` |
| `index` | string | Conditional | `"0"`, `"1"`, `"2"` … | Only for `type: "button"`. Zero-based position of the button on the template |
| `parameters` | array | Conditional | | Values for the component. Not used by `carousel` |
| `cards` | array | Conditional | | Only for `type: "carousel"`. One entry per card, each with `card_index` and its own `components` |

### Parameter object

| Field | Type | Values | Description |
| - | - | - | - |
| `type` | string | `text`, `image`, `video`, `document`, `location`, `currency`, `date_time`, `payload`, `coupon_code`, `action`, `limited_time_offer` | Parameter type |
| `text` | string | | Value for `type: "text"` (header, body, dynamic URL and OTP buttons) |
| `image.link` | string | | Public URL for `type: "image"` |
| `video.link` | string | | Public URL for `type: "video"` |
| `document.link` | string | | Public URL for `type: "document"` |
| `document.filename` | string | | File name shown to the recipient |
| `location` | object | | `latitude`, `longitude`, `name`, `address` for `type: "location"` |
| `payload` | string | | Returned in the webhook when a quick reply button is tapped |
| `coupon_code` | string | | Code copied by a `copy_code` button (max 15 chars) |
| `action` | object | | `flow_token` and `flow_action_data` for a `flow` button |
| `limited_time_offer.expiration_time_ms` | integer | | Offer expiration as a Unix timestamp in milliseconds |

> [!WARNING]
>
> The number, order, and type of `parameters` must exactly match the approved template. Extra or missing parameters return a `GW_001` error.

***

## Template without variables

```bash cURL theme={null}
curl -X POST https://api.gateway.connexease.com/v1/wa/message \
  -H "Authorization: Bearer sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "messaging_product": "whatsapp",
    "to": "905321234567",
    "type": "template",
    "template": {
      "name": "order_confirmation",
      "language": { "code": "en_US" }
    }
  }'
```

```python Python theme={null}
import requests

requests.post(
    "https://api.gateway.connexease.com/v1/wa/message",
    headers={"Authorization": "Bearer sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "Content-Type": "application/json"},
    json={
        "messaging_product": "whatsapp",
        "to": "905321234567",
        "type": "template",
        "template": {"name": "order_confirmation", "language": {"code": "en_US"}}
    }
)
```

```javascript Node.js theme={null}
await fetch('https://api.gateway.connexease.com/v1/wa/message', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'Content-Type': 'application/json' },
  body: JSON.stringify({
    messaging_product: 'whatsapp',
    to: '905321234567',
    type: 'template',
    template: { name: 'order_confirmation', language: { code: 'en_US' } }
  }),
});
```

```go Go theme={null}
payload := map[string]any{
    "messaging_product": "whatsapp",
    "to":   "905321234567",
    "type": "template",
    "template": map[string]any{
        "name":     "order_confirmation",
        "language": map[string]any{"code": "en_US"},
    },
}
body, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", "https://api.gateway.connexease.com/v1/wa/message", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
req.Header.Set("Content-Type", "application/json")
http.DefaultClient.Do(req)
```

***

## Template with body variables

Send one `text` parameter per `{{n}}` variable, in order.

```bash cURL theme={null}
curl -X POST https://api.gateway.connexease.com/v1/wa/message \
  -H "Authorization: Bearer sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "messaging_product": "whatsapp",
    "to": "905321234567",
    "type": "template",
    "template": {
      "name": "shipping_update",
      "language": { "code": "en_US" },
      "components": [
        {
          "type": "body",
          "parameters": [
            { "type": "text", "text": "ORD-20251203" },
            { "type": "text", "text": "In Transit" },
            { "type": "text", "text": "December 3, 2025" }
          ]
        }
      ]
    }
  }'
```

```python Python theme={null}
requests.post(
    "https://api.gateway.connexease.com/v1/wa/message",
    headers={"Authorization": "Bearer sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "Content-Type": "application/json"},
    json={
        "messaging_product": "whatsapp",
        "to": "905321234567",
        "type": "template",
        "template": {
            "name": "shipping_update",
            "language": {"code": "en_US"},
            "components": [
                {
                    "type": "body",
                    "parameters": [
                        {"type": "text", "text": "ORD-20251203"},
                        {"type": "text", "text": "In Transit"},
                        {"type": "text", "text": "December 3, 2025"}
                    ]
                }
            ]
        }
    }
)
```

```javascript Node.js theme={null}
await fetch('https://api.gateway.connexease.com/v1/wa/message', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'Content-Type': 'application/json' },
  body: JSON.stringify({
    messaging_product: 'whatsapp',
    to: '905321234567',
    type: 'template',
    template: {
      name: 'shipping_update',
      language: { code: 'en_US' },
      components: [
        {
          type: 'body',
          parameters: [
            { type: 'text', text: 'ORD-20251203' },
            { type: 'text', text: 'In Transit' },
            { type: 'text', text: 'December 3, 2025' }
          ]
        }
      ]
    }
  }),
});
```

***

## Response

The response is the same as for every other message: `isSuccess` and the `wamid` in `data.messages[0].id`. See [Send Message → Response](https://docs.gateway.connexease.com/api-reference/send-message.md#response).

> [!TIP]
>
> Store the `wamid`. Button taps, Flow completions, and shared contacts arrive with `context.id` set to this value, so you can match the reply to the template you sent.


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