# Connect WhatsApp to n8n, Zapier, a CRM or an LLM (ChatGPT, Claude)

_Yes: every received message arrives as a signed HTTPS POST on the address of your choice, so n8n, Zapier, a CRM or your own code can take it; for an LLM, message.inbound then your code then the model then POST /v1/messages/reply._

Keywords: n8n, zapier, make, CRM, LLM, ChatGPT, Claude, AI, AI agent, chatbot, webhook, automation, no-code, connect, integration, answer with AI, hubspot, connector, MCP, catch hook

## Scenario

You do not want to write a full server. You want every message received on your WhatsApp number to feed your CRM, trigger an n8n or Zapier scenario, or be handed to a large language model (LLM) that prepares the answer. **Yes, it is possible**, because the API only pushes an HTTPS POST: anything that can receive that POST can plug in.

## The principle

```text
WhatsApp customer
   │  writes
   ▼
Geskap API ──signed POST (message.inbound)──► your HTTPS address
                                                │  n8n, Zapier, CRM, or your code
                                                ▼
                                           (optional) LLM
                                                │
your code ──POST /v1/messages/reply──► Geskap API ──► WhatsApp customer
```

You register **one single address** per account in the console (Connection page, Webhook, HTTPS required). Every event arrives on that address: `message.inbound` (the customer wrote), `message.status` (status of one of your sends) and `message.echo` (a message sent from the phone's WhatsApp Business app, Coexistence numbers). Branch on `event`.

## n8n

A **Webhook** node (POST method, public address of your instance) receives the event. Paste that address in the console. Then branch on `event`, then on `data.button_id` if the customer tapped a button (see [Know which button the customer tapped](https://console.geskap.com/docs/recuperer-le-clic?lang=en)).

- The console gallery offers two n8n workflows already wired to your account: delivery tracking over WhatsApp and school report-card delivery. Neither is an "AI assistant": they are complete examples of how sending and button returns fit together.
- Those workflows protect their return address with a random token placed in the URL, not with signature verification. If your address is public, verify the signature (see [Verify a webhook signature](https://console.geskap.com/docs/webhook-verifier-signature?lang=en)) or keep a long secret token in the URL.

## Zapier, Make and any tool that receives an HTTPS POST

The criterion is simple: the tool must offer a public HTTPS address that accepts a JSON POST and answers 2xx within 8 seconds. Paste that address in the console, send yourself a WhatsApp message, and watch the event arrive.

- To **verify the signature**, the tool must give you the exact raw body. If it does not, you cannot recompute it: put a small relay in front of it that verifies, then forwards.
- The API expects no particular answer: a 2xx is enough. It does not retry.

## A CRM

On each `message.inbound`, write to your CRM the `from` (the customer's number), `contact_name`, `text`, `type` and `wa_message_id`. The latter is your de-duplication key. To recognize an already-known customer, see [Recognize a customer by phone number](https://console.geskap.com/docs/reconnaitre-client-par-numero?lang=en).

## An LLM (ChatGPT, Claude, or another model)

The API never calls a model for you: your code does. The pattern is the same for every provider.

```js
// Node.js
// Express — the webhook answers 200 first, the model works afterwards.
// verifyAndParse(req) = the signature check from the "Verify a webhook signature" recipe.
app.post("/webhooks/whatsapp", express.raw({ type: "application/json" }), (req, res) => {
  const payload = verifyAndParse(req);          // null when the signature is wrong
  if (!payload) return res.sendStatus(401);
  res.sendStatus(200);                          // one attempt, 8 s, no retry
  if (payload.event !== "message.inbound") return;   // never react to message.echo
  answerInBackground(payload.data).catch(console.error);
});

async function answerInBackground(msg) {
  const answer = await askYourModel(msg.text);  // your LLM call (any provider)
  await fetch("https://wa-api.geskap.com/v1/messages/reply", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GESKAP_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ to: msg.from, from: msg.number, text: answer }),
  });
}
```

```php
// PHP
<?php
// The webhook answers 200 first, the model works afterwards.
// verify_and_parse() = the signature check from the "Verify a webhook signature" recipe.
$payload = verify_and_parse(file_get_contents("php://input"));
if (!$payload) { http_response_code(401); exit; }
http_response_code(200);                      // one attempt, 8 s, no retry
if (function_exists("fastcgi_finish_request")) { fastcgi_finish_request(); }

if ($payload["event"] === "message.inbound") {   // never react to message.echo
    $msg = $payload["data"];
    $answer = ask_your_model($msg["text"]);   // your LLM call (any provider)
    $ch = curl_init("https://wa-api.geskap.com/v1/messages/reply");
    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_POST => true,
        CURLOPT_HTTPHEADER => [
            "Authorization: Bearer " . getenv("GESKAP_API_KEY"),
            "Content-Type: application/json",
        ],
        CURLOPT_POSTFIELDS => json_encode([
            "to" => $msg["from"], "from" => $msg["number"], "text" => $answer,
        ]),
    ]);
    curl_exec($ch);
}
```

```python
# Python
# Flask — the webhook answers 200 first, the model works afterwards.
# verify_and_parse() = the signature check from the "Verify a webhook signature" recipe.
import os, threading, requests

@app.post("/webhooks/whatsapp")
def whatsapp_webhook():
    payload = verify_and_parse(request)           # aborts with 401 if the signature is wrong
    if payload["event"] == "message.inbound":     # never react to message.echo
        threading.Thread(target=answer, args=(payload["data"],), daemon=True).start()
    return "", 200                                # one attempt, 8 s, no retry

def answer(msg):
    text = ask_your_model(msg["text"])            # your LLM call (any provider)
    requests.post(
        "https://wa-api.geskap.com/v1/messages/reply",
        headers={"Authorization": f"Bearer {os.environ['GESKAP_API_KEY']}"},
        json={"to": msg["from"], "from": msg["number"], "text": text},
        timeout=15,
    )
```

```bash
# curl
# What your code sends once the model has answered.
curl -X POST "https://wa-api.geskap.com/v1/messages/reply" \
  -H "Authorization: Bearer $GESKAP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to": "+237690000001", "from": "100000000000001", "text": "Bonjour Awa, votre rendez-vous est bien noté pour demain à 9 h."}'
```

The answer goes out through `POST /v1/messages/reply` with `from` set to `data.number`, to answer from the number that received:

```bash
# curl
curl -X POST "https://wa-api.geskap.com/v1/messages/reply" \
  -H "Authorization: Bearer $GESKAP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "to": "+237690000001",
  "from": "100000000000001",
  "text": "Bonjour Awa, votre rendez-vous est bien noté pour demain à 9 h."
}'
```

```js
// Node.js
const res = await fetch("https://wa-api.geskap.com/v1/messages/reply", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.GESKAP_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "to": "+237690000001",
    "from": "100000000000001",
    "text": "Bonjour Awa, votre rendez-vous est bien noté pour demain à 9 h."
  }),
});
console.log(res.status, await res.json());
```

```php
// PHP
$ch = curl_init("https://wa-api.geskap.com/v1/messages/reply");
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",
    "from" => "100000000000001",
    "text" => "Bonjour Awa, votre rendez-vous est bien noté pour demain à 9 h.",
  ]),
]);
$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/reply",
    headers={"Authorization": f"Bearer {os.environ['GESKAP_API_KEY']}"},
    json={
        "to": "+237690000001",
        "from": "100000000000001",
        "text": "Bonjour Awa, votre rendez-vous est bien noté pour demain à 9 h.",
    },
    timeout=15,
)
print(res.status_code, res.json())
```

To answer with buttons instead of text, see [Quick-reply buttons](https://console.geskap.com/docs/boutons-reponse-rapide?lang=en). For a guided case with human handover, see [FAQ with AI then human](https://console.geskap.com/docs/faq-ia-humain?lang=en).

## The Claude connector (MCP)

An MCP connector exists at `https://mcp.geskap.com/mcp`. It gives Claude tools to list received messages, reply, send a template, check a status and read the balance. It works **on demand**: Claude acts when you ask it to. It does not replace your webhook for answering every message automatically.

> **Pitfall:** the free-form reply only goes out if the customer wrote in the last 24 h. Outside that window the call answers `400` "Hors de la fenêtre de 24h": you need a template.

> **Pitfall:** answer the webhook **before** calling the model. The timeout is 8 seconds and there is no retry: a slow model would lose the event. Do the work in the background.

> **Pitfall:** only react to `message.inbound`. A `message.echo` is a message your team sent from the phone: answering it with the model would make the bot talk to your own team.

> **Pitfall:** if your number is shared with another system and the automatic responder is set to the other system, you do not receive the push for that number (the messages stay readable through the API). See [Several numbers](https://console.geskap.com/docs/plusieurs-numeros?lang=en).

Each free-form reply costs, by default, 1 credit per 4 messages: see [Cost of a message](https://console.geskap.com/docs/cout-d-un-message?lang=en).

_Proof — verified in the API source: console_api.py, client_webhooks.py, public_api.py, meta_webhooks.py, mcp_server.py, workflow_bundles.py, webhooks.py._

---

# Brancher WhatsApp sur n8n, Zapier, un CRM ou un LLM (ChatGPT, Claude)

_Oui : chaque message reçu arrive en POST HTTPS signé sur l'adresse de votre choix, donc n8n, Zapier, un CRM ou votre code peuvent le prendre ; pour un LLM, message.inbound puis votre code puis le modèle puis POST /v1/messages/reply._

Mots-clés: n8n, zapier, make, CRM, LLM, ChatGPT, Claude, IA, agent IA, chatbot, webhook, automatisation, no-code, brancher, intégration, répondre avec une IA, hubspot, connecteur, MCP, catch hook

## Scénario

Vous ne voulez pas écrire un serveur complet. Vous voulez que chaque message reçu sur votre numéro WhatsApp alimente votre CRM, déclenche un scénario n8n ou Zapier, ou soit confié à un modèle de langage (LLM) qui prépare la réponse. **Oui, c'est possible**, parce que l'API ne fait que pousser un POST HTTPS : tout ce qui sait recevoir ce POST peut s'y brancher.

## Le principe

```text
Client WhatsApp
   │  écrit
   ▼
API Geskap ──POST signé (message.inbound)──► votre adresse HTTPS
                                               │  n8n, Zapier, CRM, ou votre code
                                               ▼
                                          (optionnel) LLM
                                               │
votre code ──POST /v1/messages/reply──► API Geskap ──► Client WhatsApp
```

Vous enregistrez **une seule adresse** par compte dans la console (page Connexion, Webhook, HTTPS obligatoire). Tous les événements arrivent sur cette adresse : `message.inbound` (le client a écrit), `message.status` (statut d'un de vos envois) et `message.echo` (un message envoyé depuis l'application WhatsApp Business du téléphone, numéros en Coexistence). Triez sur `event`.

## n8n

Un nœud **Webhook** (méthode POST, adresse publique de votre instance) reçoit l'événement. Collez cette adresse dans la console. Ensuite aiguillez sur `event`, puis sur `data.button_id` si le client a touché un bouton (voir [Savoir quel bouton le client a touché](https://console.geskap.com/docs/recuperer-le-clic)).

- La galerie de la console propose deux workflows n8n déjà câblés à votre compte : le suivi de livraison par WhatsApp et l'envoi de bulletins scolaires. Aucun des deux n'est un « assistant IA » : ce sont des exemples complets pour voir comment l'envoi et le retour de boutons s'assemblent.
- Ces workflows protègent leur adresse de retour par un jeton aléatoire placé dans l'URL, pas par la vérification de la signature. Si votre adresse est publique, vérifiez la signature (voir [Vérifier la signature d'un webhook](https://console.geskap.com/docs/webhook-verifier-signature)) ou gardez un jeton long et secret dans l'URL.

## Zapier, Make et tout outil qui reçoit un POST HTTPS

Le critère est simple : l'outil doit offrir une adresse HTTPS publique qui accepte un POST JSON et répond 2xx en moins de 8 secondes. Collez cette adresse dans la console, envoyez-vous un message WhatsApp, et regardez l'événement arriver.

- Pour **vérifier la signature**, l'outil doit vous donner le corps brut exact. S'il ne le donne pas, vous ne pouvez pas la recalculer : placez devant lui un petit relais qui vérifie, puis qui transmet.
- L'API n'attend aucune réponse particulière : un 2xx suffit. Elle ne relance pas.

## Un CRM

Écrivez dans votre CRM, à chaque `message.inbound`, la ligne `from` (le numéro du client), `contact_name`, `text`, `type` et `wa_message_id`. Ce dernier est votre clé de dédoublonnage. Pour reconnaître un client déjà connu, voir [Reconnaître un client par son numéro](https://console.geskap.com/docs/reconnaitre-client-par-numero).

## Un LLM (ChatGPT, Claude, ou un autre modèle)

L'API n'appelle jamais un modèle à votre place : c'est votre code qui le fait. Le schéma est le même pour tous les fournisseurs.

```js
// Node.js
// Express — the webhook answers 200 first, the model works afterwards.
// verifyAndParse(req) = the signature check from the "Verify a webhook signature" recipe.
app.post("/webhooks/whatsapp", express.raw({ type: "application/json" }), (req, res) => {
  const payload = verifyAndParse(req);          // null when the signature is wrong
  if (!payload) return res.sendStatus(401);
  res.sendStatus(200);                          // one attempt, 8 s, no retry
  if (payload.event !== "message.inbound") return;   // never react to message.echo
  answerInBackground(payload.data).catch(console.error);
});

async function answerInBackground(msg) {
  const answer = await askYourModel(msg.text);  // your LLM call (any provider)
  await fetch("https://wa-api.geskap.com/v1/messages/reply", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.GESKAP_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ to: msg.from, from: msg.number, text: answer }),
  });
}
```

```php
// PHP
<?php
// The webhook answers 200 first, the model works afterwards.
// verify_and_parse() = the signature check from the "Verify a webhook signature" recipe.
$payload = verify_and_parse(file_get_contents("php://input"));
if (!$payload) { http_response_code(401); exit; }
http_response_code(200);                      // one attempt, 8 s, no retry
if (function_exists("fastcgi_finish_request")) { fastcgi_finish_request(); }

if ($payload["event"] === "message.inbound") {   // never react to message.echo
    $msg = $payload["data"];
    $answer = ask_your_model($msg["text"]);   // your LLM call (any provider)
    $ch = curl_init("https://wa-api.geskap.com/v1/messages/reply");
    curl_setopt_array($ch, [
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_POST => true,
        CURLOPT_HTTPHEADER => [
            "Authorization: Bearer " . getenv("GESKAP_API_KEY"),
            "Content-Type: application/json",
        ],
        CURLOPT_POSTFIELDS => json_encode([
            "to" => $msg["from"], "from" => $msg["number"], "text" => $answer,
        ]),
    ]);
    curl_exec($ch);
}
```

```python
# Python
# Flask — the webhook answers 200 first, the model works afterwards.
# verify_and_parse() = the signature check from the "Verify a webhook signature" recipe.
import os, threading, requests

@app.post("/webhooks/whatsapp")
def whatsapp_webhook():
    payload = verify_and_parse(request)           # aborts with 401 if the signature is wrong
    if payload["event"] == "message.inbound":     # never react to message.echo
        threading.Thread(target=answer, args=(payload["data"],), daemon=True).start()
    return "", 200                                # one attempt, 8 s, no retry

def answer(msg):
    text = ask_your_model(msg["text"])            # your LLM call (any provider)
    requests.post(
        "https://wa-api.geskap.com/v1/messages/reply",
        headers={"Authorization": f"Bearer {os.environ['GESKAP_API_KEY']}"},
        json={"to": msg["from"], "from": msg["number"], "text": text},
        timeout=15,
    )
```

```bash
# curl
# What your code sends once the model has answered.
curl -X POST "https://wa-api.geskap.com/v1/messages/reply" \
  -H "Authorization: Bearer $GESKAP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to": "+237690000001", "from": "100000000000001", "text": "Bonjour Awa, votre rendez-vous est bien noté pour demain à 9 h."}'
```

La réponse part par `POST /v1/messages/reply` avec `from` égal à `data.number`, pour répondre depuis le numéro qui a reçu :

```bash
# curl
curl -X POST "https://wa-api.geskap.com/v1/messages/reply" \
  -H "Authorization: Bearer $GESKAP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "to": "+237690000001",
  "from": "100000000000001",
  "text": "Bonjour Awa, votre rendez-vous est bien noté pour demain à 9 h."
}'
```

```js
// Node.js
const res = await fetch("https://wa-api.geskap.com/v1/messages/reply", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.GESKAP_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "to": "+237690000001",
    "from": "100000000000001",
    "text": "Bonjour Awa, votre rendez-vous est bien noté pour demain à 9 h."
  }),
});
console.log(res.status, await res.json());
```

```php
// PHP
$ch = curl_init("https://wa-api.geskap.com/v1/messages/reply");
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",
    "from" => "100000000000001",
    "text" => "Bonjour Awa, votre rendez-vous est bien noté pour demain à 9 h.",
  ]),
]);
$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/reply",
    headers={"Authorization": f"Bearer {os.environ['GESKAP_API_KEY']}"},
    json={
        "to": "+237690000001",
        "from": "100000000000001",
        "text": "Bonjour Awa, votre rendez-vous est bien noté pour demain à 9 h.",
    },
    timeout=15,
)
print(res.status_code, res.json())
```

Pour répondre avec des boutons plutôt que du texte, voir [Boutons de réponse rapide](https://console.geskap.com/docs/boutons-reponse-rapide). Pour un cas guidé avec passage à un humain, voir [FAQ avec IA puis humain](https://console.geskap.com/docs/faq-ia-humain).

## Le connecteur Claude (MCP)

Un connecteur MCP existe à l'adresse `https://mcp.geskap.com/mcp`. Il donne à Claude des outils pour lister les messages reçus, répondre, envoyer un template, vérifier un statut et lire le solde. Il fonctionne **à la demande** : Claude agit quand vous le lui demandez. Il ne remplace pas votre webhook pour répondre automatiquement à chaque message.

> **Piège :** la réponse libre ne part que si le client a écrit dans les dernières 24 h. Hors de cette fenêtre, l'appel répond `400` « Hors de la fenêtre de 24h » : il faut un template.

> **Piège :** répondez au webhook **avant** d'appeler le modèle. Le délai est de 8 secondes et il n'y a pas de relance : un modèle lent ferait perdre l'événement. Faites le travail en arrière-plan.

> **Piège :** ne réagissez qu'à `message.inbound`. Un `message.echo` est un message envoyé depuis le téléphone par votre équipe : y répondre avec le modèle ferait parler le bot à votre propre équipe.

> **Piège :** si votre numéro est partagé avec un autre système et que la réponse automatique est réglée sur l'autre système, vous ne recevez pas le push de ce numéro (les messages restent lisibles dans l'API). Voir [Plusieurs numéros](https://console.geskap.com/docs/plusieurs-numeros).

Chaque réponse libre coûte, par défaut, 1 crédit pour 4 messages : voir [Coût d'un message](https://console.geskap.com/docs/cout-d-un-message).

_Preuve — vérifié dans le code de l'API : console_api.py, client_webhooks.py, public_api.py, meta_webhooks.py, mcp_server.py, workflow_bundles.py, webhooks.py._

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