# Send an appointment reminder the day before, with Confirm and Cancel buttons

_Yes: your server triggers a scheduled send the day before (the API has no scheduler), with a UTILITY template carrying variables and two quick-reply buttons; the tap comes back on your webhook._

Keywords: appointment reminder, booking reminder, day before, D-1, scheduled send, schedule a message, cron, confirm appointment, cancel appointment, no-show, clinic, salon, utility template, confirm cancel buttons, appointment follow-up

## Scenario

A clinic wants fewer no-shows: the day before each appointment, the patient gets a reminder with two buttons, "Confirm" and "Cancel". One tap, nothing to type.

**Yes, it can be done.** Two things to know: the API **has no scheduler** (your own server decides when to send, for instance a cron job at 5 pm), and the reminder goes out **beyond the 24 h window**, so it must be a template. No template, no message: see [Message a customer who never wrote to you](https://console.geskap.com/docs/ecrire-premier-message?lang=en).

## Conversation

```text
Cron     : 17:00, tomorrow's appointments found in your database
You      : POST /v1/messages  to=+237690000001  variables=["Awa", "Thursday 5 November", "09:00", "Example Clinic"]
Awa      : "Hello Awa, reminder of your appointment tomorrow Thursday 5 November at 09:00 at Example Clinic."
           [ Confirm ]  [ Cancel ]
Awa      : (taps "Confirm")
Webhook  : message.inbound  from=+237690000001  type=text  text="Confirm"
```

## Code

1. Once, create the template (`UTILITY` category, two `quick_reply` buttons) and wait for `APPROVED`:

```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": "rappel_rdv_veille",
  "language": "fr",
  "category": "UTILITY",
  "body_text": "Bonjour {{1}}, rappel de votre rendez-vous demain {{2}} à {{3}} chez {{4}}.",
  "example_values": ["Awa", "jeudi 5 novembre", "09:00", "Clinique Exemple"],
  "buttons": [
    { "kind": "quick_reply", "text": "Confirmer" },
    { "kind": "quick_reply", "text": "Annuler" }
  ]
}'
```

```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": "rappel_rdv_veille",
    "language": "fr",
    "category": "UTILITY",
    "body_text": "Bonjour {{1}}, rappel de votre rendez-vous demain {{2}} à {{3}} chez {{4}}.",
    "example_values": ["Awa", "jeudi 5 novembre", "09:00", "Clinique Exemple"],
    "buttons": [
      { "kind": "quick_reply", "text": "Confirmer" },
      { "kind": "quick_reply", "text": "Annuler" }
    ]
  }),
});
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" => "rappel_rdv_veille",
    "language" => "fr",
    "category" => "UTILITY",
    "body_text" => "Bonjour {{1}}, rappel de votre rendez-vous demain {{2}} à {{3}} chez {{4}}.",
    "example_values" => ["Awa", "jeudi 5 novembre", "09:00", "Clinique Exemple"],
    "buttons" => [
      ["kind" => "quick_reply", "text" => "Confirmer"],
      ["kind" => "quick_reply", "text" => "Annuler"],
    ],
  ]),
]);
$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": "rappel_rdv_veille",
        "language": "fr",
        "category": "UTILITY",
        "body_text": "Bonjour {{1}}, rappel de votre rendez-vous demain {{2}} à {{3}} chez {{4}}.",
        "example_values": ["Awa", "jeudi 5 novembre", "09:00", "Clinique Exemple"],
        "buttons": [
            {"kind": "quick_reply", "text": "Confirmer"},
            {"kind": "quick_reply", "text": "Annuler"},
        ],
    },
    timeout=15,
)
print(res.status_code, res.json())
```

1. Each evening, for every appointment of the next day, send it:

```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": "rappel_rdv_veille",
    "language": "fr",
    "variables": ["Awa", "jeudi 5 novembre", "09:00", "Clinique Exemple"]
  },
  "idempotency_key": "rappel-RDV-2041"
}'
```

```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": "rappel_rdv_veille",
      "language": "fr",
      "variables": ["Awa", "jeudi 5 novembre", "09:00", "Clinique Exemple"]
    },
    "idempotency_key": "rappel-RDV-2041"
  }),
});
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" => "rappel_rdv_veille",
      "language" => "fr",
      "variables" => ["Awa", "jeudi 5 novembre", "09:00", "Clinique Exemple"],
    ],
    "idempotency_key" => "rappel-RDV-2041",
  ]),
]);
$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": "rappel_rdv_veille",
            "language": "fr",
            "variables": ["Awa", "jeudi 5 novembre", "09:00", "Clinique Exemple"],
        },
        "idempotency_key": "rappel-RDV-2041",
    },
    timeout=15,
)
print(res.status_code, res.json())
```

1. Your webhook receives the tap. Find the appointment from the `from` number: it is the one you sent the reminder to. See [Know which button the customer tapped](https://console.geskap.com/docs/recuperer-le-clic?lang=en) and [Recognise a customer by their number](https://console.geskap.com/docs/reconnaitre-client-par-numero?lang=en).

> **Pitfall:** a template button does not carry your appointment id. The tap only carries the tapped label (`text`, and `button_id`, which is Meta's payload, or the label when there is none). To know **which** appointment is confirmed, keep "last reminder sent to this number" on your side and attach the answer to it. If a patient has two appointments the same day, put both in one reminder (one variable) instead of sending two reminders.

> **Pitfall:** two buttons at most per template (3 for buttons without a template), 25 characters at most per label. To offer a new slot after a "Cancel", wait for the customer's reply: it reopens the 24 h window, and you can then send [slot buttons](https://console.geskap.com/docs/choix-creneau-places?lang=en) with no new template. See also [Confirm, cancel, change](https://console.geskap.com/docs/confirmer-annuler-modifier?lang=en).

> **Pitfall:** if the customer does not reply, nothing reaches your webhook: treat no answer as "not confirmed" on your server. The delivery status (`delivered`, `read`) does arrive, through `message.status`.

Send with an `idempotency_key` (e.g. `reminder-APPT-2041`): if your cron job replays, the customer does not get two reminders (see [Idempotency](https://console.geskap.com/docs/idempotence?lang=en)).

_Proof — verified in the API source: api_schemas.py, api_send.py, meta_webhooks.py._

---

# Envoyer un rappel de rendez-vous la veille, avec boutons Confirmer et Annuler

_Oui : votre serveur lance un envoi planifié la veille (l'API n'a pas de planificateur), avec un template UTILITY à variables et deux boutons de réponse rapide ; le clic revient sur votre webhook._

Mots-clés: rappel rendez-vous, rappel RDV, la veille, J-1, envoi programmé, planifier un message, cron, confirmer rendez-vous, annuler rendez-vous, no-show, absence, clinique, salon, template utility, boutons confirmer annuler, relance rendez-vous

## Scénario

Une clinique veut réduire les absences : la veille de chaque rendez-vous, le patient reçoit un rappel avec deux boutons, « Confirmer » et « Annuler ». Un clic suffit, il n'a rien à taper.

**Oui, c'est faisable.** Deux choses à savoir : l'API **n'a pas de planificateur** (c'est votre serveur qui décide de l'heure d'envoi, par exemple une tâche cron à 17 h), et le rappel part **hors des 24 h**, donc en template. Pas de template, pas de message : voir [Écrire à un client qui ne vous a jamais écrit](https://console.geskap.com/docs/ecrire-premier-message).

## Conversation

```text
Cron    : 17:00, rendez-vous de demain trouvés dans votre base
Vous    : POST /v1/messages  to=+237690000001  variables=["Awa", "jeudi 5 novembre", "09:00", "Clinique Exemple"]
Awa     : « Bonjour Awa, rappel de votre rendez-vous demain jeudi 5 novembre à 09:00 chez Clinique Exemple. »
          [ Confirmer ]  [ Annuler ]
Awa     : (touche « Confirmer »)
Webhook : message.inbound  from=+237690000001  type=text  text="Confirmer"
```

## Code

1. Une seule fois, créez le template (catégorie `UTILITY`, deux boutons `quick_reply`) et attendez `APPROVED` :

```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": "rappel_rdv_veille",
  "language": "fr",
  "category": "UTILITY",
  "body_text": "Bonjour {{1}}, rappel de votre rendez-vous demain {{2}} à {{3}} chez {{4}}.",
  "example_values": ["Awa", "jeudi 5 novembre", "09:00", "Clinique Exemple"],
  "buttons": [
    { "kind": "quick_reply", "text": "Confirmer" },
    { "kind": "quick_reply", "text": "Annuler" }
  ]
}'
```

```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": "rappel_rdv_veille",
    "language": "fr",
    "category": "UTILITY",
    "body_text": "Bonjour {{1}}, rappel de votre rendez-vous demain {{2}} à {{3}} chez {{4}}.",
    "example_values": ["Awa", "jeudi 5 novembre", "09:00", "Clinique Exemple"],
    "buttons": [
      { "kind": "quick_reply", "text": "Confirmer" },
      { "kind": "quick_reply", "text": "Annuler" }
    ]
  }),
});
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" => "rappel_rdv_veille",
    "language" => "fr",
    "category" => "UTILITY",
    "body_text" => "Bonjour {{1}}, rappel de votre rendez-vous demain {{2}} à {{3}} chez {{4}}.",
    "example_values" => ["Awa", "jeudi 5 novembre", "09:00", "Clinique Exemple"],
    "buttons" => [
      ["kind" => "quick_reply", "text" => "Confirmer"],
      ["kind" => "quick_reply", "text" => "Annuler"],
    ],
  ]),
]);
$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": "rappel_rdv_veille",
        "language": "fr",
        "category": "UTILITY",
        "body_text": "Bonjour {{1}}, rappel de votre rendez-vous demain {{2}} à {{3}} chez {{4}}.",
        "example_values": ["Awa", "jeudi 5 novembre", "09:00", "Clinique Exemple"],
        "buttons": [
            {"kind": "quick_reply", "text": "Confirmer"},
            {"kind": "quick_reply", "text": "Annuler"},
        ],
    },
    timeout=15,
)
print(res.status_code, res.json())
```

1. Chaque soir, pour chaque rendez-vous du lendemain, envoyez-le :

```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": "rappel_rdv_veille",
    "language": "fr",
    "variables": ["Awa", "jeudi 5 novembre", "09:00", "Clinique Exemple"]
  },
  "idempotency_key": "rappel-RDV-2041"
}'
```

```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": "rappel_rdv_veille",
      "language": "fr",
      "variables": ["Awa", "jeudi 5 novembre", "09:00", "Clinique Exemple"]
    },
    "idempotency_key": "rappel-RDV-2041"
  }),
});
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" => "rappel_rdv_veille",
      "language" => "fr",
      "variables" => ["Awa", "jeudi 5 novembre", "09:00", "Clinique Exemple"],
    ],
    "idempotency_key" => "rappel-RDV-2041",
  ]),
]);
$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": "rappel_rdv_veille",
            "language": "fr",
            "variables": ["Awa", "jeudi 5 novembre", "09:00", "Clinique Exemple"],
        },
        "idempotency_key": "rappel-RDV-2041",
    },
    timeout=15,
)
print(res.status_code, res.json())
```

1. Votre webhook reçoit le clic. Retrouvez le rendez-vous par le numéro `from` : c'est celui à qui vous avez envoyé le rappel. Voir [Savoir quel bouton le client a touché](https://console.geskap.com/docs/recuperer-le-clic) et [Reconnaître un client à son numéro](https://console.geskap.com/docs/reconnaitre-client-par-numero).

> **Piège :** un bouton de template n'embarque pas votre identifiant de rendez-vous. Le clic ne porte que le libellé touché (`text`, et `button_id` qui vaut le payload Meta, à défaut le libellé). Pour savoir **quel** rendez-vous est confirmé, gardez de votre côté « dernier rappel envoyé à ce numéro » et rattachez-y la réponse. Si un patient a deux rendez-vous le même jour, mettez les deux dans le même rappel (une variable) plutôt que d'envoyer deux rappels.

> **Piège :** deux boutons maximum par template (3 pour des boutons sans template), libellé de 25 caractères au plus. Pour proposer un nouveau créneau après un « Annuler », attendez la réponse du client : elle rouvre la fenêtre de 24 h, et vous pouvez alors envoyer des [boutons de créneau](https://console.geskap.com/docs/choix-creneau-places) sans nouveau template. Voir aussi [Confirmer, annuler, modifier](https://console.geskap.com/docs/confirmer-annuler-modifier).

> **Piège :** si le client ne répond pas, rien n'arrive sur votre webhook : traitez l'absence de réponse comme « non confirmé » côté serveur. Le statut de livraison (`delivered`, `read`) arrive, lui, par `message.status`.

Envoyez avec une `idempotency_key` (ex. `rappel-RDV-2041`) : si votre tâche cron rejoue, le client ne reçoit pas deux rappels (voir [Idempotence](https://console.geskap.com/docs/idempotence)).

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

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