{
  "name": "Capture website leads to HubSpot or Google Sheets with Slack follow-up",
  "nodes": [
    {
      "id": "defe3eb5-a816-498f-aa9f-db5497a1ae85",
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1760,
        576
      ]
    },
    {
      "id": "7a3ef9e5-f744-40c9-8a5e-f6d499367f9e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1872,
        480
      ],
      "parameters": {
        "width": 336,
        "height": 528,
        "content": "## Webhook Trigger node\nThis is your “form endpoint”. Your website (or Postman) will send POST JSON here.\n\n\n\n\n\n\n\n\n\n\n\n\nSend a POST request to the webhook URL with JSON body:\n\n```json\n{\n  \"firstName\": \""
      }
    },
    {
      "id": "4af97ba0-be13-4b29-a275-367da6fe5895",
      "name": "Normalize leads",
      "type": "n8n-nodes-base.set",
      "position": [
        -1248,
        576
      ]
    },
    {
      "id": "00bfb2a3-fb48-497b-8fdd-cbaf2c190c5c",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1520,
        480
      ],
      "parameters": {
        "width": 640,
        "height": 256,
        "content": "## Normalize And Validate Lead\nReal data is messy. Trim spaces, lowercase email, create a consistent object once.\n\n\n\n\n\n\n\n\n\n\n"
      }
    },
    {
      "id": "b908d026-0f74-4449-8d1a-d8440a045efe",
      "name": "Code - Validate Lead",
      "type": "n8n-nodes-base.code",
      "position": [
        -1040,
        576
      ]
    },
    {
      "id": "677ccaee-9604-4267-b622-3ea26b566434",
      "name": "IF node — Is Valid?",
      "type": "n8n-nodes-base.if",
      "position": [
        -816,
        576
      ]
    },
    {
      "id": "0ddc6d37-18a3-4899-b4f6-54cafd1861ad",
      "name": "Respond to Webhook — 400 Bad Request (invalid path)",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -528,
        688
      ]
    },
    {
      "id": "7f6197a0-365e-4425-930d-6e8a8ce5e9af",
      "name": "IF node — Enrichment enabled?",
      "type": "n8n-nodes-base.if",
      "position": [
        -528,
        448
      ]
    },
    {
      "id": "451bec77-001a-44ca-ade7-400b2bcffad1",
      "name": "HTTP Request - Enrich (Optional)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -256,
        432
      ]
    },
    {
      "id": "8bd7d0f0-d09e-461a-88e9-3ebe7bca9bdc",
      "name": "Set - Merge Enrichment into lead",
      "type": "n8n-nodes-base.set",
      "position": [
        304,
        464
      ]
    },
    {
      "id": "597e8af4-d5c1-4947-af3d-1b2480986995",
      "name": "Switch - Choose destination (Sheets vs HubSpot)",
      "type": "n8n-nodes-base.switch",
      "position": [
        576,
        464
      ]
    },
    {
      "id": "5767a86b-99db-4fd5-bf40-5d4c116f87d4",
      "name": "Google Sheets- Lookup by email",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        896,
        352
      ]
    },
    {
      "id": "dda6f43a-ecf0-4664-acfc-3db36362d17f",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        880,
        -112
      ],
      "parameters": {
        "width": 608,
        "height": 288,
        "content": "## Example sheet pattern\n```\nreceivedAt → ={{$json.lead.receivedAt || $now}}\nname → ={{$json.lead.name}}\nemail → ={{$json.lead.email}}\ncompany → ={{$json.lead.company}}\nmessage → ={{$json.lead.message"
      }
    },
    {
      "id": "01f3f746-e727-44be-b178-c520fcb214ed",
      "name": "Set - Snapshot data",
      "type": "n8n-nodes-base.set",
      "position": [
        -256,
        272
      ]
    },
    {
      "id": "dd12a7d4-a64c-40a1-bd50-bcc40327fc0b",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        -48,
        288
      ]
    },
    {
      "id": "682bd14c-2020-4641-b4b4-e5b5ccc01333",
      "name": "IF - Sheets update Failed?",
      "type": "n8n-nodes-base.if",
      "position": [
        1088,
        352
      ]
    },
    {
      "id": "c9cfeab2-aed5-4f36-b061-5e2a78798517",
      "name": "Slack - update failed",
      "type": "n8n-nodes-base.slack",
      "position": [
        1312,
        224
      ]
    },
    {
      "id": "875946be-f203-4863-b5a6-6cd53d29432a",
      "name": "Slack - Successfully updated",
      "type": "n8n-nodes-base.slack",
      "position": [
        1312,
        368
      ]
    },
    {
      "id": "75b7dd2d-82a4-43b3-a919-8e9f87e1c974",
      "name": "Hubspot - Create/Update contacts",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        896,
        560
      ]
    },
    {
      "id": "dc890918-1c7a-40c1-91cc-3d6264df6b26",
      "name": "IF - HubSpot Failed?",
      "type": "n8n-nodes-base.if",
      "position": [
        1088,
        560
      ]
    },
    {
      "id": "4f1b0f45-4f50-4950-8b21-7d2a3f15ad3b",
      "name": "Slack - HubSpot Successfully updated",
      "type": "n8n-nodes-base.slack",
      "position": [
        1312,
        688
      ]
    },
    {
      "id": "37eaee93-074a-4f8d-81e3-1a85549b0f3a",
      "name": "Slack - HubSpot update failed",
      "type": "n8n-nodes-base.slack",
      "position": [
        1312,
        544
      ]
    },
    {
      "id": "b2372856-de49-4a6d-abc2-7ab93053b4d0",
      "name": "Respond to Webhook - 500 - Sheets",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1504,
        224
      ]
    },
    {
      "id": "efec202d-2400-4f00-bef2-5c8ba396e77e",
      "name": "Respond to Webhook - 500 - HubSpot",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1504,
        544
      ]
    },
    {
      "id": "dcdad04e-3a8b-413d-855b-0ff5fd701328",
      "name": "Respond to Webhook - 200 - Sheets",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1504,
        368
      ]
    },
    {
      "id": "1fc24732-4de6-4381-aa4b-c72dbe450727",
      "name": "Respond to Webhook - 200 - HubSpot",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1504,
        688
      ]
    },
    {
      "id": "39016202-1bed-4448-96fa-f7e1548c9a85",
      "name": "Parse Webhook body",
      "type": "n8n-nodes-base.code",
      "position": [
        -1456,
        576
      ]
    },
    {
      "id": "44cbf381-bd5e-40a0-a8fd-650ad1799f6f",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -592,
        144
      ],
      "parameters": {
        "width": 784,
        "height": 496,
        "content": "## Enrichment check\nCheck if enrichment is enabled, if yes, then the enrichment is done through third party service like Clearbit/Hunter. And then merged along the snapshot data.\nIn the HTTP Node, cha"
      }
    },
    {
      "id": "c9ee2a87-5a44-4907-b111-f502598210b8",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        224,
        368
      ],
      "parameters": {
        "width": 256,
        "height": 272,
        "content": "Merge enrichment data along with the lead data, because HTTP node, looses the Input lead data. "
      }
    },
    {
      "id": "dd4dc7b0-0a49-4354-9f1a-c4baf123fc24",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        368
      ],
      "parameters": {
        "width": 304,
        "height": 272,
        "content": "Switch cases, based on destination where to save the lead data, ```Google Sheets``` OR  ```HubSpot```"
      }
    },
    {
      "id": "115e38cd-8b50-4337-abc3-f985de3c3969",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2688,
        -48
      ],
      "parameters": {
        "width": 784,
        "height": 1056,
        "content": "## What this workflow does\n\n1. **Receives a lead** via **Webhook (POST)** (from your website form, Postman, etc.)\n2. **Parses the body** (handles both JSON and `text/plain` JSON strings)\n3. **Normaliz"
      }
    }
  ],
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Set - Merge Enrichment into lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize leads": {
      "main": [
        [
          {
            "node": "Code - Validate Lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Parse Webhook body",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Webhook body": {
      "main": [
        [
          {
            "node": "Normalize leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set - Snapshot data": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code - Validate Lead": {
      "main": [
        [
          {
            "node": "IF node — Is Valid?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF - HubSpot Failed?": {
      "main": [
        [
          {
            "node": "Slack - HubSpot update failed",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Slack - HubSpot Successfully updated",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF node — Is Valid?": {
      "main": [
        [
          {
            "node": "IF node — Enrichment enabled?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond to Webhook — 400 Bad Request (invalid path)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack - update failed": {
      "main": [
        [
          {
            "node": "Respond to Webhook - 500 - Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF - Sheets update Failed?": {
      "main": [
        [
          {
            "node": "Slack - update failed",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Slack - Successfully updated",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack - Successfully updated": {
      "main": [
        [
          {
            "node": "Respond to Webhook - 200 - Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack - HubSpot update failed": {
      "main": [
        [
          {
            "node": "Respond to Webhook - 500 - HubSpot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets- Lookup by email": {
      "main": [
        [
          {
            "node": "IF - Sheets update Failed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF node — Enrichment enabled?": {
      "main": [
        [
          {
            "node": "Set - Snapshot data",
            "type": "main",
            "index": 0
          },
          {
            "node": "HTTP Request - Enrich (Optional)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set - Merge Enrichment into lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request - Enrich (Optional)": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Hubspot - Create/Update contacts": {
      "main": [
        [
          {
            "node": "IF - HubSpot Failed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set - Merge Enrichment into lead": {
      "main": [
        [
          {
            "node": "Switch - Choose destination (Sheets vs HubSpot)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack - HubSpot Successfully updated": {
      "main": [
        [
          {
            "node": "Respond to Webhook - 200 - HubSpot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch - Choose destination (Sheets vs HubSpot)": {
      "main": [
        [
          {
            "node": "Google Sheets- Lookup by email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Hubspot - Create/Update contacts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}