{
  "id": "Yh3pOgI7Cbhjk1AQ",
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "name": "AI Personal Shopper & Lead Capture System",
  "tags": [],
  "nodes": [
    {
      "id": "7f411ecd-838c-4bca-9c7e-cdb93a7d47b3",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2976,
        -784
      ],
      "parameters": {
        "width": 480,
        "height": 896,
        "content": "## AI Personal Shopper & Lead Capture System\n\n### How it works\n\nThis workflow captures a shopper lead from a Tally form, loads the product catalog, matches relevant products, and asks an AI service to generate a lead score and personalized email content. It saves the enriched lead to a Google Sheets CRM, sends the initial personalized email, alerts the owner in Slack, then runs a two-step 24-hour follow-up sequence while marking each follow-up in the CRM.\n\n### Setup steps\n\n- Configure the Tally form webhook to call the n8n webhook URL for the lead intake trigger.\n- Connect Google Sheets credentials and select the correct spreadsheet/ranges for both the product catalog and CRM lead tracking sheet.\n- Configure the AI HTTP request endpoint, model, and prompt payload; ensure the Ollama or compatible chat API at the configured host is reachable from n8n.\n- Connect Gmail credentials and verify sender settings, subject lines, and email body fields for the initial and follow-up emails.\n- Connect Slack credentials and select the owner notification channel or user.\n- Review the Wait nodes to confirm the 24-hour delays match the desired follow-up cadence.\n\n### Customization\n\nAdjust the product matching code, AI scoring prompt, email templates, Slack alert content, and follow-up timing to fit the store\u2019s products, tone, and sales process."
      },
      "typeVersion": 1
    },
    {
      "id": "2436ec4f-0d42-42a2-9eb2-5bcff42e63df",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2416,
        -784
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 336,
        "content": "## Capture lead data\n\nReceives the shopper lead from the Tally webhook and loads the product catalog from Google Sheets so the workflow has both customer preferences and available products."
      },
      "typeVersion": 1
    },
    {
      "id": "0cb3dafb-f17a-4be3-97b8-bf4939e869ce",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1968,
        -768
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 320,
        "content": "## Match and generate AI\n\nRuns custom matching logic against the catalog, sends the matched context to the AI service, and parses the AI response into usable lead score and email content fields."
      },
      "typeVersion": 1
    },
    {
      "id": "37ccf3de-3a38-4169-8ce6-c4a37e17cf4b",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1296,
        -736
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 304,
        "content": "## Save and notify\n\nStores the enriched lead in the CRM sheet, sends the personalized first email through Gmail, and alerts the owner in Slack about the new lead."
      },
      "typeVersion": 1
    },
    {
      "id": "78ed52fc-9c67-4021-9264-a3460eae26c0",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -624,
        -736
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 304,
        "content": "## First follow-up\n\nWaits 24 hours, sends the first follow-up email, and updates the CRM sheet to record that the first follow-up was sent."
      },
      "typeVersion": 1
    },
    {
      "id": "74c7fde7-d8e7-4caf-bd51-cf8c827a8b1a",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        -736
      ],
      "parameters": {
        "color": 7,
        "width": 640,
        "height": 304,
        "content": "## Final follow-up\n\nWaits another 24 hours, sends the second follow-up email, and marks the final follow-up status in the CRM sheet."
      },
      "typeVersion": 1
    },
    {
      "id": "55ebe667-0d65-4011-bd49-c0e26fa830e1",
      "name": "When New Lead Received",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -2368,
        -608
      ],
      "parameters": {
        "path": "your-webhook-path-here",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2.1
    },
    {
      "id": "ccdb5300-fb0d-40e1-a106-d0711aba804b",
      "name": "Read Product Catalog from Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -2144,
        -608
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 0,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_PRODUCTS_SHEET_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_PRODUCTS_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_PRODUCTS_SHEET_ID/edit",
          "cachedResultName": "Products"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "c0222eb4-6dc3-4018-b53d-8cb94e2db67c",
      "name": "Match Products with Lead Info",
      "type": "n8n-nodes-base.code",
      "position": [
        -1920,
        -608
      ],
      "parameters": {
        "jsCode": "const wh = $('When New Lead Received').first().json.body.data.fields;\n\nconst gender = wh[3].options.find(o => o.id === wh[3].value[0]).text;\nconst category = wh[4].options.find(o => o.id === wh[4].value[0]).text;\nconst budget = wh[5].options.find(o => o.id === wh[5].value[0]).text;\nconst size = wh[6].value;\nconst color = wh[7].value;\n\nfunction parseBudget(str) {\n  const nums = str.match(/\\d+/g)?.map(Number) || [];\n  if (/under/i.test(str)) return { min: 0, max: nums[0] || 75 };\n  if (/above/i.test(str)) return { min: nums[0] || 200, max: 99999 };\n  if (nums.length >= 2) return { min: nums[0], max: nums[1] };\n  return { min: 0, max: 99999 };\n}\n\nconst { min, max } = parseBudget(budget);\nconst midpoint = (min + max) / 2;\n\nconst allProducts = $('Read Product Catalog from Sheets').all().map(item => item.json);\n\nconst candidates = allProducts.filter(p =>\n  String(p['Gender']).toLowerCase() === gender.toLowerCase() &&\n  String(p['Category']).toLowerCase() === category.toLowerCase()\n);\n\nlet inBudget = candidates.filter(p => Number(p['Price']) >= min && Number(p['Price']) <= max);\nlet outBudget = candidates.filter(p => Number(p['Price']) < min || Number(p['Price']) > max);\n\ninBudget.sort((a, b) => Math.abs(Number(a['Price']) - midpoint) - Math.abs(Number(b['Price']) - midpoint));\noutBudget.sort((a, b) => Math.abs(Number(a['Price']) - midpoint) - Math.abs(Number(b['Price']) - midpoint));\n\nconst matched = inBudget.concat(outBudget).slice(0, 3);\n\nconst productListText = matched.map(p =>\n  `${p['Product Name']} | ${p['Brand']} | $${p['Price']} | Colors: ${p['Colors Available']}`\n).join('\\n');\n\nconst cleanProductNames = matched.map(p => p['Product Name']).join(', ');\n\nreturn [{ json: { gender, category, budget, size, color, matched_products_text: productListText, clean_product_names: cleanProductNames } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "f252cdca-28e3-4c26-a208-e5b05f3eace0",
      "name": "Post to AI Scoring API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1696,
        -608
      ],
      "parameters": {
        "url": "http://host.docker.internal:11434/api/chat",
        "method": "POST",
        "options": {
          "timeout": 300000
        },
        "jsonBody": "={{ JSON.stringify({\n  \"model\": \"llama3.2\",\n  \"stream\": false,\n  \"messages\": [\n    {\n      \"role\": \"system\",\n      \"content\": \"You are an AI personal shopper for a shoe store. Use the given matched products exactly as provided - never invent or rename products.\\n\\nSCORE THE LEAD STRICTLY:\\nHOT = Budget above $150 AND size provided AND color provided\\nWARM = Budget $100-$150, OR only some details provided\\nCOLD = Budget under $100, OR size missing, OR vague request\\n\\nFor EMAIL_BODY: write ONLY 2-3 sentences recommending the products. No greeting (Dear/Hi), no signature (Best regards/Your Name).\\n\\nAlways output all 4 fields, never skip any:\\nLEAD_SCORE: (one word: HOT, WARM, or COLD)\\nTOP_PRODUCTS: (the exact product names given)\\nEMAIL_SUBJECT: (short subject line)\\nEMAIL_BODY: (recommendation only, no greeting or signature)\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": \"Matched Products:\\n\" + $json.matched_products_text + \"\\n\\nCustomer:\\nGender: \" + $json.gender + \"\\nCategory: \" + $json.category + \"\\nBudget: \" + $json.budget + \"\\nSize: \" + $json.size + \"\\nColor: \" + $json.color\n    }\n  ]\n}) }}",
        "sendBody": true,
        "specifyBody": "json"
      },
      "typeVersion": 4.4
    },
    {
      "id": "9e4fcd93-0a9e-45de-8d18-6649a3bdf270",
      "name": "Parse AI Scoring Response",
      "type": "n8n-nodes-base.code",
      "position": [
        -1472,
        -608
      ],
      "parameters": {
        "jsCode": "const response = items[0].json.message.content;\n\nconst scoreMatch = response.match(/LEAD_SCORE:\\s*(\\w+)/i);\nconst subjectLineMatch = response.match(/EMAIL[\\s_]SUBJECT:\\s*(.*)/i);\n\nconst bodyRegex = /EMAIL[\\s_]BODY:/gi;\nlet lastIndex = -1, match;\nwhile ((match = bodyRegex.exec(response)) !== null) {\n  lastIndex = match.index + match[0].length;\n}\n\nconst lead_score = scoreMatch ? scoreMatch[1].trim().toUpperCase() : 'WARM';\nconst top_products = $('Match Products with Lead Info').first().json.clean_product_names;\nconst email_subject = subjectLineMatch ? subjectLineMatch[1].trim().replace(/^[\"']|[\"']$/g, '') : 'Your Personalized Shoe Picks';\n\nlet raw_body = lastIndex !== -1 ? response.slice(lastIndex).trim() : '';\nif (!raw_body) raw_body = `Based on your preferences, here are our top picks: ${top_products}.`;\n\nraw_body = raw_body.replace(/^(Dear|Hi|Hello|Hey)\\b[^.!?\\n]{0,30}[.!?]\\s*/i, '');\nraw_body = raw_body.replace(/\\n*\\b(Best regards|Sincerely|Warm regards)\\b[\\s\\S]*$/i, '').trim();\n\nconst cleaned = raw_body\n  .replace(/\\r\\n/g, '\\n')\n  .replace(/\\n{2,}/g, '\\n\\n')\n  .split('\\n\\n')\n  .map(p => p.replace(/\\n/g, ' ').replace(/\\s+/g, ' ').trim())\n  .filter(p => p.length > 0)\n  .join('<br><br>');\n\nconst finalCleaned = cleaned.replace(/,(?!\\s)/g, ', ');\nconst customerName = $('When New Lead Received').first().json.body.data.fields[0].value;\nconst companyName = 'StrideWell Footwear';\n\nconst email_body = `Hi ${customerName},<br><br>${finalCleaned}<br><br>Best regards,<br>${companyName} Team`;\n\nreturn [{ json: { lead_score, top_products, email_subject, email_body } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "6f1362a7-2992-413f-a442-90a2d85f652d",
      "name": "Append Lead to CRM Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1248,
        -608
      ],
      "parameters": {
        "columns": {
          "value": {
            "Date": "={{ $now.toFormat('MM/dd/yyyy') }}",
            "Name": "={{ $('When New Lead Received').item.json.body.data.fields[0].value }}",
            "Size": "={{ $('When New Lead Received').item.json.body.data.fields[6].value }}",
            "Color": "={{ $('When New Lead Received').item.json.body.data.fields[7].value }}",
            "Email": "={{ $('When New Lead Received').item.json.body.data.fields[1].value }}",
            "Phone": "={{ $('When New Lead Received').item.json.body.data.fields[2].value }}",
            "Budget": "={{ $('When New Lead Received').item.json.body.data.fields[5].options.find(o => o.id === $('When New Lead Received').item.json.body.data.fields[5].value[0]).text }}",
            "Gender": "={{ $('When New Lead Received').item.json.body.data.fields[3].options.find(o => o.id === $('When New Lead Received').item.json.body.data.fields[3].value[0]).text }}",
            "Category": "={{ $('When New Lead Received').item.json.body.data.fields[4].options.find(o => o.id === $('When New Lead Received').item.json.body.data.fields[4].value[0]).text }}",
            "Email Sent": "Yes",
            "Lead Score": "={{ $json.lead_score }}",
            "Follow Up 1": "No",
            "Follow Up 2": "No",
            "Lead Status": "New",
            "Top Products": "={{ $json.top_products }}"
          },
          "schema": [
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Gender",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Gender",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Category",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Budget",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Budget",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Size",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Size",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Color",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Color",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Lead Score",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Lead Score",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Lead Status",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Lead Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Top Products",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Top Products",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email Sent",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Email Sent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Follow Up 1",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Follow Up 1",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Follow Up 2",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Follow Up 2",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_LEADS_SHEET_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_LEADS_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_LEADS_SHEET_ID/edit",
          "cachedResultName": "Leads"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "b1ac50c2-b9dd-4297-bb70-6765cef79fdf",
      "name": "Send Customized Email via Gmail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -1024,
        -608
      ],
      "parameters": {
        "sendTo": "={{ $('When New Lead Received').item.json.body.data.fields[1].value }}",
        "message": "={{ $('Parse AI Scoring Response').item.json.email_body }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "={{ $('Parse AI Scoring Response').item.json.email_subject }}"
      },
      "typeVersion": 2.2
    },
    {
      "id": "59f3e72e-8331-49d9-8363-62ad359144be",
      "name": "Notify Owner via Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        -800,
        -608
      ],
      "parameters": {
        "text": "=\ud83d\udd14 New Lead Alert!  Name: {{ $('When New Lead Received').item.json.body.data.fields[0].value }} Score: {{ $('Parse AI Scoring Response').item.json.lead_score }} Category: {{ $('When New Lead Received').item.json.body.data.fields[4].options.find(o => o.id === $('When New Lead Received').item.json.body.data.fields[4].value[0]).text }} Budget: {{ $('When New Lead Received').item.json.body.data.fields[5].options.find(o => o.id === $('When New Lead Received').item.json.body.data.fields[5].value[0]).text }}  Check CRM for full details \ud83d\udcca",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_SLACK_CHANNEL_ID",
          "cachedResultName": "your-channel-name"
        },
        "otherOptions": {}
      },
      "typeVersion": 2.5
    },
    {
      "id": "c75807a3-e1e0-4efd-b33a-3e3857f2d6ce",
      "name": "Wait 24 Hours",
      "type": "n8n-nodes-base.wait",
      "position": [
        -576,
        -608
      ],
      "parameters": {
        "unit": "hours",
        "amount": 24
      },
      "typeVersion": 1.1
    },
    {
      "id": "47acc8b9-8781-42d7-880e-d2f76b6720c5",
      "name": "Send First Follow-Up Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -352,
        -608
      ],
      "parameters": {
        "sendTo": "={{ $('When New Lead Received').item.json.body.data.fields[1].value }}",
        "message": "=Hi {{ $('When New Lead Received').item.json.body.data.fields[0].value }},\n\n<br><br>Just checking in! We saved your top picks for you: {{ $('Parse AI Scoring Response').item.json.top_products }}<br><br>Let us know if you have any questions \u2014 we're happy to help!<br><br>Best regards,<br>The StrideWell Footwear Team",
        "options": {
          "appendAttribution": false
        },
        "subject": "Still thinking about your shoes?"
      },
      "typeVersion": 2.2
    },
    {
      "id": "333299d0-ee3e-408f-84c3-f241a8ea2c40",
      "name": "Update Follow-Up 1 Status",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -128,
        -608
      ],
      "parameters": {
        "columns": {
          "value": {
            "Email": "={{ $('When New Lead Received').item.json.body.data.fields[1].value }}",
            "Follow Up 1": "Yes"
          },
          "schema": [
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Gender",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Gender",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Category",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Budget",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Budget",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Size",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Size",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Color",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Color",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Lead Score",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Lead Score",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Lead Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Lead Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Top Products",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Top Products",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email Sent",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email Sent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Follow Up 1",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Follow Up 1",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Follow Up 2",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Follow Up 2",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Email"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_LEADS_SHEET_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_LEADS_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_LEADS_SHEET_ID/edit",
          "cachedResultName": "Leads"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "7929ef27-ac9f-4d4a-8a47-13d0d6f36402",
      "name": "Wait Final 24 Hours",
      "type": "n8n-nodes-base.wait",
      "position": [
        96,
        -608
      ],
      "parameters": {
        "unit": "hours",
        "amount": 24
      },
      "typeVersion": 1.1
    },
    {
      "id": "7658ad0c-20be-4577-9995-e45edd90ccec",
      "name": "Send Second Follow-Up Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        320,
        -608
      ],
      "parameters": {
        "sendTo": "={{ $('When New Lead Received').item.json.body.data.fields[1].value }}",
        "message": "=Hi {{ $('When New Lead Received').item.json.body.data.fields[0].value }},<br><br>This is your final reminder! Your top picks ({{ $('Parse AI Scoring Response').item.json.top_products }}) are still waiting for you.<br><br>Use code <strong>SHOE10</strong> for 10% off \u2014 today only!<br><br>Best regards,<br>The StrideWell Footwear Team",
        "options": {
          "appendAttribution": false
        },
        "subject": "Last chance \u2014 10% off your shoes!"
      },
      "typeVersion": 2.2
    },
    {
      "id": "eb5f6e22-3c26-4a1e-8fb9-14bf0cb65e57",
      "name": "Update Follow-Up 2 Status",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        544,
        -608
      ],
      "parameters": {
        "columns": {
          "value": {
            "Email": "={{ $('When New Lead Received').item.json.body.data.fields[1].value }}",
            "Follow Up 2": "Yes"
          },
          "schema": [
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Gender",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Gender",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Category",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Budget",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Budget",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Size",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Size",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Color",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Color",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Lead Score",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Lead Score",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Lead Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Lead Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Top Products",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Top Products",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email Sent",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email Sent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Follow Up 1",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Follow Up 1",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Follow Up 2",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Follow Up 2",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Email"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_LEADS_SHEET_ID/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_LEADS_SHEET_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_LEADS_SHEET_ID/edit",
          "cachedResultName": "Leads"
        }
      },
      "typeVersion": 4.7
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "af5f6c44-0e0a-4e0c-8157-fdae9674d8e7",
  "nodeGroups": [],
  "connections": {
    "Wait 24 Hours": {
      "main": [
        [
          {
            "node": "Send First Follow-Up Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait Final 24 Hours": {
      "main": [
        [
          {
            "node": "Send Second Follow-Up Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify Owner via Slack": {
      "main": [
        [
          {
            "node": "Wait 24 Hours",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to AI Scoring API": {
      "main": [
        [
          {
            "node": "Parse AI Scoring Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When New Lead Received": {
      "main": [
        [
          {
            "node": "Read Product Catalog from Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append Lead to CRM Sheets": {
      "main": [
        [
          {
            "node": "Send Customized Email via Gmail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI Scoring Response": {
      "main": [
        [
          {
            "node": "Append Lead to CRM Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Follow-Up 1 Status": {
      "main": [
        [
          {
            "node": "Wait Final 24 Hours",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send First Follow-Up Email": {
      "main": [
        [
          {
            "node": "Update Follow-Up 1 Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Second Follow-Up Email": {
      "main": [
        [
          {
            "node": "Update Follow-Up 2 Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Match Products with Lead Info": {
      "main": [
        [
          {
            "node": "Post to AI Scoring API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Customized Email via Gmail": {
      "main": [
        [
          {
            "node": "Notify Owner via Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Product Catalog from Sheets": {
      "main": [
        [
          {
            "node": "Match Products with Lead Info",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}