{
  "name": "UTPLA - Scenario 3 - Verification email Hunter.io",
  "flow": [
    {
      "id": 1,
      "module": "gateway:CustomWebHook",
      "version": 1,
      "parameters": {},
      "mapper": {},
      "metadata": {
        "designer": { "x": 0, "y": 0 },
        "restore": {},
        "parameters": [
          { "name": "hook", "type": "hook:gateway-webhook", "label": "Webhook", "required": true }
        ]
      }
    },
    {
      "id": 2,
      "module": "hunter:verifyEmail",
      "version": 1,
      "parameters": {},
      "mapper": {
        "email": "{{1.email}}"
      },
      "metadata": {
        "designer": { "x": 300, "y": 0 },
        "restore": {}
      }
    },
    {
      "id": 3,
      "module": "google-sheets:updateRow",
      "version": 2,
      "parameters": {},
      "mapper": {
        "mode": "map",
        "spreadsheetId": "REMPLACER_PAR_ID_GOOGLE_SHEET",
        "sheetId": "Contacts",
        "tableFirstRow": "A1:Z1",
        "rowNumber": "{{1.row}}",
        "values": {
          "4": "{{2.email}}",
          "8": "{{2.result}}",
          "11": "{{2.score}}"
        }
      },
      "metadata": {
        "designer": { "x": 600, "y": 0 },
        "restore": {}
      }
    },
    {
      "id": 4,
      "module": "google-email:ActionSendEmail",
      "version": 1,
      "parameters": {},
      "filter": {
        "name": "Email non livrable",
        "conditions": [
          [ { "a": "{{2.result}}", "o": "text:notequal", "b": "deliverable" } ]
        ]
      },
      "mapper": {
        "to": [ "commerciale@utpla.fr" ],
        "subject": "[EMAIL A VERIFIER] {{1.email}} - statut {{2.result}}",
        "html": "<h2>Email a verifier</h2><p>L'adresse <strong>{{1.email}}</strong> du contact {{1.prenom}} {{1.nom}} a obtenu le statut Hunter.io suivant :</p><ul><li><strong>Resultat :</strong> {{2.result}}</li><li><strong>Score de confiance :</strong> {{2.score}}/100</li><li><strong>Statut :</strong> {{2.status}}</li></ul><p>Verifier ou corriger cette adresse avant toute relance commerciale.</p>"
      },
      "metadata": {
        "designer": { "x": 900, "y": 0 },
        "restore": {}
      }
    }
  ],
  "metadata": {
    "instant": true,
    "version": 1,
    "scenario": {
      "roundtrips": 1,
      "maxErrors": 3,
      "autoCommit": true,
      "autoCommitTriggerLast": true,
      "sequential": false,
      "confidential": false,
      "dataloss": false,
      "dlq": false,
      "freshVariables": false
    },
    "designer": { "orphans": [] },
    "zone": "eu2.make.com",
    "notes": [
      "DECLENCHEUR : webhook (module 1). PAYLOAD attendu : email, prenom, nom, row (numero de ligne dans le Sheet).",
      "CONNEXIONS A AJOUTER : Hunter.io (module 2), Google Sheets (module 3), Gmail (module 4).",
      "VARIANTE : pour TROUVER un email manquant a partir du nom + domaine, remplacer le module 2 par hunter:findEmail (searchCriteria=domain, first_name, last_name, domain).",
      "Hunter.io 'result' renvoie : deliverable / undeliverable / risky / unknown. Le mail d'alerte part si result n'est pas 'deliverable'.",
      "GOOGLE SHEET 'Contacts' colonnes E:Email I:Statut_Email L:Score_Email. Remplacer spreadsheetId du module 3."
    ]
  }
}
