{
  "name": "Capture and score leads with SQL Server and Slack alerts",
  "nodes": [
    {
      "id": "6179a213-35c4-4b15-8cd8-4d218399e51f",
      "name": "Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1456,
        -192
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "309dd3a2-15e5-4d39-a38e-72644e97a4dd",
      "name": "Data validation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -992,
        -192
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "2aae6059-a399-4415-8bd5-af6826aaa544",
      "name": "Webhook - Lead Capture",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -928,
        -64
      ]
    },
    {
      "id": "d48f9da9-c206-499c-9560-d5057a297900",
      "name": "Normalize Lead Data",
      "type": "n8n-nodes-base.code",
      "position": [
        -736,
        -64
      ]
    },
    {
      "id": "baa8c2e4-f7e1-4bc4-8f24-11e6bd857ab0",
      "name": "IF - Valid Email",
      "type": "n8n-nodes-base.if",
      "position": [
        -496,
        -64
      ]
    },
    {
      "id": "5b386fe2-753f-42fa-865c-2fbe068886b5",
      "name": "Format Error Response",
      "type": "n8n-nodes-base.code",
      "position": [
        -496,
        96
      ]
    },
    {
      "id": "103131f7-afc9-4bb5-a4d9-f9b6978177ba",
      "name": "Respond - Validation Error",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -272,
        96
      ]
    },
    {
      "id": "1ed0c3b4-989d-4ce6-b38f-bcbedf20a504",
      "name": "Database operations",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -112,
        -192
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "a8fe8b6e-c51c-40ba-a982-94476e5e254a",
      "name": "Prepare API Body",
      "type": "n8n-nodes-base.code",
      "position": [
        -96,
        -64
      ]
    },
    {
      "id": "bdd63fa8-a945-4e2e-b323-ad4772c73c4d",
      "name": "API - Upsert Contact",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        144,
        -64
      ]
    },
    {
      "id": "ae39f8e3-127a-446f-83be-8332e3431bfb",
      "name": "Lead scoring and routing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        -192
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "d13a5c2e-d21c-4814-b85c-c012f93a772a",
      "name": "Calculate Lead Score",
      "type": "n8n-nodes-base.code",
      "position": [
        496,
        -64
      ]
    },
    {
      "id": "71bd8aac-224d-4793-b6c4-5a5b1742ba00",
      "name": "Score Router",
      "type": "n8n-nodes-base.switch",
      "position": [
        736,
        -64
      ]
    },
    {
      "id": "fae93c8c-257b-4076-b294-e5b2fe47fb6b",
      "name": "Format Slack Alert",
      "type": "n8n-nodes-base.code",
      "position": [
        912,
        -32
      ]
    },
    {
      "id": "4dcfb0e7-57b4-4e85-a0c2-0979b2a87736",
      "name": "Slack - Hot Lead Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        1152,
        -32
      ]
    },
    {
      "id": "a7dfcac7-22ef-480d-b0e2-ba210497a85b",
      "name": "API - Update Score (Hot)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1344,
        -32
      ]
    },
    {
      "id": "86f50a98-6752-4cca-99bb-447a66fd3ddf",
      "name": "API - Update Score (Warm)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1008,
        96
      ]
    },
    {
      "id": "5b16f36f-b69d-4eb9-98a0-c3fe2f72eb46",
      "name": "Log Cold Lead",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1008,
        256
      ]
    },
    {
      "id": "466e47d8-44e3-4c5d-803a-8e1bb243ad41",
      "name": "Webhook response",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1536,
        -192
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "ee4c570e-0740-40a2-bcab-9770fc9a39bf",
      "name": "Format Success Response",
      "type": "n8n-nodes-base.code",
      "position": [
        1568,
        -64
      ]
    },
    {
      "id": "f7eab8b2-b106-4b63-bd16-3faa09df82ab",
      "name": "Respond - Success",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1808,
        -64
      ]
    },
    {
      "id": "0b67d41b-ac21-47bf-ae49-ac63e9f7d940",
      "name": "Error handling",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1408,
        816
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "59a35ac2-8846-45e5-ad39-5782b3b47e46",
      "name": "Error Trigger",
      "type": "n8n-nodes-base.errorTrigger",
      "position": [
        -1376,
        928
      ]
    },
    {
      "id": "aa34d9da-999e-42a8-b1f2-cba76f185cf6",
      "name": "Format Error",
      "type": "n8n-nodes-base.code",
      "position": [
        -1136,
        928
      ]
    },
    {
      "id": "85569d2d-3412-413f-94dd-70e112760e61",
      "name": "Slack - Error Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        -896,
        928
      ]
    }
  ],
  "connections": {
    "Format Error": {
      "main": [
        [
          {
            "node": "Slack - Error Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Score Router": {
      "main": [
        [
          {
            "node": "Format Slack Alert",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "API - Update Score (Warm)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log Cold Lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Error Trigger": {
      "main": [
        [
          {
            "node": "Format Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Cold Lead": {
      "main": [
        [
          {
            "node": "Format Success Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF - Valid Email": {
      "main": [
        [
          {
            "node": "Prepare API Body",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Format Error Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare API Body": {
      "main": [
        [
          {
            "node": "API - Upsert Contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Slack Alert": {
      "main": [
        [
          {
            "node": "Slack - Hot Lead Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Lead Data": {
      "main": [
        [
          {
            "node": "IF - Valid Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "API - Upsert Contact": {
      "main": [
        [
          {
            "node": "Calculate Lead Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Lead Score": {
      "main": [
        [
          {
            "node": "Score Router",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Error Response": {
      "main": [
        [
          {
            "node": "Respond - Validation Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack - Hot Lead Alert": {
      "main": [
        [
          {
            "node": "API - Update Score (Hot)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook - Lead Capture": {
      "main": [
        [
          {
            "node": "Normalize Lead Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Success Response": {
      "main": [
        [
          {
            "node": "Respond - Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "API - Update Score (Hot)": {
      "main": [
        [
          {
            "node": "Format Success Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "API - Update Score (Warm)": {
      "main": [
        [
          {
            "node": "Format Success Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}