# Put quick-reply buttons in a template (outside the 24 h window)

_Yes: up to two quick_reply buttons in a Meta-approved template; the tap comes back as message.inbound with the tapped label, and reopens the 24 h window._

Keywords: template buttons, template quick reply button, quick_reply, buttons outside 24h, buttons with template, Yes No button, buttons on a notification, button payload, Confirm button, Cancel button, 2 buttons, tappable button notification

## Scenario

You notify a customer outside the 24 h window (delivery tomorrow, offer, survey) and want them to answer with one tap: "Yes" or "No", instead of typing.

**Yes, a template can carry quick-reply buttons.** It is the "outside 24 h" version of [buttons without a template](https://console.geskap.com/docs/boutons-reponse-rapide?lang=en), with two differences: the template must be **approved by Meta** before sending, and there are **2 buttons at most** (3 without a template).

## Conversation

```text
You      : POST /v1/messages  to=+237690000001  variables=["Awa", "tomorrow between 2 pm and 4 pm"]
Awa      : "Hello Awa, your delivery is planned tomorrow between 2 pm and 4 pm. Will you be there?"
           [ Yes ]  [ No, reschedule ]
Awa      : (taps "No, reschedule")
Webhook  : message.inbound  type=text  text="No, reschedule"
```

## Code

1. Create the template with `"kind": "quick_reply"` buttons (no `url`):

```bash
# curl
curl -X POST "https://wa-api.geskap.com/v1/templates" \
  -H "Authorization: Bearer $GESKAP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "livraison_demain_presence",
  "language": "fr",
  "category": "UTILITY",
  "body_text": "Bonjour {{1}}, votre livraison est prévue {{2}}. Serez-vous présente ?",
  "example_values": ["Awa", "demain entre 14 h et 16 h"],
  "buttons": [
    { "kind": "quick_reply", "text": "Oui" },
    { "kind": "quick_reply", "text": "Non, reporter" }
  ]
}'
```

```js
// Node.js
const res = await fetch("https://wa-api.geskap.com/v1/templates", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.GESKAP_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "name": "livraison_demain_presence",
    "language": "fr",
    "category": "UTILITY",
    "body_text": "Bonjour {{1}}, votre livraison est prévue {{2}}. Serez-vous présente ?",
    "example_values": ["Awa", "demain entre 14 h et 16 h"],
    "buttons": [
      { "kind": "quick_reply", "text": "Oui" },
      { "kind": "quick_reply", "text": "Non, reporter" }
    ]
  }),
});
console.log(res.status, await res.json());
```

```php
// PHP
$ch = curl_init("https://wa-api.geskap.com/v1/templates");
curl_setopt_array($ch, [
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer " . getenv("GESKAP_API_KEY"),
    "Content-Type: application/json",
  ],
  CURLOPT_POSTFIELDS => json_encode([
    "name" => "livraison_demain_presence",
    "language" => "fr",
    "category" => "UTILITY",
    "body_text" => "Bonjour {{1}}, votre livraison est prévue {{2}}. Serez-vous présente ?",
    "example_values" => ["Awa", "demain entre 14 h et 16 h"],
    "buttons" => [
      ["kind" => "quick_reply", "text" => "Oui"],
      ["kind" => "quick_reply", "text" => "Non, reporter"],
    ],
  ]),
]);
$res = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), " ", $res;
```

```python
# Python
import os, requests

res = requests.request(
    "POST",
    "https://wa-api.geskap.com/v1/templates",
    headers={"Authorization": f"Bearer {os.environ['GESKAP_API_KEY']}"},
    json={
        "name": "livraison_demain_presence",
        "language": "fr",
        "category": "UTILITY",
        "body_text": "Bonjour {{1}}, votre livraison est prévue {{2}}. Serez-vous présente ?",
        "example_values": ["Awa", "demain entre 14 h et 16 h"],
        "buttons": [
            {"kind": "quick_reply", "text": "Oui"},
            {"kind": "quick_reply", "text": "Non, reporter"},
        ],
    },
    timeout=15,
)
print(res.status_code, res.json())
```

1. Once `APPROVED`, send it like any template:

```bash
# curl
curl -X POST "https://wa-api.geskap.com/v1/messages" \
  -H "Authorization: Bearer $GESKAP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "to": "+237690000001",
  "template": {
    "name": "livraison_demain_presence",
    "language": "fr",
    "variables": ["Awa", "demain entre 14 h et 16 h"],
    "button_payloads": ["livraison:CMD-1042:oui", "livraison:CMD-1042:reporter"]
  },
  "idempotency_key": "livraison-CMD-1042"
}'
```

```js
// Node.js
const res = await fetch("https://wa-api.geskap.com/v1/messages", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.GESKAP_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "to": "+237690000001",
    "template": {
      "name": "livraison_demain_presence",
      "language": "fr",
      "variables": ["Awa", "demain entre 14 h et 16 h"],
      "button_payloads": ["livraison:CMD-1042:oui", "livraison:CMD-1042:reporter"]
    },
    "idempotency_key": "livraison-CMD-1042"
  }),
});
console.log(res.status, await res.json());
```

```php
// PHP
$ch = curl_init("https://wa-api.geskap.com/v1/messages");
curl_setopt_array($ch, [
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer " . getenv("GESKAP_API_KEY"),
    "Content-Type: application/json",
  ],
  CURLOPT_POSTFIELDS => json_encode([
    "to" => "+237690000001",
    "template" => [
      "name" => "livraison_demain_presence",
      "language" => "fr",
      "variables" => ["Awa", "demain entre 14 h et 16 h"],
      "button_payloads" => ["livraison:CMD-1042:oui", "livraison:CMD-1042:reporter"],
    ],
    "idempotency_key" => "livraison-CMD-1042",
  ]),
]);
$res = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), " ", $res;
```

```python
# Python
import os, requests

res = requests.request(
    "POST",
    "https://wa-api.geskap.com/v1/messages",
    headers={"Authorization": f"Bearer {os.environ['GESKAP_API_KEY']}"},
    json={
        "to": "+237690000001",
        "template": {
            "name": "livraison_demain_presence",
            "language": "fr",
            "variables": ["Awa", "demain entre 14 h et 16 h"],
            "button_payloads": ["livraison:CMD-1042:oui", "livraison:CMD-1042:reporter"],
        },
        "idempotency_key": "livraison-CMD-1042",
    },
    timeout=15,
)
print(res.status_code, res.json())
```

## Exact rules

| Item | Rule |
|---|---|
| Number of buttons | 2 at most per template |
| Label (`text`) | 25 characters at most |
| Type | `quick_reply`: no link (`url` is ignored) |
| Mixing | do not mix `quick_reply` and `url` buttons in one template |

The tap is an inbound message with `type: "text"`; its `text` is the tapped label. See [Know which button the customer tapped](https://console.geskap.com/docs/recuperer-le-clic?lang=en).

> **Tap identifier:** at send time, add `template.button_payloads`: one string per button, in order (2 at most, 256 characters at most), for example `["mission:123:confirm", "mission:123:decline"]`. On the tap, that string comes back in `button_id` (the `message.inbound` event, `GET /v1/messages/inbound`, the MCP tool): branch on it, not on the label. Without `button_payloads`, `button_id` is only the button label ("Yes"), so two sends can no longer be told apart. Meta accepts this identifier only at send time, never when creating the template; `button_payloads` is refused when the template has no `quick_reply` button.

> **Pitfall:** the label is part of the approved template. To change it you must submit a new version to Meta. Pick short, stable labels ("Yes", "No, reschedule").

> **Pitfall:** after the tap, the customer has written to you: the 24 h window is open, you can answer in [free text](https://console.geskap.com/docs/repondre-texte-libre?lang=en) or with [buttons without a template](https://console.geskap.com/docs/boutons-reponse-rapide?lang=en). For the full appointment reminder flow: [Reminder the day before](https://console.geskap.com/docs/rappel-rendez-vous-veille?lang=en).

A button that opens a web page is another button type, which can even carry a different link per customer: see [Variable link in a button](https://console.geskap.com/docs/lien-variable-bouton?lang=en). First send, statuses and errors: [Message a customer who never wrote to you](https://console.geskap.com/docs/ecrire-premier-message?lang=en).

_Proof — verified in the API source: api_schemas.py, templates.py, meta_webhooks.py, README.md._

---

# Mettre des boutons de réponse rapide dans un template (hors 24 h)

_Oui : deux boutons quick_reply au maximum dans un template approuvé par Meta ; le clic revient en message.inbound avec le libellé touché, et rouvre la fenêtre de 24 h._

Mots-clés: boutons template, bouton réponse rapide template, quick_reply, boutons hors 24h, boutons avec template, bouton Oui Non, boutons sur notification, button payload, bouton Confirmer, bouton Annuler, 2 boutons, bouton cliquable notification

## Scénario

Vous notifiez un client hors des 24 h (livraison prévue demain, offre, enquête) et vous voulez qu'il réponde d'un clic : « Oui » ou « Non », au lieu de taper.

**Oui, un template peut porter des boutons de réponse rapide.** C'est la version « hors 24 h » des [boutons sans template](https://console.geskap.com/docs/boutons-reponse-rapide), avec deux différences : le template doit être **approuvé par Meta** avant l'envoi, et il y a **2 boutons au maximum** (3 sans template).

## Conversation

```text
Vous    : POST /v1/messages  to=+237690000001  variables=["Awa", "demain entre 14 h et 16 h"]
Awa     : « Bonjour Awa, votre livraison est prévue demain entre 14 h et 16 h. Serez-vous présente ? »
          [ Oui ]  [ Non, reporter ]
Awa     : (touche « Non, reporter »)
Webhook : message.inbound  type=text  text="Non, reporter"
```

## Code

1. Créez le template avec des boutons `"kind": "quick_reply"` (sans `url`) :

```bash
# curl
curl -X POST "https://wa-api.geskap.com/v1/templates" \
  -H "Authorization: Bearer $GESKAP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "livraison_demain_presence",
  "language": "fr",
  "category": "UTILITY",
  "body_text": "Bonjour {{1}}, votre livraison est prévue {{2}}. Serez-vous présente ?",
  "example_values": ["Awa", "demain entre 14 h et 16 h"],
  "buttons": [
    { "kind": "quick_reply", "text": "Oui" },
    { "kind": "quick_reply", "text": "Non, reporter" }
  ]
}'
```

```js
// Node.js
const res = await fetch("https://wa-api.geskap.com/v1/templates", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.GESKAP_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "name": "livraison_demain_presence",
    "language": "fr",
    "category": "UTILITY",
    "body_text": "Bonjour {{1}}, votre livraison est prévue {{2}}. Serez-vous présente ?",
    "example_values": ["Awa", "demain entre 14 h et 16 h"],
    "buttons": [
      { "kind": "quick_reply", "text": "Oui" },
      { "kind": "quick_reply", "text": "Non, reporter" }
    ]
  }),
});
console.log(res.status, await res.json());
```

```php
// PHP
$ch = curl_init("https://wa-api.geskap.com/v1/templates");
curl_setopt_array($ch, [
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer " . getenv("GESKAP_API_KEY"),
    "Content-Type: application/json",
  ],
  CURLOPT_POSTFIELDS => json_encode([
    "name" => "livraison_demain_presence",
    "language" => "fr",
    "category" => "UTILITY",
    "body_text" => "Bonjour {{1}}, votre livraison est prévue {{2}}. Serez-vous présente ?",
    "example_values" => ["Awa", "demain entre 14 h et 16 h"],
    "buttons" => [
      ["kind" => "quick_reply", "text" => "Oui"],
      ["kind" => "quick_reply", "text" => "Non, reporter"],
    ],
  ]),
]);
$res = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), " ", $res;
```

```python
# Python
import os, requests

res = requests.request(
    "POST",
    "https://wa-api.geskap.com/v1/templates",
    headers={"Authorization": f"Bearer {os.environ['GESKAP_API_KEY']}"},
    json={
        "name": "livraison_demain_presence",
        "language": "fr",
        "category": "UTILITY",
        "body_text": "Bonjour {{1}}, votre livraison est prévue {{2}}. Serez-vous présente ?",
        "example_values": ["Awa", "demain entre 14 h et 16 h"],
        "buttons": [
            {"kind": "quick_reply", "text": "Oui"},
            {"kind": "quick_reply", "text": "Non, reporter"},
        ],
    },
    timeout=15,
)
print(res.status_code, res.json())
```

1. Une fois `APPROVED`, envoyez-le comme n'importe quel template :

```bash
# curl
curl -X POST "https://wa-api.geskap.com/v1/messages" \
  -H "Authorization: Bearer $GESKAP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "to": "+237690000001",
  "template": {
    "name": "livraison_demain_presence",
    "language": "fr",
    "variables": ["Awa", "demain entre 14 h et 16 h"],
    "button_payloads": ["livraison:CMD-1042:oui", "livraison:CMD-1042:reporter"]
  },
  "idempotency_key": "livraison-CMD-1042"
}'
```

```js
// Node.js
const res = await fetch("https://wa-api.geskap.com/v1/messages", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.GESKAP_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "to": "+237690000001",
    "template": {
      "name": "livraison_demain_presence",
      "language": "fr",
      "variables": ["Awa", "demain entre 14 h et 16 h"],
      "button_payloads": ["livraison:CMD-1042:oui", "livraison:CMD-1042:reporter"]
    },
    "idempotency_key": "livraison-CMD-1042"
  }),
});
console.log(res.status, await res.json());
```

```php
// PHP
$ch = curl_init("https://wa-api.geskap.com/v1/messages");
curl_setopt_array($ch, [
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer " . getenv("GESKAP_API_KEY"),
    "Content-Type: application/json",
  ],
  CURLOPT_POSTFIELDS => json_encode([
    "to" => "+237690000001",
    "template" => [
      "name" => "livraison_demain_presence",
      "language" => "fr",
      "variables" => ["Awa", "demain entre 14 h et 16 h"],
      "button_payloads" => ["livraison:CMD-1042:oui", "livraison:CMD-1042:reporter"],
    ],
    "idempotency_key" => "livraison-CMD-1042",
  ]),
]);
$res = curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE), " ", $res;
```

```python
# Python
import os, requests

res = requests.request(
    "POST",
    "https://wa-api.geskap.com/v1/messages",
    headers={"Authorization": f"Bearer {os.environ['GESKAP_API_KEY']}"},
    json={
        "to": "+237690000001",
        "template": {
            "name": "livraison_demain_presence",
            "language": "fr",
            "variables": ["Awa", "demain entre 14 h et 16 h"],
            "button_payloads": ["livraison:CMD-1042:oui", "livraison:CMD-1042:reporter"],
        },
        "idempotency_key": "livraison-CMD-1042",
    },
    timeout=15,
)
print(res.status_code, res.json())
```

## Règles exactes

| Élément | Règle |
|---|---|
| Nombre de boutons | 2 au maximum par template |
| Libellé (`text`) | 25 caractères au plus |
| Type | `quick_reply` : pas de lien (`url` est ignoré) |
| Mélange | ne mélangez pas boutons `quick_reply` et boutons `url` dans un même template |

Le clic est un message entrant `type: "text"` ; son `text` est le libellé touché. Voir [Savoir quel bouton le client a touché](https://console.geskap.com/docs/recuperer-le-clic).

> **Identifiant du clic :** à l'envoi, ajoutez `template.button_payloads` : un texte par bouton, dans l'ordre (2 au plus, 256 caractères au plus), par exemple `["mission:123:confirm", "mission:123:decline"]`. Au clic, ce texte revient dans `button_id` (événement `message.inbound`, `GET /v1/messages/inbound`, outil MCP) : aiguillez dessus, pas sur le libellé. Sans `button_payloads`, `button_id` vaut seulement le libellé du bouton (« Oui ») : deux envois ne se distinguent alors plus. Meta n'accepte cet identifiant qu'à l'envoi, jamais à la création du template ; `button_payloads` est refusé si le template n'a pas de bouton `quick_reply`.

> **Piège :** le libellé fait partie du template approuvé. Pour le changer, il faut soumettre une nouvelle version à Meta. Choisissez des libellés courts et stables (« Oui », « Non, reporter »).

> **Piège :** après le clic, le client vous a écrit : la fenêtre de 24 h est ouverte, vous pouvez répondre en [texte libre](https://console.geskap.com/docs/repondre-texte-libre) ou avec des [boutons sans template](https://console.geskap.com/docs/boutons-reponse-rapide). Pour le parcours complet d'un rappel de rendez-vous : [Rappel la veille](https://console.geskap.com/docs/rappel-rendez-vous-veille).

Un bouton qui ouvre une page web est un autre type de bouton, qui peut même porter un lien différent par client : voir [Lien variable dans un bouton](https://console.geskap.com/docs/lien-variable-bouton). Premier envoi, statuts et erreurs : [Écrire à un client qui ne vous a jamais écrit](https://console.geskap.com/docs/ecrire-premier-message).

_Preuve — vérifié dans le code de l'API : api_schemas.py, templates.py, meta_webhooks.py, README.md._

Support: WhatsApp +237 6 56 09 88 31 · All recipes: https://wa-api.geskap.com/llms.txt
