{
 "name": "LeadForge — alertes réponses, visites et rappels",
 "nodes": [
  {
   "parameters": {
    "httpMethod": "POST",
    "path": "leadforge-alertes",
    "options": {}
   },
   "name": "Webhook LeadForge",
   "type": "n8n-nodes-base.webhook",
   "typeVersion": 2,
   "position": [
    0,
    0
   ],
   "webhookId": "leadforge-alertes"
  },
  {
   "parameters": {
    "conditions": {
     "options": {
      "caseSensitive": true,
      "leftValue": "",
      "typeValidation": "loose"
     },
     "combinator": "or",
     "conditions": [
      {
       "id": "c0",
       "leftValue": "={{ $json.body.event }}",
       "rightValue": "reply",
       "operator": {
        "type": "string",
        "operation": "equals"
       }
      },
      {
       "id": "c1",
       "leftValue": "={{ $json.body.event }}",
       "rightValue": "callback_request",
       "operator": {
        "type": "string",
        "operation": "equals"
       }
      },
      {
       "id": "c2",
       "leftValue": "={{ $json.body.event }}",
       "rightValue": "click",
       "operator": {
        "type": "string",
        "operation": "equals"
       }
      }
     ]
    },
    "options": {}
   },
   "name": "Événement concerné ?",
   "type": "n8n-nodes-base.if",
   "typeVersion": 2,
   "position": [
    260,
    0
   ]
  },
  {
   "parameters": {
    "fromEmail": "leadforge@votre-domaine.fr",
    "toEmail": "vous@votre-domaine.fr",
    "subject": "={{ $json.body.event === 'reply' ? 'Réponse' : $json.body.event === 'click' ? 'Visite' : 'Rappel demandé' }} : {{ $json.body.contact.first_name }} {{ $json.body.contact.last_name }} ({{ $json.body.contact.company }})",
    "emailFormat": "text",
    "text": "={{ $json.body.text }}\n\nEmail : {{ $json.body.contact.email }}\nTéléphone : {{ $json.body.contact.mobile || $json.body.contact.phone }}\nÉtape : {{ $json.body.contact.stage }}",
    "options": {}
   },
   "name": "Email à l'équipe",
   "type": "n8n-nodes-base.emailSend",
   "typeVersion": 2.1,
   "position": [
    520,
    -20
   ]
  }
 ],
 "connections": {
  "Webhook LeadForge": {
   "main": [
    [
     {
      "node": "Événement concerné ?",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Événement concerné ?": {
   "main": [
    [
     {
      "node": "Email à l'équipe",
      "type": "main",
      "index": 0
     }
    ]
   ]
  }
 },
 "settings": {
  "executionOrder": "v1"
 },
 "meta": {
  "templateCredsSetupCompleted": false
 },
 "pinData": {},
 "staticData": null,
 "tags": [],
 "active": false,
 "versionId": "1",
 "id": "",
 "notes": "Collez l'URL de production du webhook dans LeadForge > Intégrations > Webhook. Réglez l'expéditeur et le destinataire de l'email (identifiants SMTP)."
}