ReplexaDocs

Replexa avec n8n

Un workflow qui appelle Instantly fonctionne avec Replexa en changeant l'URL de base et la clé : mêmes chemins, mêmes champs.

1. Identifiants

  1. Replexa : Paramètres › API et webhooks › nouvelle clé (ex. « n8n »), avec les droits nécessaires.
  2. n8n : Credentials › New › Header Auth. Name : Authorization, Value : Bearer apo_….

2. Appeler l'API (nœud HTTP Request)

URL https://app.replexa.eu/api/v2/leads/add, méthode POST, authentification Header Auth, corps JSON :

{
  "campaign_id": "{{ $json.campaign_id }}",
  "leads": [{ "email": "{{ $json.email }}", "first_name": "{{ $json.first_name }}", "company_name": "{{ $json.company }}" }]
}

3. Recevoir les évènements (nœud Webhook)

  1. Nœud Webhook, méthode POST, option « Raw body » activée : copiez l'URL de production.
  2. Replexa : Paramètres › API et webhooks, collez l'URL et choisissez l'évènement (ex. reply_received), ou POST /api/v2/webhooks.
  3. Vérifiez la signature dans un nœud Code :
const crypto = require('crypto');
const item = $input.first().json;
const ts = item.headers['x-replexa-timestamp'];
const sig = item.headers['x-replexa-signature'];
const raw = item.body; // option « Raw body » du nœud Webhook
const expected = crypto.createHmac('sha256', 'SECRET_DU_WEBHOOK').update(ts + '.' + raw).digest('hex');
if (sig !== expected || Math.abs(Date.now() / 1000 - Number(ts)) > 300) throw new Error('Signature invalide');
return [{ json: JSON.parse(raw) }];

4. Outil de l'agent IA

Dans Intégrations › n8n, un webhook n8n devient aussi un outil de l'agent (ex. lire un agenda Outlook) : URL du nœud Webhook et jeton en en-tête.