{
  "name": "Praxica Skool Lead Enricher",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "skool-lead-join",
        "options": {}
      },
      "id": "1",
      "name": "Apify Webhook (Skool)",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [400, 400]
    },
    {
      "parameters": {
        "resource": "person",
        "operation": "enrich",
        "email": "={{ $node[\"Apify Webhook (Skool)\"].json[\"body\"][\"email\"] }}",
        "options": {}
      },
      "id": "2",
      "name": "Apollo Enrichment",
      "type": "n8n-nodes-base.apollo",
      "typeVersion": 1,
      "position": [600, 400]
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "Score this lead (0-100) based on our ICP: Founders or CTOs at companies with 50-500 employees in the Tech/AI space.\n\nMember Name: {{ $node[\"Apify Webhook (Skool)\"].json[\"body\"][\"name\"] }}\nJob Title: {{ $json[\"title\"] }}\nCompany: {{ $json[\"organization\"][\"name\"] }}\nIndustry: {{ $json[\"organization\"][\"industry\"] }}\nCompany Size: {{ $json[\"organization\"][\"employee_count\"] }}\nSkool Answers: {{ $node[\"Apify Webhook (Skool)\"].json[\"body\"][\"answers\"] }}",
        "options": {
          "systemMessage": "Output ONLY a JSON object: { \"score\": number, \"reasoning\": \"string\" }"
        }
      },
      "id": "3",
      "name": "AI Lead Scorer",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1,
      "position": [850, 400]
    },
    {
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{ $json[\"score\"] }}",
              "operation": "larger",
              "value2": 70
            }
          ]
        }
      },
      "id": "4",
      "name": "Is Hot Lead?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [1100, 400]
    },
    {
      "parameters": {
        "resource": "contact",
        "operation": "upsert",
        "email": "={{ $node[\"Apify Webhook (Skool)\"].json[\"body\"][\"email\"] }}",
        "additionalFields": {
          "firstName": "={{ $node[\"Apify Webhook (Skool)\"].json[\"body\"][\"name\"].split(' ')[0] }}",
          "lastName": "={{ $node[\"Apify Webhook (Skool)\"].json[\"body\"][\"name\"].split(' ')[1] }}",
          "jobtitle": "={{ $node[\"Apollo Enrichment\"].json[\"title\"] }}",
          "company": "={{ $node[\"Apollo Enrichment\"].json[\"organization\"][\"name\"] }}",
          "lead_score": "={{ $node[\"AI Lead Scorer\"].json[\"score\"] }}"
        }
      },
      "id": "5",
      "name": "HubSpot Sync",
      "type": "n8n-nodes-base.hubspot",
      "typeVersion": 1,
      "position": [1350, 300]
    },
    {
      "parameters": {
        "channel": "sales-alerts",
        "text": "🔥 *HOT SKOOL LEAD FOUND!*\n\n*Name:* {{ $node[\"Apify Webhook (Skool)\"].json[\"body\"][\"name\"] }}\n*Role:* {{ $node[\"Apollo Enrichment\"].json[\"title\"] }} at {{ $node[\"Apollo Enrichment\"].json[\"organization\"][\"name\"] }}\n*AI Score:* {{ $node[\"AI Lead Scorer\"].json[\"score\"] }}/100\n*Reasoning:* {{ $node[\"AI Lead Scorer\"].json[\"reasoning\"] }}\n\nView in HubSpot: https://app.hubspot.com/contacts/your_id/contact/{{ $json[\"id\"] }}"
      },
      "id": "6",
      "name": "Slack Alert",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2,
      "position": [1600, 300]
    },
    {
      "parameters": {
        "resource": "spreadsheet",
        "operation": "append",
        "spreadsheetId": "your_sheet_id",
        "values": {
          "mappingMode": "defineEverything",
          "value": {
            "Name": "={{ $node[\"Apify Webhook (Skool)\"].json[\"body\"][\"name\"] }}",
            "Email": "={{ $node[\"Apify Webhook (Skool)\"].json[\"body\"][\"email\"] }}",
            "Score": "={{ $node[\"AI Lead Scorer\"].json[\"score\"] }}"
          }
        }
      },
      "id": "7",
      "name": "Log to Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4,
      "position": [1350, 500]
    }
  ],
  "connections": {
    "Apify Webhook (Skool)": {
      "main": [
        [
          {
            "node": "Apollo Enrichment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Apollo Enrichment": {
      "main": [
        [
          {
            "node": "AI Lead Scorer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Lead Scorer": {
      "main": [
        [
          {
            "node": "Is Hot Lead?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Hot Lead?": {
      "main": [
        [
          {
            "node": "HubSpot Sync",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log to Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HubSpot Sync": {
      "main": [
        [
          {
            "node": "Slack Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
