# Abandoned cart and personalised promo code (marketing messages)

_Yes, with a MARKETING template: a per-customer promo code as a variable, a link to their cart as a button. Marketing sending is allowed by default on new accounts._

Keywords: abandoned cart, promo code, promotion, campaign, marketing, cart recovery, coupon, discount, personalised offer, whatsapp newsletter, broadcast

## Scenario

A customer left a cart two hours ago. Your shop sends them a discount code **in their name** and a button that reopens **their** cart.

## Conversation

```text
You      : Hello Awa, your cart is waiting! With code AWA-10, 10% off until Sunday.
           [ Back to my cart ]   → https://shop.example.com/cart/c8f2a1
Customer : (taps the button)
```

## Marketing sends

Since 2026-11-24, sending `MARKETING` templates is **allowed by default** on new accounts, at the same credit cost as the utility category (the per-second and per-day limits cover the risk). An account created before that date keeps its setting: if it returns `403` "Catégorie MARKETING non activée pour cette clé", message support on WhatsApp +237 6 56 09 88 31 to enable it.

## Code

```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": "panier_abandonne",
  "language": "fr",
  "category": "MARKETING",
  "body_text": "Bonjour {{1}}, votre panier vous attend ! Avec le code {{2}}, profitez de -10 % jusqu'\''à {{3}}.",
  "example_values": ["Awa", "AWA-10", "dimanche"],
  "buttons": [
    {
      "kind": "url",
      "text": "Reprendre mon panier",
      "url": "https://boutique.exemple.com/panier/{{1}}",
      "url_example": "https://boutique.exemple.com/panier/c8f2a1"
    }
  ]
}'
```

```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": "panier_abandonne",
    "language": "fr",
    "category": "MARKETING",
    "body_text": "Bonjour {{1}}, votre panier vous attend ! Avec le code {{2}}, profitez de -10 % jusqu'à {{3}}.",
    "example_values": ["Awa", "AWA-10", "dimanche"],
    "buttons": [
      {
        "kind": "url",
        "text": "Reprendre mon panier",
        "url": "https://boutique.exemple.com/panier/{{1}}",
        "url_example": "https://boutique.exemple.com/panier/c8f2a1"
      }
    ]
  }),
});
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" => "panier_abandonne",
    "language" => "fr",
    "category" => "MARKETING",
    "body_text" => "Bonjour {{1}}, votre panier vous attend ! Avec le code {{2}}, profitez de -10 % jusqu'à {{3}}.",
    "example_values" => ["Awa", "AWA-10", "dimanche"],
    "buttons" => [
      [
        "kind" => "url",
        "text" => "Reprendre mon panier",
        "url" => "https://boutique.exemple.com/panier/{{1}}",
        "url_example" => "https://boutique.exemple.com/panier/c8f2a1",
      ],
    ],
  ]),
]);
$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": "panier_abandonne",
        "language": "fr",
        "category": "MARKETING",
        "body_text": "Bonjour {{1}}, votre panier vous attend ! Avec le code {{2}}, profitez de -10 % jusqu'à {{3}}.",
        "example_values": ["Awa", "AWA-10", "dimanche"],
        "buttons": [
            {
                "kind": "url",
                "text": "Reprendre mon panier",
                "url": "https://boutique.exemple.com/panier/{{1}}",
                "url_example": "https://boutique.exemple.com/panier/c8f2a1",
            },
        ],
    },
    timeout=15,
)
print(res.status_code, res.json())
```

```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": "+237690000002",
  "template": {
    "name": "panier_abandonne",
    "language": "fr",
    "variables": ["Awa", "AWA-10", "dimanche"],
    "button_url_param": "c8f2a1"
  }
}'
```

```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": "+237690000002",
    "template": {
      "name": "panier_abandonne",
      "language": "fr",
      "variables": ["Awa", "AWA-10", "dimanche"],
      "button_url_param": "c8f2a1"
    }
  }),
});
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" => "+237690000002",
    "template" => [
      "name" => "panier_abandonne",
      "language" => "fr",
      "variables" => ["Awa", "AWA-10", "dimanche"],
      "button_url_param" => "c8f2a1",
    ],
  ]),
]);
$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": "+237690000002",
        "template": {
            "name": "panier_abandonne",
            "language": "fr",
            "variables": ["Awa", "AWA-10", "dimanche"],
            "button_url_param": "c8f2a1",
        },
    },
    timeout=15,
)
print(res.status_code, res.json())
```

