> ## 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.

# Template Buttons

> Send values for dynamic URL, quick reply, and copy code buttons, and handle quick reply taps.

Each template button that needs a value at send time gets its own `button` component. `index` is the button's zero-based position on the template, and `sub_type` is its type.

| Button on the template | Needs a component? | `sub_type` | Parameter |
| :- | :- | :- | :- |
| URL / Static | No | — | — |
| URL / Dynamic (`{{1}}` in the URL) | Yes | `url` | `{ "type": "text", "text": "..." }` — the value that replaces `{{1}}` |
| Phone Number | No | — | — |
| Quick Reply | Optional | `quick_reply` | `{ "type": "payload", "payload": "..." }` |
| Copy Code | Yes | `copy_code` | `{ "type": "coupon_code", "coupon_code": "..." }` |
| Flow Trigger | Yes | `flow` | See [Flow Templates](https://docs.gateway.connexease.com/api-reference/templates/flow-templates.md) |
| Request Contact Info | No | — | See [Request Contact Info](https://docs.gateway.connexease.com/api-reference/templates/request-contact-info.md) |

> [!NOTE]
>
> `index` counts every button on the template, including the ones you don't send a component for. On a template with a static URL button at position 0 and a quick reply at position 1, the quick reply component uses `"index": "1"`.

***

## Dynamic URL button

Send only the variable part. If the template URL is `https://example.com/track/{{1}}`, sending `abc123` opens `https://example.com/track/abc123`.

```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_tracking",
      "language": { "code": "en" },
      "components": [
        {
          "type": "body",
          "parameters": [{ "type": "text", "text": "John" }]
        },
        {
          "type": "button",
          "sub_type": "url",
          "index": "0",
          "parameters": [{ "type": "text", "text": "abc123" }]
        }
      ]
    }
  }'
```

```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_tracking",
            "language": {"code": "en"},
            "components": [
                {"type": "body", "parameters": [{"type": "text", "text": "John"}]},
                {"type": "button", "sub_type": "url", "index": "0",
                 "parameters": [{"type": "text", "text": "abc123"}]}
            ]
        }
    }
)
```

```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_tracking',
      language: { code: 'en' },
      components: [
        { type: 'body', parameters: [{ type: 'text', text: 'John' }] },
        { type: 'button', sub_type: 'url', index: '0', parameters: [{ type: 'text', text: 'abc123' }] }
      ]
    }
  }),
});
```

***

## Quick reply buttons

Quick reply labels are fixed on the template. At send time you can attach a `payload` to each button. It comes back in the webhook when the customer taps the button, so you know which message and which option triggered the reply.

```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": "delivery_slot_confirm",
      "language": { "code": "en" },
      "components": [
        {
          "type": "button",
          "sub_type": "quick_reply",
          "index": "0",
          "parameters": [{ "type": "payload", "payload": "confirm_ORD-20261016" }]
        },
        {
          "type": "button",
          "sub_type": "quick_reply",
          "index": "1",
          "parameters": [{ "type": "payload", "payload": "reschedule_ORD-20261016" }]
        }
      ]
    }
  }'
```

```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": "delivery_slot_confirm",
            "language": {"code": "en"},
            "components": [
                {"type": "button", "sub_type": "quick_reply", "index": "0",
                 "parameters": [{"type": "payload", "payload": "confirm_ORD-20261016"}]},
                {"type": "button", "sub_type": "quick_reply", "index": "1",
                 "parameters": [{"type": "payload", "payload": "reschedule_ORD-20261016"}]}
            ]
        }
    }
)
```

```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: 'delivery_slot_confirm',
      language: { code: 'en' },
      components: [
        { type: 'button', sub_type: 'quick_reply', index: '0', parameters: [{ type: 'payload', payload: 'confirm_ORD-20261016' }] },
        { type: 'button', sub_type: 'quick_reply', index: '1', parameters: [{ type: 'payload', payload: 'reschedule_ORD-20261016' }] }
      ]
    }
  }),
});
```

When the customer taps a template quick reply, your webhook receives a message with `type: "button"`:

```json theme={null}
{
  "from": "905399876543",
  "id": "wamid.xxx",
  "timestamp": "1792148700",
  "type": "button",
  "context": {
    "from": "905321234567",
    "id": "wamid.ORIGINAL_TEMPLATE_MESSAGE"
  },
  "button": {
    "payload": "confirm_ORD-20261016",
    "text": "Confirm"
  }
}
```

| Field | Type | Description |
| :- | :- | :- |
| `button.payload` | string | The `payload` you sent. If you didn't send one, this is the button label. |
| `button.text` | string | The button label the customer saw. |
| `context.id` | string | The `wamid` of the template message. |

> [!NOTE]
>
> Template quick replies arrive as `type: "button"`. Quick replies from an [interactive button message](https://docs.gateway.connexease.com/api-reference/send-message.md) arrive as `type: "interactive"` with `button_reply`. Handle both if you use both.

***

## Copy code button

The coupon code is set per message, so each customer can get a different code. Maximum 15 characters.

```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": "promo_coupon",
      "language": { "code": "en" },
      "components": [
        {
          "type": "body",
          "parameters": [{ "type": "text", "text": "John" }]
        },
        {
          "type": "button",
          "sub_type": "copy_code",
          "index": "0",
          "parameters": [{ "type": "coupon_code", "coupon_code": "SAVE25" }]
        }
      ]
    }
  }'
```

```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": "promo_coupon",
            "language": {"code": "en"},
            "components": [
                {"type": "body", "parameters": [{"type": "text", "text": "John"}]},
                {"type": "button", "sub_type": "copy_code", "index": "0",
                 "parameters": [{"type": "coupon_code", "coupon_code": "SAVE25"}]}
            ]
        }
    }
)
```

```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: 'promo_coupon',
      language: { code: 'en' },
      components: [
        { type: 'body', parameters: [{ type: 'text', text: 'John' }] },
        { type: 'button', sub_type: 'copy_code', index: '0', parameters: [{ type: 'coupon_code', coupon_code: 'SAVE25' }] }
      ]
    }
  }),
});
```

***

## Combining buttons

Send one component per button that needs a value, each with its own `index`. Order the components however you like — `index` decides which button each value belongs to.

```json theme={null}
"components": [
  { "type": "body", "parameters": [{ "type": "text", "text": "John" }] },
  { "type": "button", "sub_type": "copy_code", "index": "0", "parameters": [{ "type": "coupon_code", "coupon_code": "SAVE25" }] },
  { "type": "button", "sub_type": "url", "index": "1", "parameters": [{ "type": "text", "text": "spring-sale" }] }
]
```


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