{
  "name": "AI Lead Enrichment and Qualification System",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        448,
        -160
      ],
      "id": "b0175182-20ff-4506-ae16-ae92eae8f8ee",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "YOUR_GOOGLE_SHEET_ID",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "Sheet1",
          "mode": "name"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        640,
        0
      ],
      "id": "a5863b8c-dc57-4e43-b4f8-b9f3e39e9e6b",
      "name": "Get row(s) in sheet",
      "alwaysOutputData": false
    },
    {
      "parameters": {
        "options": {
          "reset": false
        }
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        848,
        -16
      ],
      "id": "55c29b7b-d203-489b-b143-dd493f6479d4",
      "name": "Loop Over Items"
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "gpt-4o",
          "mode": "list",
          "cachedResultName": "GPT-4O"
        },
        "responses": {
          "values": [
            {
              "role": "system",
              "content": "=You are a strict lead qualification assistant.\n\nYour job is to evaluate leads using ONLY the information provided.\nDo NOT assume, guess, or invent any missing data.\n\n---\n\nAnalyze this lead:\n\nName:{{ $('Loop Over Items').item.json.Name }}\nBusiness: {{ $('Loop Over Items').item.json.Business }}\nNiche: {{ $('Loop Over Items').item.json.Niche }}\nWebsite: {{ $('Loop Over Items').item.json.Website }}\nLocation: {{ $('Loop Over Items').item.json.Location }}\n\n---\n\nRULES:\n\n- Use ONLY the given data\n- If information is missing, acknowledge it briefly but DO NOT ask for more details\n- DO NOT guess or fill gaps\n- DO NOT return N/A\n- ALWAYS produce an output\n\n---\n\nTASKS:\n\n1. Write a short, factual description based only on the provided data\n2. Assign a score from 1\u201310:\n   - Complete, clear business info \u2192 higher score\n   - Partial info \u2192 medium score\n   - Very little info \u2192 low score (1\u20133)\n3. Classify the lead:\n   - HOT \u2192 clear, valuable, actionable lead\n   - WARM \u2192 some useful info but incomplete\n   - COLD \u2192 insufficient or weak information\n\n---\n\nSCORING GUIDE:\n\n- 8\u201310 \u2192 HOT (clear, strong business details)\n- 5\u20137 \u2192 WARM (moderate clarity)\n- 1\u20134 \u2192 COLD (missing or weak data)\n\n---\n\nOUTPUT RULES:\n\n- Be concise and direct\n- No assumptions\n- No fluff\n- No questions\n- No disclaimers like \u201ccannot analyze\u201d\n\n---\n\nReturn STRICTLY in this format:\n\nDescription: <your answer>\nScore: <number only>\nStatus: <HOT/WARM/COLD>\n\nGenerate a detailed and precise 2\u20133 sentence business description using all available input data. If a website link or content is provided, extract and incorporate only relevant, factual insights from it. Do not assume or invent any information\u2014base the description strictly on verifiable data."
            }
          ]
        },
        "builtInTools": {},
        "options": {
          "textFormat": {
            "textOptions": {
              "type": "json_schema",
              "name": "project_two",
              "schema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"Description\": {\n      \"type\": \"string\"\n    },\n    \"Score\":{\n      \"type\": \"string\"\n    },\n    \"Status\":{\n      \"type\": \"string\"\n    }\n  },\n  \"additionalProperties\": false,\n  \"required\": [\"Description\", \"Score\", \"Status\"]\n}",
              "strict": true
            }
          },
          "temperature": 0.1
        }
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 2.1,
      "position": [
        1248,
        -16
      ],
      "id": "af37054d-bd79-4408-9c80-18c172a49192",
      "name": "Message a model"
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "YOUR_GOOGLE_SHEET_ID",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "Sheet1",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "row_number": "={{ $('Get row(s) in sheet').item.json.row_number }}",
            "Description": "={{ $json.output[0].content[0].text.Description }}",
            "Score": "={{ $json.output[0].content[0].text.Score }}",
            "Status": "={{ $json.output[0].content[0].text.Status }}",
            "Stage": "Successful"
          },
          "matchingColumns": [
            "row_number"
          ],
          "schema": [
            {
              "id": "Name",
              "displayName": "Name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Business",
              "displayName": "Business",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Niche",
              "displayName": "Niche",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "displayName": "Email",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Website",
              "displayName": "Website",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Location",
              "displayName": "Location",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Lead Source",
              "displayName": "Lead Source",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Description",
              "displayName": "Description",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Score",
              "displayName": "Score",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "displayName": "Status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Stage",
              "displayName": "Stage",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "readOnly": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        1552,
        -16
      ],
      "id": "fe25d320-5bea-4b29-bdd9-bf14a0a21d6c",
      "name": "Update row in sheet"
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "YOUR_GOOGLE_SHEET_ID",
          "mode": "id"
        },
        "sheetName": {
          "__rl": true,
          "value": "Sheet1",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "row_number": "={{ $json.row_number }}",
            "Stage": "Processing..."
          },
          "matchingColumns": [
            "row_number"
          ],
          "schema": [
            {
              "id": "Name",
              "displayName": "Name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Business",
              "displayName": "Business",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Niche",
              "displayName": "Niche",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "displayName": "Email",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Website",
              "displayName": "Website",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Location",
              "displayName": "Location",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Lead Source",
              "displayName": "Lead Source",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Description",
              "displayName": "Description",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Score",
              "displayName": "Score",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "displayName": "Status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Stage",
              "displayName": "Stage",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "readOnly": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        1056,
        -16
      ],
      "id": "89267f0a-55b3-459b-8a6e-3b94c3e58cb4",
      "name": "Update row in sheet1",
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "amount": 10
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1792,
        -16
      ],
      "id": "d0e795f8-bc34-4ce3-ad04-91bd52758abe",
      "name": "Wait"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": false,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "b1438642-f7cd-4b39-bed1-1be4a60f2058",
              "leftValue": "={{ $json.Stage }}",
              "rightValue": "Successful",
              "operator": {
                "type": "string",
                "operation": "notContains"
              }
            },
            {
              "id": "7c29af61-e2b1-4041-85cc-e4455140f466",
              "leftValue": "={{ $json.Stage }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              }
            }
          ],
          "combinator": "or"
        },
        "options": {
          "ignoreCase": true
        }
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        768,
        -192
      ],
      "id": "0a05fb19-cd68-4d58-9548-5a9ddd29bac0",
      "name": "If"
    }
  ],
  "connections": {
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Update row in sheet1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model": {
      "main": [
        [
          {
            "node": "Update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row in sheet": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row in sheet1": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "availableInMCP": false,
    "timeSavedMode": "fixed",
    "callerPolicy": "workflowsFromSameOwner"
  },
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "tags": []
}