> **Pitfall:** a customer who never agreed to your commercial messages reports you, and a number reported too often gets limited by Meta. Only send to customers who opted in, and honour "STOP": [Handle unsubscribes](https://console.geskap.com/docs/stop-desinscription?lang=en).

> **Pitfall:** the promo code is a **body variable**, not a button variable. The button has a single variable: the end of its link (`button_url_param`).

Cost: the marketing platform fee (`GET /v1/pricing`), plus Meta's marketing rate, billed on your Meta account. See [Cost of a message](https://console.geskap.com/docs/cout-d-un-message?lang=en).

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

---

# Panier abandonné et code promo personnalisé (messages marketing)

_Oui, avec un template MARKETING : un code promo propre à chaque client en variable, un lien vers son panier en bouton. L'envoi marketing est autorisé par défaut sur les nouveaux comptes._

Mots-clés: panier abandonné, code promo, promotion, campagne, marketing, relance panier, coupon, réduction, offre personnalisée, newsletter whatsapp, diffusion

## Scénario

Un client a laissé un panier il y a deux heures. Votre boutique lui envoie un code de réduction **à son nom** et un bouton qui rouvre **son** panier.

## Conversation

```text
Vous    : Bonjour Awa, votre panier vous attend ! Avec le code AWA-10, -10 % jusqu'à dimanche.
          [ Reprendre mon panier ]   → https://boutique.exemple.com/panier/c8f2a1
Client  : (touche le bouton)
```

## L'envoi marketing

Depuis le 24/11/2026, l'envoi des templates `MARKETING` est **autorisé par défaut** sur les nouveaux comptes, au même coût en crédits que la catégorie utility (les limites de débit et de messages par jour couvrent le risque). Un compte créé avant cette date garde son réglage : s'il répond `403` « Catégorie MARKETING non activée pour cette clé », écrivez au support WhatsApp +237 6 56 09 88 31 pour l'activer.

## Code

```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": "panier_abandonne",
  "language": "fr",
  "category": "MARKETING",
  "body_text": "Bonjour {{1}}, votre panier vous attend ! Avec le code {{2}}, profitez de -10 % jusqu'\''à {{3}}.",
  "example_values": ["Awa", "AWA-10", "dimanche"],
  "buttons": [
    {
      "kind": "url",
      "text": "Reprendre mon panier",
      "url": "https://boutique.exemple.com/panier/{{1}}",
      "url_example": "https://boutique.exemple.com/panier/c8f2a1"
    }
  ]
}'
```

```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": "panier_abandonne",
    "language": "fr",
    "category": "MARKETING",
    "body_text": "Bonjour {{1}}, votre panier vous attend ! Avec le code {{2}}, profitez de -10 % jusqu'à {{3}}.",
    "example_values": ["Awa", "AWA-10", "dimanche"],
    "buttons": [
      {
        "kind": "url",
        "text": "Reprendre mon panier",
        "url": "https://boutique.exemple.com/panier/{{1}}",
        "url_example": "https://boutique.exemple.com/panier/c8f2a1"
      }
    ]
  }),
});
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" => "panier_abandonne",
    "language" => "fr",
    "category" => "MARKETING",
    "body_text" => "Bonjour {{1}}, votre panier vous attend ! Avec le code {{2}}, profitez de -10 % jusqu'à {{3}}.",
    "example_values" => ["Awa", "AWA-10", "dimanche"],
    "buttons" => [
      [
        "kind" => "url",
        "text" => "Reprendre mon panier",
        "url" => "https://boutique.exemple.com/panier/{{1}}",
        "url_example" => "https://boutique.exemple.com/panier/c8f2a1",
      ],
    ],
  ]),
]);
$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": "panier_abandonne",
        "language": "fr",
        "category": "MARKETING",
        "body_text": "Bonjour {{1}}, votre panier vous attend ! Avec le code {{2}}, profitez de -10 % jusqu'à {{3}}.",
        "example_values": ["Awa", "AWA-10", "dimanche"],
        "buttons": [
            {
                "kind": "url",
                "text": "Reprendre mon panier",
                "url": "https://boutique.exemple.com/panier/{{1}}",
                "url_example": "https://boutique.exemple.com/panier/c8f2a1",
            },
        ],
    },
    timeout=15,
)
print(res.status_code, res.json())
```

```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": "+237690000002",
  "template": {
    "name": "panier_abandonne",
    "language": "fr",
    "variables": ["Awa", "AWA-10", "dimanche"],
    "button_url_param": "c8f2a1"
  }
}'
```

```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": "+237690000002",
    "template": {
      "name": "panier_abandonne",
      "language": "fr",
      "variables": ["Awa", "AWA-10", "dimanche"],
      "button_url_param": "c8f2a1"
    }
  }),
});
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" => "+237690000002",
    "template" => [
      "name" => "panier_abandonne",
      "language" => "fr",
      "variables" => ["Awa", "AWA-10", "dimanche"],
      "button_url_param" => "c8f2a1",
    ],
  ]),
]);
$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": "+237690000002",
        "template": {
            "name": "panier_abandonne",
            "language": "fr",
            "variables": ["Awa", "AWA-10", "dimanche"],
            "button_url_param": "c8f2a1",
        },
    },
    timeout=15,
)
print(res.status_code, res.json())
```

> **Piège :** un client qui n'a pas accepté vos messages commerciaux vous signale, et un numéro trop signalé est limité par Meta. N'envoyez qu'aux clients consentants, et honorez « STOP » : [Gérer les désinscriptions](https://console.geskap.com/docs/stop-desinscription).

> **Piège :** le code promo est une **variable du texte**, pas du bouton. Le bouton n'a qu'une variable : la fin de son lien (`button_url_param`).

Coût : frais plateforme de la catégorie marketing (`GET /v1/pricing`), plus le tarif marketing de Meta, facturé sur votre compte Meta. Voir [Coût d'un message](https://console.geskap.com/docs/cout-d-un-message).

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

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