# I run a bank or microfinance institution

_Yes: instant receipt after a field collection (PDF possible), repayment due date, balance behind a link + PIN and verification code, with the API._

Keywords: bank, microfinance, collection, receipt, due date, repayment, balance, savings account, OTP, field agent, savings group

## What you can automate

| Need | How | Recipe |
|---|---|---|
| Receipt after a field collection | Within 24 h: free text. Otherwise: `recu_collecte` template with the receipt as a PDF header. | [PDF in the header](https://console.geskap.com/docs/document-pdf-en-tete?lang=en) · [Reply in free text](https://console.geskap.com/docs/repondre-texte-libre?lang=en) |
| Repayment due date | `echeance_remboursement` template a few days before the date; a different template for a late reminder. | [Unpaid reminder](https://console.geskap.com/docs/relance-impaye?lang=en) · [Template buttons](https://console.geskap.com/docs/boutons-template-reponse-rapide?lang=en) |
| Balance and transactions | The customer asks, so they are within 24 h: a message with a personal link + PIN. The balance is never written in WhatsApp. | [Sensitive data: link and PIN](https://console.geskap.com/docs/donnees-sensibles-lien-pin?lang=en) · [Recognise the customer by number](https://console.geskap.com/docs/reconnaitre-client-par-numero?lang=en) |
| Account opening welcomed | `compte_ouvert` template with the name of the field agent. | [Write the first message](https://console.geskap.com/docs/ecrire-premier-message?lang=en) |
| Verification code (OTP) | As free-form text within 24 h, or via a single-use link; the native OTP template is not usable through the API yet. | [OTP code](https://console.geskap.com/docs/code-otp?lang=en) |

Outside the 24 h that follow the customer's last message, only a Meta-approved template can be sent. Within 24 h you compose freely: buttons (3, 20 characters at most), a list (10 rows of 24 characters at most) or free text.

## Templates to create

| Name | Category | Text | Buttons |
|---|---|---|---|
| `recu_collecte` | UTILITY | Hello {{1}}, we have received your payment of {{2}} on {{3}} (reference {{4}}). Your receipt is attached to this message as a PDF. Thank you for your trust. | PDF header |
| `echeance_remboursement` | UTILITY | Hello {{1}}, your instalment of {{2}} is due on {{3}}. You can pay your field agent or at a branch. If you have already paid, please ignore this message. | quick reply: « Talk to an advisor » |
| `compte_ouvert` | UTILITY | Hello {{1}}, your account no. {{2}} is open at Microfinance Exemple. Your field agent is {{3}}. Your PIN is given to you by the agent, never by message. | — |

## Full example

Collection receipt, with the receipt PDF as a header. Creation, once: the sample PDF is sent as base64 with its MIME type.

```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": "recu_collecte",
  "language": "en",
  "category": "UTILITY",
  "body_text": "Hello {{1}}, we have received your payment of {{2}} on {{3}} (reference {{4}}). Your receipt is attached to this message as a PDF. Thank you for your trust.",
  "example_values": ["Awa", "5,000 F", "October 30", "COL-2087"],
  "header_image_mime": "application/pdf",
  "header_image_base64": "JVBERi0xLjQK…"
}'
```

```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": "recu_collecte",
    "language": "en",
    "category": "UTILITY",
    "body_text": "Hello {{1}}, we have received your payment of {{2}} on {{3}} (reference {{4}}). Your receipt is attached to this message as a PDF. Thank you for your trust.",
    "example_values": ["Awa", "5,000 F", "October 30", "COL-2087"],
    "header_image_mime": "application/pdf",
    "header_image_base64": "JVBERi0xLjQK…"
  }),
});
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" => "recu_collecte",
    "language" => "en",
    "category" => "UTILITY",
    "body_text" => "Hello {{1}}, we have received your payment of {{2}} on {{3}} (reference {{4}}). Your receipt is attached to this message as a PDF. Thank you for your trust.",
    "example_values" => ["Awa", "5,000 F", "October 30", "COL-2087"],
    "header_image_mime" => "application/pdf",
    "header_image_base64" => "JVBERi0xLjQK…",
  ]),
]);
$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": "recu_collecte",
        "language": "en",
        "category": "UTILITY",
        "body_text": "Hello {{1}}, we have received your payment of {{2}} on {{3}} (reference {{4}}). Your receipt is attached to this message as a PDF. Thank you for your trust.",
        "example_values": ["Awa", "5,000 F", "October 30", "COL-2087"],
        "header_image_mime": "application/pdf",
        "header_image_base64": "JVBERi0xLjQK…",
    },
    timeout=15,
)
print(res.status_code, res.json())
```

Send it right after each payment. `header_document_url` is the public address of today's PDF, `header_document_filename` the name shown in the bubble.

```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": "+237690000016",
  "template": {
    "name": "recu_collecte",
    "language": "en",
    "variables": ["Awa", "5,000 F", "October 30", "COL-2087"],
    "header_document_url": "https://exemple-microfinance.test/recus/COL-2087.pdf",
    "header_document_filename": "recu-COL-2087.pdf"
  }
}'
```

```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": "+237690000016",
    "template": {
      "name": "recu_collecte",
      "language": "en",
      "variables": ["Awa", "5,000 F", "October 30", "COL-2087"],
      "header_document_url": "https://exemple-microfinance.test/recus/COL-2087.pdf",
      "header_document_filename": "recu-COL-2087.pdf"
    }
  }),
});
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" => "+237690000016",
    "template" => [
      "name" => "recu_collecte",
      "language" => "en",
      "variables" => ["Awa", "5,000 F", "October 30", "COL-2087"],
      "header_document_url" => "https://exemple-microfinance.test/recus/COL-2087.pdf",
      "header_document_filename" => "recu-COL-2087.pdf",
    ],
  ]),
]);
$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": "+237690000016",
        "template": {
            "name": "recu_collecte",
            "language": "en",
            "variables": ["Awa", "5,000 F", "October 30", "COL-2087"],
            "header_document_url": "https://exemple-microfinance.test/recus/COL-2087.pdf",
            "header_document_filename": "recu-COL-2087.pdf",
        },
    },
    timeout=15,
)
print(res.status_code, res.json())
```

## Conversation

```text
Customer: Hello, what is my balance?
Bank     : For your security, confirm your identity with your PIN.
           The link is personal and expires in 10 minutes. We will never ask for your PIN here.
           https://exemple-microfinance.test/connexion/ab12cd
Customer : (opens the link, types the PIN on the page: the balance is shown there)
Customer : Thanks
Bank     : My pleasure, Awa.  [ My transactions ]  [ Menu ]
Webhook  : message.inbound  type=text  text="My transactions"  button_id="operations"  (when they tap a button)
```

The principle is detailed in [Sensitive data: link and PIN](https://console.geskap.com/docs/donnees-sensibles-lien-pin?lang=en); the number identifies the customer thanks to [Recognise the customer by number](https://console.geskap.com/docs/reconnaitre-client-par-numero?lang=en).

> **Pitfall:** A balance, a full account number or a transaction history is never written in WhatsApp: a personal link + PIN typed on your page, never in the chat. If you show an account number, mask it (••••4821).

> **Pitfall:** don't send a verification code in a UTILITY template: Meta reclassifies or refuses it. See [OTP code](https://console.geskap.com/docs/code-otp?lang=en) for what works.

_Proof — verified in the API source: api_schemas.py ; applied by the WhatsApp demo: banque, engine._

---

# Je suis une banque ou une microfinance

_Oui : reçu instantané après une collecte terrain (PDF possible), échéance de remboursement, solde derrière lien + PIN et code de vérification, avec l'API._

Mots-clés: banque, microfinance, collecte, reçu, échéance, remboursement, solde, compte épargne, OTP, agent collecteur, tontine

## Ce que vous pouvez automatiser

| Besoin | Comment | Recette |
|---|---|---|
| Reçu après une collecte terrain | Dans les 24 h : texte libre. Sinon : template `recu_collecte` avec le reçu en PDF en en-tête. | [PDF en en-tête](https://console.geskap.com/docs/document-pdf-en-tete) · [Répondre en texte libre](https://console.geskap.com/docs/repondre-texte-libre) |
| Échéance de remboursement | Template `echeance_remboursement` quelques jours avant la date ; relance en cas de retard avec un autre template. | [Relance d'impayé](https://console.geskap.com/docs/relance-impaye) · [Boutons de template](https://console.geskap.com/docs/boutons-template-reponse-rapide) |
| Solde et opérations | Le client le demande donc il est dans les 24 h : message avec lien personnel + code PIN. Le solde n'est jamais écrit dans WhatsApp. | [Données sensibles : lien et PIN](https://console.geskap.com/docs/donnees-sensibles-lien-pin) · [Reconnaître le client par son numéro](https://console.geskap.com/docs/reconnaitre-client-par-numero) |
| Ouverture de compte accueillie | Template `compte_ouvert` avec le nom de l'agent collecteur. | [Écrire le premier message](https://console.geskap.com/docs/ecrire-premier-message) |
| Code de vérification (OTP) | En texte libre dans les 24 h, ou par lien unique ; le template OTP natif n'est pas encore utilisable par l'API. | [Code OTP](https://console.geskap.com/docs/code-otp) |

Hors des 24 h qui suivent le dernier message du client, seul un template approuvé par Meta peut partir. Dans les 24 h, vous composez librement : boutons (3 de 20 caractères au plus), liste (10 lignes de 24 caractères au plus) ou texte libre.

## Les templates à créer

| Nom | Catégorie | Texte | Boutons |
|---|---|---|---|
| `recu_collecte` | UTILITY | Bonjour {{1}}, nous avons bien reçu votre versement de {{2}} le {{3}} (référence {{4}}). Votre reçu est joint à ce message en PDF. Merci de votre confiance. | en-tête PDF |
| `echeance_remboursement` | UTILITY | Bonjour {{1}}, votre échéance de {{2}} est prévue le {{3}}. Vous pouvez régler auprès de votre agent collecteur ou en agence. Si vous avez déjà payé, merci d'ignorer ce message. | réponse rapide : « Parler à un conseiller » |
| `compte_ouvert` | UTILITY | Bonjour {{1}}, votre compte n° {{2}} est ouvert chez Microfinance Exemple. Votre agent collecteur est {{3}}. Votre code PIN vous est remis par l'agent, jamais par message. | — |

## Exemple complet

Reçu de collecte, avec le PDF du reçu en en-tête. Création, une seule fois : le PDF d'exemple est envoyé en base64 avec son type MIME.

```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": "recu_collecte",
  "language": "fr",
  "category": "UTILITY",
  "body_text": "Bonjour {{1}}, nous avons bien reçu votre versement de {{2}} le {{3}} (référence {{4}}). Votre reçu est joint à ce message en PDF. Merci de votre confiance.",
  "example_values": ["Awa", "5 000 F", "30 octobre", "COL-2087"],
  "header_image_mime": "application/pdf",
  "header_image_base64": "JVBERi0xLjQK…"
}'
```

```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": "recu_collecte",
    "language": "fr",
    "category": "UTILITY",
    "body_text": "Bonjour {{1}}, nous avons bien reçu votre versement de {{2}} le {{3}} (référence {{4}}). Votre reçu est joint à ce message en PDF. Merci de votre confiance.",
    "example_values": ["Awa", "5 000 F", "30 octobre", "COL-2087"],
    "header_image_mime": "application/pdf",
    "header_image_base64": "JVBERi0xLjQK…"
  }),
});
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" => "recu_collecte",
    "language" => "fr",
    "category" => "UTILITY",
    "body_text" => "Bonjour {{1}}, nous avons bien reçu votre versement de {{2}} le {{3}} (référence {{4}}). Votre reçu est joint à ce message en PDF. Merci de votre confiance.",
    "example_values" => ["Awa", "5 000 F", "30 octobre", "COL-2087"],
    "header_image_mime" => "application/pdf",
    "header_image_base64" => "JVBERi0xLjQK…",
  ]),
]);
$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": "recu_collecte",
        "language": "fr",
        "category": "UTILITY",
        "body_text": "Bonjour {{1}}, nous avons bien reçu votre versement de {{2}} le {{3}} (référence {{4}}). Votre reçu est joint à ce message en PDF. Merci de votre confiance.",
        "example_values": ["Awa", "5 000 F", "30 octobre", "COL-2087"],
        "header_image_mime": "application/pdf",
        "header_image_base64": "JVBERi0xLjQK…",
    },
    timeout=15,
)
print(res.status_code, res.json())
```

Envoi juste après chaque versement. `header_document_url` est l'adresse publique du PDF du jour, `header_document_filename` le nom affiché dans la bulle.

```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": "+237690000016",
  "template": {
    "name": "recu_collecte",
    "language": "fr",
    "variables": ["Awa", "5 000 F", "30 octobre", "COL-2087"],
    "header_document_url": "https://exemple-microfinance.test/recus/COL-2087.pdf",
    "header_document_filename": "recu-COL-2087.pdf"
  }
}'
```

```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": "+237690000016",
    "template": {
      "name": "recu_collecte",
      "language": "fr",
      "variables": ["Awa", "5 000 F", "30 octobre", "COL-2087"],
      "header_document_url": "https://exemple-microfinance.test/recus/COL-2087.pdf",
      "header_document_filename": "recu-COL-2087.pdf"
    }
  }),
});
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" => "+237690000016",
    "template" => [
      "name" => "recu_collecte",
      "language" => "fr",
      "variables" => ["Awa", "5 000 F", "30 octobre", "COL-2087"],
      "header_document_url" => "https://exemple-microfinance.test/recus/COL-2087.pdf",
      "header_document_filename" => "recu-COL-2087.pdf",
    ],
  ]),
]);
$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": "+237690000016",
        "template": {
            "name": "recu_collecte",
            "language": "fr",
            "variables": ["Awa", "5 000 F", "30 octobre", "COL-2087"],
            "header_document_url": "https://exemple-microfinance.test/recus/COL-2087.pdf",
            "header_document_filename": "recu-COL-2087.pdf",
        },
    },
    timeout=15,
)
print(res.status_code, res.json())
```

## Conversation

```text
Client  : Bonjour, quel est mon solde ?
Banque  : Pour votre sécurité, confirmez votre identité avec votre code PIN.
          Le lien est personnel et expire dans 10 minutes. Nous ne vous demanderons jamais votre PIN ici.
          https://exemple-microfinance.test/connexion/ab12cd
Client  : (ouvre le lien, saisit son PIN sur la page : le solde s'affiche là-bas)
Client  : Merci
Banque  : Avec plaisir, Awa.  [ Mes opérations ]  [ Menu ]
Webhook : message.inbound  type=text  text="Mes opérations"  button_id="operations"  (quand il touche un bouton)
```

Le principe est détaillé dans [Données sensibles : lien et PIN](https://console.geskap.com/docs/donnees-sensibles-lien-pin) ; le numéro identifie le client grâce à [Reconnaître le client par son numéro](https://console.geskap.com/docs/reconnaitre-client-par-numero).

> **Piège :** Un solde, un numéro de compte complet ou un historique d'opérations ne s'écrivent jamais dans WhatsApp : lien personnel + code PIN saisi sur votre page, jamais dans la conversation. Si vous montrez un numéro de compte, masquez-le (••••4821).

> **Piège :** n'envoyez pas de code de vérification dans un template UTILITY : Meta le requalifie ou le refuse. Voir [Code OTP](https://console.geskap.com/docs/code-otp) pour ce qui marche.

_Preuve — vérifié dans le code de l'API : api_schemas.py ; appliqué par la démo WhatsApp : banque, engine._

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