{
  "name": "UTPLA - Scenario 2 - Enrichissement Apollo + scoring ICP",
  "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": "apollo:makeApiCall",
      "version": 1,
      "parameters": {},
      "mapper": {
        "url": "/v1/people/match",
        "method": "POST",
        "headers": [],
        "qs": [
          { "key": "first_name", "value": "{{1.prenom}}" },
          { "key": "last_name", "value": "{{1.nom}}" },
          { "key": "organization_name", "value": "{{1.entreprise}}" },
          { "key": "domain", "value": "{{1.domaine}}" },
          { "key": "reveal_personal_emails", "value": "true" }
        ],
        "body": ""
      },
      "metadata": {
        "designer": { "x": 300, "y": 0 },
        "restore": {}
      }
    },
    {
      "id": 3,
      "module": "anthropic-claude:createAMessage",
      "version": 1,
      "parameters": {},
      "mapper": {
        "model": "claude-sonnet-4-6",
        "max_tokens": 1024,
        "messages": [
          {
            "role": "user",
            "inputType": "single",
            "content": "Tu es l'analyste commercial d'UTPLA, entreprise de biodiversite urbaine (ruches d'entreprise, refuges pollinisateurs, RSE). Tu evalues un lead selon notre profil client ideal (ICP) : PME / ETI / collectivites sensibles a la RSE, au bien-etre au travail et a l'environnement.\n\nDonnees du contact (enrichies via Apollo) :\nPrenom : {{1.prenom}}\nNom : {{1.nom}}\nEntreprise : {{1.entreprise}}\nPoste : {{2.body.person.title}}\nEmail : {{2.body.person.email}}\nLinkedIn : {{2.body.person.linkedin_url}}\nSecteur : {{2.body.person.organization.industry}}\nEffectif : {{2.body.person.organization.estimated_num_employees}}\n\nEvalue ce lead et reponds UNIQUEMENT avec un objet JSON valide (aucun texte avant ni apres) :\n{\n  \"score_firmographics\": 0-20,\n  \"score_technographics\": 0-20,\n  \"score_behavioral\": 0-20,\n  \"score_psychographics\": 0-20,\n  \"score_fit_rse\": 0-20,\n  \"score_global\": 0-100,\n  \"niveau\": \"chaud|tiede|froid\",\n  \"argumentaire\": \"2 phrases : angle d'approche recommande pour ce contact\"\n}\nLe score_global est la somme des 5 dimensions. niveau=chaud si >=75, tiede si 50-74, froid si <50."
          }
        ]
      },
      "metadata": {
        "designer": { "x": 600, "y": 0 },
        "restore": {}
      }
    },
    {
      "id": 4,
      "module": "json:ParseJSON",
      "version": 1,
      "parameters": { "type": "" },
      "mapper": { "json": "{{3.content[].text}}" },
      "metadata": {
        "designer": { "x": 900, "y": 0 },
        "restore": {}
      }
    },
    {
      "id": 5,
      "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.body.person.email}}",
          "5": "{{2.body.person.linkedin_url}}",
          "6": "{{2.body.person.title}}",
          "7": "{{4.score_global}}",
          "9": "{{4.niveau}}",
          "10": "{{4.argumentaire}}"
        }
      },
      "metadata": {
        "designer": { "x": 1200, "y": 0 },
        "restore": {}
      }
    },
    {
      "id": 6,
      "module": "google-email:ActionSendEmail",
      "version": 1,
      "parameters": {},
      "filter": {
        "name": "Lead qualifie (score > 75)",
        "conditions": [
          [ { "a": "{{4.score_global}}", "o": "number:greater", "b": "75" } ]
        ]
      },
      "mapper": {
        "to": [ "commerciale@utpla.fr" ],
        "subject": "[LEAD CHAUD] {{1.prenom}} {{1.nom}} - {{1.entreprise}} ({{4.score_global}}/100)",
        "html": "<h2>Nouveau lead qualifie</h2><p><strong>Contact :</strong> {{1.prenom}} {{1.nom}}</p><p><strong>Entreprise :</strong> {{1.entreprise}}</p><p><strong>Poste :</strong> {{2.body.person.title}}</p><p><strong>Email :</strong> {{2.body.person.email}}</p><p><strong>LinkedIn :</strong> <a href=\"{{2.body.person.linkedin_url}}\">{{2.body.person.linkedin_url}}</a></p><p><strong>Score ICP :</strong> {{4.score_global}}/100 ({{4.niveau}})</p><p><strong>Angle d'approche :</strong> {{4.argumentaire}}</p><hr><p>Relancer rapidement ce lead.</p>"
      },
      "metadata": {
        "designer": { "x": 1500, "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). Apres import, creer/attacher un webhook et copier son URL dans le bouton Google Sheets ou l'outil qui ajoute un contact.",
      "PAYLOAD WEBHOOK attendu (JSON) : prenom, nom, entreprise, domaine, row (numero de ligne du contact dans le Sheet).",
      "CONNEXIONS A AJOUTER : Apollo (module 2), Anthropic Claude (module 3), Google Sheets (module 5), Gmail (module 6).",
      "APOLLO : l'enrichissement People Match consomme 1 credit par appel. Cle API requise sur la connexion Apollo.",
      "GOOGLE SHEET 'Contacts' colonnes A:Prenom B:Nom C:Entreprise D:Poste E:Email F:LinkedIn G:Poste_enrichi H:Score_ICP I:Statut_Email J:Niveau K:Argumentaire. Remplacer spreadsheetId du module 5."
    ]
  }
}
