{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "fdf378ff-a2b6-45a3-b741-216e7d9eb4d5",
      "name": "Lead Capture Form",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -3824,
        1728
      ],
      "parameters": {
        "path": "lead-capture-form",
        "options": {},
        "formTitle": "Get a Free Consultation",
        "formFields": {
          "values": [
            {
              "fieldType": "email",
              "fieldLabel": "Email",
              "placeholder": "user@example.com",
              "requiredField": true
            },
            {
              "fieldLabel": "First Name",
              "placeholder": "John",
              "requiredField": true
            },
            {
              "fieldLabel": "Last Name",
              "placeholder": "Doe"
            },
            {
              "fieldLabel": "Phone",
              "placeholder": "+1234567890"
            },
            {
              "fieldLabel": "Company",
              "placeholder": "Acme Corp"
            },
            {
              "fieldLabel": "Job Title",
              "placeholder": "Marketing Director"
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "What can we help you with?",
              "placeholder": "Tell us about your automation needs...",
              "requiredField": true
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "Budget Range",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Under $5,000"
                  },
                  {
                    "option": "$5,000 - $10,000"
                  },
                  {
                    "option": "$10,000 - $25,000"
                  },
                  {
                    "option": "$25,000 - $50,000"
                  },
                  {
                    "option": "$50,000+"
                  },
                  {
                    "option": "Not sure yet"
                  }
                ]
              }
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "Timeline",
              "fieldOptions": {
                "values": [
                  {
                    "option": "ASAP"
                  },
                  {
                    "option": "Within 1 month"
                  },
                  {
                    "option": "1-3 months"
                  },
                  {
                    "option": "3-6 months"
                  },
                  {
                    "option": "Just exploring"
                  }
                ]
              }
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "How did you hear about us?",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Google Search"
                  },
                  {
                    "option": "LinkedIn"
                  },
                  {
                    "option": "Referral"
                  },
                  {
                    "option": "Social Media"
                  },
                  {
                    "option": "YouTube"
                  },
                  {
                    "option": "Other"
                  }
                ]
              }
            }
          ]
        },
        "responseMode": "responseNode",
        "formDescription": "Tell us about your project and we'll get back to you within 24 hours."
      },
      "typeVersion": 2.1
    },
    {
      "id": "0d6074d9-c09b-43f0-94ca-caf5e9c6ab52",
      "name": "Send Form Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -3472,
        1488
      ],
      "parameters": {
        "options": {},
        "respondWith": "text",
        "responseBody": "Thanks for your submission! We'll be in touch soon."
      },
      "typeVersion": 1.1
    },
    {
      "id": "9fe1bcfa-d627-4a79-be94-0096cbac2978",
      "name": "Business Email?",
      "type": "n8n-nodes-base.if",
      "position": [
        -2944,
        1632
      ],
      "parameters": {
        "options": {
          "ignoreCase": true,
          "looseTypeValidation": true
        },
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "business-email-check",
              "operator": {
                "type": "boolean",
                "operation": "equals"
              },
              "leftValue": "={{ $json.isBusinessEmail }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "fc825881-1440-4db8-b9ac-d75e006ac980",
      "name": "Extract LinkedIn URL",
      "type": "n8n-nodes-base.code",
      "position": [
        -2480,
        1488
      ],
      "parameters": {
        "jsCode": "// Extract LinkedIn company URL from Google search results\nconst lead = $('Normalize Lead Data1').first().json;\nconst searchResults = $input.all().map(item => item.json);\n\nlet linkedInUrl = null;\nlet searchSuccess = false;\nlet matchedBy = null;\n\n// Get company name and domain for matching\nconst companyName = (lead.company || '').toLowerCase().trim();\nconst emailDomain = (lead.emailDomain || '').toLowerCase().split('.')[0]; // e.g., \"elima\" from \"elima.io\"\n\n// Build search terms for matching (company name, domain, variations)\nconst searchTerms = new Set();\nif (companyName) {\n  searchTerms.add(companyName.replace(/[^a-z0-9]/g, ''));\n  // Remove common suffixes\n  searchTerms.add(companyName.replace(/\\s*(inc|llc|ltd|corp|company|co|technologies|tech|solutions)\\.?$/i, '').replace(/[^a-z0-9]/g, ''));\n}\nif (emailDomain) {\n  searchTerms.add(emailDomain.replace(/[^a-z0-9]/g, ''));\n}\n\n// Remove empty strings\nsearchTerms.delete('');\n\ntry {\n  // Flatten results array\n  const results = searchResults.flat();\n  \n  // First pass: Find LinkedIn company URL that matches our company name/domain\n  for (const result of results) {\n    const url = (result.url || result.link || '');\n    const title = (result.title || '');\n    \n    // Match LinkedIn company pages (handles regional domains like in.linkedin.com, uk.linkedin.com, etc.)\n    const linkedInCompanyMatch = url.match(/linkedin\\.com\\/company\\/([^\\/\\?#]+)/i);\n    \n    if (linkedInCompanyMatch) {\n      // Skip LinkedIn help pages\n      if (url.toLowerCase().includes('/help/')) continue;\n      \n      const companySlug = linkedInCompanyMatch[1].toLowerCase().replace(/[^a-z0-9]/g, '');\n      const titleNormalized = title.toLowerCase().replace(/[^a-z0-9]/g, '');\n      \n      // Check if slug or title matches any of our search terms\n      for (const term of searchTerms) {\n        if (term.length < 2) continue; // Skip very short terms\n        \n        const isSlugMatch = companySlug.includes(term) || term.includes(companySlug);\n        const isTitleMatch = titleNormalized.includes(term);\n        \n        if (isSlugMatch || isTitleMatch) {\n          linkedInUrl = url;\n          searchSuccess = true;\n          matchedBy = isSlugMatch ? `slug: ${companySlug}` : `title: ${title}`;\n          break;\n        }\n      }\n      \n      if (searchSuccess) break;\n    }\n  }\n  \n  // Fallback: If no match found, use first valid LinkedIn company URL (not help page)\n  if (!searchSuccess) {\n    for (const result of results) {\n      const url = (result.url || result.link || '');\n      \n      if (url.match(/linkedin\\.com\\/company\\/[^\\/\\?#]+/i) && !url.toLowerCase().includes('/help/')) {\n        linkedInUrl = url;\n        searchSuccess = true;\n        matchedBy = 'fallback-first-company-url';\n        break;\n      }\n    }\n  }\n  \n} catch (error) {\n  console.log('Error parsing search results:', error.message);\n}\n\nreturn {\n  ...lead,\n  linkedInUrl: linkedInUrl,\n  linkedInSearchSuccess: searchSuccess,\n  matchedBy: matchedBy,\n  searchTermsUsed: Array.from(searchTerms),\n  googleSearchRaw: JSON.stringify(searchResults).substring(0, 500)\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "d1e3e67b-ab8c-481c-9422-8ad972756c00",
      "name": "LinkedIn URL Found?",
      "type": "n8n-nodes-base.if",
      "position": [
        -2288,
        1488
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "linkedin-found",
              "operator": {
                "type": "boolean",
                "operation": "equals"
              },
              "leftValue": "={{ $json.linkedInSearchSuccess }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "bac112ce-2d76-477e-b3a7-6363d710be44",
      "name": "Merge LinkedIn Data",
      "type": "n8n-nodes-base.code",
      "position": [
        -1840,
        1472
      ],
      "parameters": {
        "jsCode": "// Merge LinkedIn company data with lead\nconst lead = $('Extract LinkedIn URL').first().json;\nconst linkedInData = $input.all().map(item => item.json);\n\nlet companyData = {};\n\ntry {\n  // Handle array or object response\n  const results = Array.isArray(linkedInData) ? linkedInData.flat() : [linkedInData];\n  const company = results[0];\n  \n  if (company) {\n    // Build headquarters string from mainAddress if available\n    let headquarters = '';\n    if (company.mainAddress) {\n      const addr = company.mainAddress;\n      headquarters = [\n        addr.addressLocality,\n        addr.addressRegion,\n        addr.addressCountry\n      ].filter(Boolean).join(', ');\n    }\n    \n    // Parse specialties - can be string or array\n    let specialties = company.Specialties || company.specialties || '';\n    if (typeof specialties === 'string') {\n      specialties = specialties.split(',').map(s => s.trim()).filter(Boolean);\n    }\n    \n    companyData = {\n      // Basic info\n      name: company.name || lead.company,\n      slogan: company.slogan || '',\n      description: company.description || '',\n      website: company.website || '',\n      \n      // Industry & Type\n      industry: company.Industry || company.industry || '',\n      companyType: company.Type || company.type || '',\n      \n      // Size & Employees\n      employeeCount: company.numberOfEmployees || '',\n      employeeRange: company['Company size'] || company.companySize || '',\n      \n      // Location\n      headquarters: company.Headquarters || headquarters || '',\n      fullAddress: company.mainAddress ? [\n        company.mainAddress.streetAddress,\n        company.mainAddress.addressLocality,\n        company.mainAddress.addressRegion,\n        company.mainAddress.postalCode,\n        company.mainAddress.addressCountry\n      ].filter(Boolean).join(', ') : '',\n      allAddresses: company.addresses || [],\n      \n      // Dates & Stats\n      foundedYear: company.Founded || company.founded || '',\n      followerCount: company.FollowersCount || company.followersCount || '',\n      \n      // Other\n      specialties: specialties,\n      linkedInUrl: company.url || lead.linkedInUrl,\n      logoUrl: company.logo || '',\n      \n      // Related companies (useful for competitive analysis)\n      similarCompanies: (company.similarPages || []).slice(0, 5).map(p => ({\n        name: p.name,\n        industry: p.industry,\n        linkedInUrl: p.linkeinUrl || p.linkedInUrl\n      }))\n    };\n  }\n} catch (error) {\n  console.log('Error parsing LinkedIn data:', error.message);\n}\n\nreturn {\n  ...lead,\n  enrichedCompany: {\n    name: companyData.name || lead.company || 'Unknown',\n    slogan: companyData.slogan || '',\n    industry: companyData.industry || '',\n    description: companyData.description || '',\n    employees: companyData.employeeCount || '',\n    employeeRange: companyData.employeeRange || '',\n    headquarters: companyData.headquarters || '',\n    fullAddress: companyData.fullAddress || '',\n    website: companyData.website || '',\n    foundedYear: companyData.foundedYear || '',\n    specialties: Array.isArray(companyData.specialties) ? companyData.specialties.join(', ') : companyData.specialties,\n    linkedInUrl: companyData.linkedInUrl || '',\n    logoUrl: companyData.logoUrl || '',\n    followerCount: companyData.followerCount || '',\n    companyType: companyData.companyType || '',\n    similarCompanies: companyData.similarCompanies || []\n  },\n  enrichmentSource: 'linkedin',\n  enrichmentSuccessful: !!(companyData.name && (companyData.industry || companyData.description)),\n  enrichmentTimestamp: new Date().toISOString()\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "5eceb49f-c6a1-423c-a745-2650cd0fb035",
      "name": "Skip Enrichment (Fallback)",
      "type": "n8n-nodes-base.code",
      "position": [
        -2608,
        1776
      ],
      "parameters": {
        "jsCode": "// Create lead profile without enrichment (fallback path)\nconst lead = $input.first().json;\n\nreturn {\n  ...lead,\n  enrichedCompany: {\n    name: lead.company || 'Unknown',\n    industry: '',\n    description: '',\n    employees: '',\n    employeeRange: '',\n    headquarters: '',\n    website: lead.emailDomain ? `https://${lead.emailDomain}` : '',\n    foundedYear: '',\n    specialties: '',\n    linkedInUrl: '',\n    logoUrl: '',\n    followerCount: '',\n    companyType: ''\n  },\n  enrichmentSource: 'none',\n  enrichmentSuccessful: false,\n  enrichmentTimestamp: new Date().toISOString(),\n  enrichmentSkipReason: lead.isBusinessEmail ? 'LinkedIn URL not found' : 'Personal email - enrichment skipped'\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "25cffe86-41c5-459c-8c00-087cd6cc649f",
      "name": "Slack Cold Lead Log",
      "type": "n8n-nodes-base.slack",
      "position": [
        80,
        2336
      ],
      "parameters": {
        "text": "=\u2744\ufe0f *Cold/Disqualified Lead Logged*\n\n*{{ $json.fullName }}* ({{ $json.qualification.tier }})\n\ud83d\udcca Score: {{ $json.qualification.score }}/100\n\ud83d\udce7 {{ $json.email }}\n\n_Reason: {{ $json.qualification.reasoning }}_",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C08LYRVFVGU",
          "cachedResultName": "n8n"
        },
        "otherOptions": {
          "includeLinkToWorkflow": false
        },
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "fedc61bc-4e5b-4ed1-a426-f6197b3e2236",
      "name": "Normalize Lead Data1",
      "type": "n8n-nodes-base.code",
      "position": [
        -3392,
        1728
      ],
      "parameters": {
        "jsCode": "// Normalize and prepare lead data from form submission\nconst input = $input.first().json;\n\n// Extract and normalize fields from form\nconst lead = {\n  leadId: `LEAD-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,\n  timestamp: new Date().toISOString(),\n  \n  // Contact Information (map from form field labels)\n  email: (input['Email'] || input.email || '').toLowerCase().trim(),\n  firstName: (input['First Name'] || input.firstName || '').trim(),\n  lastName: (input['Last Name'] || input.lastName || '').trim(),\n  phone: (input['Phone'] || input.phone || '').replace(/[^0-9+]/g, ''),\n  \n  // Company Information\n  company: (input['Company'] || input.company || '').trim(),\n  jobTitle: (input['Job Title'] || input.jobTitle || '').trim(),\n  \n  // Lead Context\n  message: (input['What can we help you with?'] || input.message || '').trim(),\n  budget: input['Budget Range'] || input.budget || '',\n  timeline: input['Timeline'] || input.timeline || '',\n  source: input['How did you hear about us?'] || input.source || 'direct',\n  \n  // Derived fields\n  fullName: '',\n  emailDomain: '',\n  \n  // Validation\n  isValid: false,\n  validationErrors: []\n};\n\n// Build full name\nlead.fullName = `${lead.firstName} ${lead.lastName}`.trim() || 'Unknown';\n\n// Extract domain from email for enrichment\nif (lead.email && lead.email.includes('@')) {\n  lead.emailDomain = lead.email.split('@')[1];\n  \n  // Skip common personal email domains for enrichment\n  const personalDomains = ['gmail.com', 'yahoo.com', 'hotmail.com', 'outlook.com', 'icloud.com', 'aol.com', 'mail.com', 'protonmail.com'];\n  lead.isBusinessEmail = !personalDomains.includes(lead.emailDomain.toLowerCase());\n} else {\n  lead.isBusinessEmail = false;\n}\n\n// Basic validation\nconst validationErrors = [];\nif (!lead.email || !lead.email.includes('@')) {\n  validationErrors.push('Invalid or missing email');\n}\nif (!lead.firstName) {\n  validationErrors.push('Missing first name');\n}\n\nlead.isValid = validationErrors.length === 0;\nlead.validationErrors = validationErrors;\n\n// Store raw form data\nlead.rawFormData = JSON.stringify(input);\n\nreturn lead;"
      },
      "typeVersion": 2
    },
    {
      "id": "32d808e7-8e67-43b4-b04e-a709e93a35c2",
      "name": "Valid Lead?1",
      "type": "n8n-nodes-base.if",
      "position": [
        -3168,
        1728
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "valid-check",
              "operator": {
                "type": "boolean",
                "operation": "equals"
              },
              "leftValue": "={{ $json.isValid }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "74f29b67-4cbd-42ec-9e17-1a474ee6756c",
      "name": "AI Lead Qualification1",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -1568,
        1776
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1",
          "cachedResultName": "GPT-4.1"
        },
        "options": {
          "temperature": 0.3
        },
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "=You are an expert B2B lead qualification specialist for an AI Automation Agency. Analyze the provided lead data and return a JSON object with your assessment.\n\nYour response must be valid JSON with this exact structure:\n{\n  \"qualificationScore\": <number 0-100>,\n  \"qualificationTier\": \"<hot|warm|cold|Disqualified>\",\n  \"buyerPersona\": \"<Decision Maker|Influencer|Champion|End User|Unknown>\",\n  \"urgencyLevel\": \"<High|Medium|Low>\",\n  \"budgetFit\": \"<Enterprise|Mid-Market|SMB|Unknown>\",\n  \"keyInsights\": [\"<insight1>\", \"<insight2>\", \"<insight3>\"],\n  \"suggestedNextSteps\": [\"<action1>\", \"<action2>\"],\n  \"personalizedTalkingPoints\": [\"<point1>\", \"<point2>\"],\n  \"riskFactors\": [\"<risk1>\"],\n  \"idealOutreachChannel\": \"<Email|Phone|LinkedIn|Multi-touch>\",\n  \"suggestedOutreachTiming\": \"<Immediate|24h|48h|1week>\",\n  \"qualificationReasoning\": \"<brief explanation>\"\n}\n\nScoring Guidelines:\n- 80-100 (hot): Strong buying signals, budget confirmed, decision maker, urgent timeline (ASAP or within 1 month)\n- 60-79 (warm): Good fit, some buying signals, may need nurturing, timeline 1-3 months\n- 40-59 (cold): Potential fit but unclear intent or timeline (3-6 months or exploring)\n- 0-39 (Disqualified): Poor fit, invalid data, spam indicators, or clearly not a buyer\n\nContext: We are an AI Automation Agency offering workflow automation, voice agents, and AI-powered solutions. Our ideal clients are businesses looking to automate repetitive tasks, improve efficiency, or implement AI solutions."
            },
            {
              "content": "=Analyze this lead and provide qualification assessment:\n\n**Contact Information:**\n- Name: {{ $json.fullName }}\n- Email: {{ $json.email }}\n- Job Title: {{ $json.jobTitle || 'Not provided' }}\n- Phone: {{ $json.phone || 'Not provided' }}\n\n**Company Information:**\n- Company Name: {{ $json.enrichedCompany.name }}\n- Industry: {{ $json.enrichedCompany.industry || 'Unknown' }}\n- Company Size: {{ $json.enrichedCompany.employees || 'Unknown' }}\n- Location: {{ $json.enrichedCompany.headquarters || 'Unknown' }}\n- Website: {{ $json.enrichedCompany.website || 'Unknown' }}\n- Description: {{ $json.enrichedCompany.description || 'Not available' }}\n- LinkedIn: {{ $json.enrichedCompany.linkedInUrl || 'Not found' }}\n\n**Lead Context:**\n- Source: {{ $json.source }}\n- Message/Inquiry: {{ $json.message }}\n- Budget Indicated: {{ $json.budget || 'Not specified' }}\n- Timeline: {{ $json.timeline || 'Not specified' }}\n\n**Data Quality:**\n- Business Email: {{ $json.isBusinessEmail }}\n- Enrichment Successful: {{ $json.enrichmentSuccessful }}\n\nProvide your qualification assessment as valid JSON only."
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.4
    },
    {
      "id": "5a661554-863b-4905-a610-5f2bcc7eeff7",
      "name": "Build Qualified Lead Profile1",
      "type": "n8n-nodes-base.code",
      "position": [
        -1200,
        1776
      ],
      "parameters": {
        "jsCode": "// Parse AI qualification response and build final lead profile\n// Get lead data from whichever path executed (enriched or fallback)\nlet lead;\ntry {\n  lead = $('Merge LinkedIn Data').first().json;\n} catch (e) {\n  lead = $('Skip Enrichment (Fallback)').first().json;\n}\n\nconst aiResponse = $input.first().json;\n\n// Parse AI response (handle both string and object responses)\nlet qualification;\ntry {\n  qualification = typeof aiResponse.message?.content === 'string' \n    ? JSON.parse(aiResponse.message.content) \n    : aiResponse.message?.content || aiResponse;\n} catch (e) {\n  // Fallback if AI response isn't proper JSON\n  qualification = {\n    qualificationScore: 50,\n    qualificationTier: 'Cold',\n    buyerPersona: 'Unknown',\n    urgencyLevel: 'Low',\n    budgetFit: 'Unknown',\n    keyInsights: ['AI qualification parsing failed - manual review required'],\n    suggestedNextSteps: ['Manual qualification required'],\n    personalizedTalkingPoints: [],\n    riskFactors: ['AI qualification error'],\n    idealOutreachChannel: 'Email',\n    suggestedOutreachTiming: '48h',\n    qualificationReasoning: 'Automated qualification parsing failed - review raw response'\n  };\n}\n\n// Build final qualified lead object\nconst qualifiedLead = {\n  // Core lead data\n  leadId: lead.leadId,\n  timestamp: lead.timestamp,\n  \n  // Contact info\n  email: lead.email,\n  firstName: lead.firstName,\n  lastName: lead.lastName,\n  fullName: lead.fullName,\n  phone: lead.phone,\n  jobTitle: lead.jobTitle,\n  \n  // Company info\n  company: lead.company,\n  enrichedCompany: lead.enrichedCompany,\n  \n  // Lead context\n  message: lead.message,\n  budget: lead.budget,\n  timeline: lead.timeline,\n  source: lead.source,\n  \n  // Data quality flags\n  isBusinessEmail: lead.isBusinessEmail,\n  enrichmentSuccessful: lead.enrichmentSuccessful,\n  enrichmentSource: lead.enrichmentSource,\n  \n  // AI Qualification Results\n  qualification: {\n    score: qualification.qualificationScore || 0,\n    tier: qualification.qualificationTier || 'cold',\n    buyerPersona: qualification.buyerPersona || 'Unknown',\n    urgencyLevel: qualification.urgencyLevel || 'Low',\n    budgetFit: qualification.budgetFit || 'Unknown',\n    reasoning: qualification.qualificationReasoning || ''\n  },\n  \n  // AI Insights\n  insights: {\n    keyInsights: qualification.keyInsights || [],\n    suggestedNextSteps: qualification.suggestedNextSteps || [],\n    talkingPoints: qualification.personalizedTalkingPoints || [],\n    riskFactors: qualification.riskFactors || []\n  },\n  \n  // Outreach Recommendations\n  outreach: {\n    channel: qualification.idealOutreachChannel || 'Email',\n    timing: qualification.suggestedOutreachTiming || '48h',\n    priority: qualification.qualificationScore >= 80 ? 'High' : \n              qualification.qualificationScore >= 60 ? 'Medium' : 'Low'\n  },\n  \n  // Processing metadata\n  processedAt: new Date().toISOString(),\n  pipelineVersion: '2.1'\n};\n\nreturn qualifiedLead;"
      },
      "typeVersion": 2
    },
    {
      "id": "a70b8660-06f9-49d0-a6de-4faff0204bb4",
      "name": "Hot Lead?1",
      "type": "n8n-nodes-base.if",
      "position": [
        -896,
        1776
      ],
      "parameters": {
        "options": {
          "ignoreCase": true,
          "looseTypeValidation": true
        },
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "hot-lead-check",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.qualification.tier }}",
              "rightValue": "hot"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "890eec61-f9fa-445d-96e3-a4a474ceaaef",
      "name": "Slack Hot Lead Alert1",
      "type": "n8n-nodes-base.slack",
      "position": [
        -480,
        1488
      ],
      "parameters": {
        "text": "=\ud83d\udd25 *HOT LEAD ALERT* \ud83d\udd25\n\n*{{ $json.fullName }}* from *{{ $json.enrichedCompany.name }}*\n\n\ud83d\udcca *Qualification Score:* {{ $json.qualification.score }}/100\n\ud83d\udc64 *Buyer Persona:* {{ $json.qualification.buyerPersona }}\n\ud83d\udcb0 *Budget Fit:* {{ $json.qualification.budgetFit }}\n\u23f0 *Urgency:* {{ $json.qualification.urgencyLevel }}\n\n\ud83d\udce7 *Email:* {{ $json.email }}\n\ud83d\udcde *Phone:* {{ $json.phone || 'Not provided' }}\n\ud83d\udcbc *Title:* {{ $json.jobTitle || 'Not provided' }}\n\n\ud83c\udfe2 *Company Details:*\n\u2022 Industry: {{ $json.enrichedCompany.industry || 'Unknown' }}\n\u2022 Size: {{ $json.enrichedCompany.employees || 'Unknown' }}\n\u2022 Location: {{ $json.enrichedCompany.headquarters || 'Unknown' }}\n\u2022 LinkedIn: {{ $json.enrichedCompany.linkedInUrl || 'Not found' }}\n\n\ud83d\udcac *Their Message:*\n{{ $json.message }}\n\n\ud83d\udcb5 *Budget:* {{ $json.budget || 'Not specified' }}\n\u23f1\ufe0f *Timeline:* {{ $json.timeline || 'Not specified' }}\n\n\ud83d\udca1 *AI Insights:*\n{{ $json.insights.keyInsights.map(i => '\u2022 ' + i).join('\\n') }}\n\n\ud83c\udfaf *Suggested Next Steps:*\n{{ $json.insights.suggestedNextSteps.map(s => '\u2022 ' + s).join('\\n') }}\n\n\ud83d\udcac *Talking Points:*\n{{ $json.insights.talkingPoints.map(p => '\u2022 ' + p).join('\\n') }}\n\n\u26a0\ufe0f *Risk Factors:*\n{{ $json.insights.riskFactors.length > 0 ? $json.insights.riskFactors.map(r => '\u2022 ' + r).join('\\n') : '\u2022 None identified' }}\n\n\ud83d\udcde *Recommended:* {{ $json.outreach.channel }} within {{ $json.outreach.timing }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C08LYRVFVGU",
          "cachedResultName": "n8n"
        },
        "otherOptions": {
          "includeLinkToWorkflow": false
        },
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "30a0620d-3a83-4200-95fb-9af823bcfb2f",
      "name": "Warm Lead?1",
      "type": "n8n-nodes-base.if",
      "position": [
        -480,
        2048
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "warm-lead-check",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.qualification.tier }}",
              "rightValue": "warm"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "7f889070-13b2-4deb-a085-466a2b9faba9",
      "name": "AI Generate Personalized Email1",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -496,
        1760
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1",
          "cachedResultName": "GPT-4.1"
        },
        "options": {
          "temperature": 0.7
        },
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "=You are a professional sales development representative for Agentical AI, an AI Automation Agency. Write a personalized, warm outreach email that:\n\n1. References something specific about their company, role, or inquiry\n2. Addresses their likely pain points based on their message and industry\n3. Provides value upfront (insight, tip, or relevant observation)\n4. Has a clear, low-commitment CTA (15-min call, not a demo)\n5. Is concise (under 150 words body)\n6. Sounds human and conversational, not templated\n7. Does NOT use generic phrases like \"I hope this email finds you well\"\n\nServices we offer:\n- AI-powered workflow automation (n8n, Make, Zapier)\n- Voice agents and conversational AI\n- Custom AI solutions and integrations\n- Process automation consulting\n\nReturn JSON with:\n{\n  \"subject\": \"<compelling, personalized subject line - no generic 'Quick Question' style>\",\n  \"body\": \"<email body with proper formatting, include signature as 'Best,\\n[Name]\\nAgentical AI'>\",\n  \"followUpTiming\": \"<recommended follow-up timing>\"\n}"
            },
            {
              "content": "=Write a personalized outreach email for this HOT lead:\n\n**Contact:**\n- Name: {{ $json.fullName }}\n- Title: {{ $json.jobTitle || 'Not specified' }}\n- Email: {{ $json.email }}\n\n**Company:**\n- Company: {{ $json.enrichedCompany.name }}\n- Industry: {{ $json.enrichedCompany.industry || 'Unknown' }}\n- Size: {{ $json.enrichedCompany.employees || 'Unknown' }}\n- Description: {{ $json.enrichedCompany.description || 'Not available' }}\n\n**Their Inquiry:**\n{{ $json.message }}\n\n**Context:**\n- Budget: {{ $json.budget || 'Not specified' }}\n- Timeline: {{ $json.timeline || 'Not specified' }}\n- Source: {{ $json.source }}\n\n**AI-Generated Talking Points:**\n{{ $json.insights.talkingPoints.join('\\n') }}\n\nWrite the email as valid JSON."
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.4
    },
    {
      "id": "dc024a50-bc04-409c-8d88-4d60c8b9bb6f",
      "name": "Create HubSpot Contact1",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        64,
        1488
      ],
      "parameters": {
        "email": "={{ $('Build Qualified Lead Profile1').first().json.email }}",
        "options": {},
        "authentication": "appToken",
        "additionalFields": {
          "lastName": "={{ $('Build Qualified Lead Profile1').first().json.lastName }}",
          "firstName": "={{ $('Build Qualified Lead Profile1').first().json.firstName }}",
          "customPropertiesUi": {
            "customPropertiesValues": [
              {
                "value": "={{ $('Build Qualified Lead Profile1').first().json.jobTitle }}",
                "property": "jobtitle1"
              },
              {
                "value": "={{ $('Build Qualified Lead Profile1').first().json.source }}",
                "property": "lead_source"
              },
              {
                "value": "={{ $('Build Qualified Lead Profile1').first().json.qualification.score }}",
                "property": "lead_score"
              },
              {
                "value": "={{ $('Build Qualified Lead Profile1').first().json.qualification.tier }}",
                "property": "lead_tier"
              },
              {
                "value": "={{ $('Build Qualified Lead Profile1').first().json.insights.keyInsights.join('; ') }}",
                "property": "ai_insights"
              },
              {
                "value": "={{ $('Build Qualified Lead Profile1').first().json.enrichedCompany.industry }}",
                "property": "industry1"
              },
              {
                "value": "={{ $('Build Qualified Lead Profile1').first().json.message }}",
                "property": "message1"
              }
            ]
          }
        }
      },
      "credentials": {
        "hubspotAppToken": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "7cbd5f67-9e20-41c2-88b2-dab991518b58",
      "name": "Slack Warm Lead Notification1",
      "type": "n8n-nodes-base.slack",
      "position": [
        64,
        2032
      ],
      "parameters": {
        "text": "=\ud83d\udce5 *New Warm Lead*\n\n*{{ $json.fullName }}* ({{ $json.qualification.tier }})\n\ud83d\udcca Score: {{ $json.qualification.score }}/100\n\ud83c\udfe2 {{ $json.enrichedCompany.name }} | {{ $json.enrichedCompany.industry || 'Unknown industry' }}\n\ud83d\udcac {{ $json.message.substring(0, 100) }}{{ $json.message.length > 100 ? '...' : '' }}\n\n_Added to nurture sequence_",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C08LYRVFVGU",
          "cachedResultName": "n8n"
        },
        "otherOptions": {
          "includeLinkToWorkflow": false
        },
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "facabd1a-612c-435e-acaa-2d2e94d980b9",
      "name": "Log to Google Sheets1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -912,
        2112
      ],
      "parameters": {
        "columns": {
          "value": {
            "Email": "={{ $json.email }}",
            "Phone": "={{ $json.phone }}",
            "Source": "={{ $json.source }}",
            "Company": "={{ $json.enrichedCompany.name }}",
            "Lead ID": "={{ $json.leadId }}",
            "Message": "={{ $json.message }}",
            "Urgency": "={{ $json.qualification.urgencyLevel }}",
            "Campaign": "={{ $json.campaign || '' }}",
            "Industry": "={{ $json.enrichedCompany.industry }}",
            "Location": "={{ $json.enrichedCompany.headquarters }}",
            "Full Name": "={{ $json.fullName }}",
            "Job Title": "={{ $json.jobTitle }}",
            "Lead Tier": "={{ $json.qualification.tier }}",
            "Timestamp": "={{ $json.timestamp }}",
            "Budget Fit": "={{ $json.qualification.budgetFit }}",
            "Lead Score": "={{ $json.qualification.score }}",
            "Next Steps": "={{ $json.insights.suggestedNextSteps.join('; ') }}",
            "AI Insights": "={{ $json.insights.keyInsights.join('; ') }}",
            "Company Size": "={{ $json.enrichedCompany.employees }}",
            "Processed At": "={{ $json.processedAt }}",
            "Risk Factors": "={{ $json.insights.riskFactors.join('; ') }}",
            "Buyer Persona": "={{ $json.qualification.buyerPersona }}",
            "Revenue Range": "={{ $json.enrichedCompany.annualRevenue || '' }}",
            "Email Verified": "={{ $json.emailVerified || '' }}",
            "Outreach Timing": "={{ $json.outreach.timing }}",
            "Outreach Channel": "={{ $json.outreach.channel }}"
          },
          "schema": [
            {
              "id": "Lead ID",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Lead ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Full Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Full 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": "Job Title",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Job Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Company",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Industry",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Industry",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company Size",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Company Size",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Revenue Range",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Revenue Range",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Location",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Location",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Lead Score",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Lead Score",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Lead Tier",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Lead Tier",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Buyer Persona",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Buyer Persona",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Urgency",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Urgency",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Budget Fit",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Budget Fit",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Source",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Source",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Campaign",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Campaign",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Message",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "AI Insights",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "AI Insights",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Next Steps",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Next Steps",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Risk Factors",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Risk Factors",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Outreach Channel",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Outreach Channel",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Outreach Timing",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Outreach Timing",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email Verified",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Email Verified",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Processed At",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Processed At",
              "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/1vKK2PVyQT4RcKYU4pbAO3yOvoAUUg2ulQM4X7MhviHM/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1vKK2PVyQT4RcKYU4pbAO3yOvoAUUg2ulQM4X7MhviHM",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vKK2PVyQT4RcKYU4pbAO3yOvoAUUg2ulQM4X7MhviHM/edit?usp=drivesdk",
          "cachedResultName": "Lead Database"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.4
    },
    {
      "id": "3fd6cfde-b36b-4d0d-a458-29bc7bf13d6b",
      "name": "Google Search (Find LinkedIn URL)",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        -2688,
        1488
      ],
      "parameters": {
        "url": "=https://api.apify.com/v2/acts/mina_safwat~google-search-scraper-ppr/run-sync-get-dataset-items",
        "method": "POST",
        "options": {
          "redirect": {}
        },
        "jsonBody": "={\n    \"lang\": \"en\",\n    \"searchTerm\": \"provide the linkedin company page url for company  - {{ $json.company || $json.emailDomain }}\",\n    \"unique\": true\n,\n    \"memory\": 256\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN_HERE"
            }
          ]
        }
      },
      "typeVersion": 4.2,
      "alwaysOutputData": true
    },
    {
      "id": "44632191-a684-407d-b97b-b016fd1f0adc",
      "name": "LinkedIn Company Scraper",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        -2048,
        1472
      ],
      "parameters": {
        "url": "=https://api.apify.com/v2/acts/logical_scrapers~linkedin-company-scraper-ppr/run-sync-get-dataset-items",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n    \"url\": [\n        \"{{ $json.linkedInUrl }}\"\n    ]\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN_HERE"
            }
          ]
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2,
      "alwaysOutputData": true
    },
    {
      "id": "dc2b5c73-5da4-443e-9861-c57d546f4331",
      "name": "Send Personalized Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        64,
        1760
      ],
      "parameters": {
        "sendTo": "={{ $('Build Qualified Lead Profile1').first().json.email }}",
        "message": "={{ $json.message.content.body }}",
        "options": {},
        "subject": "={{ $json.message.content.subject }} ",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "67df1996-c2a8-4565-91f1-4ef99b5a4693",
      "name": "Handle Invalid Lead",
      "type": "n8n-nodes-base.stopAndError",
      "position": [
        -2928,
        1984
      ],
      "parameters": {
        "errorMessage": "=Lead validation failed: {{ $json.validationErrors.join(', ') }}"
      },
      "typeVersion": 1
    },
    {
      "id": "3e4107de-07c4-4ac5-993e-ed4b67d2d289",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4304,
        1456
      ],
      "parameters": {
        "color": 5,
        "width": 320,
        "height": 723,
        "content": "## \ud83d\ude80 AI-Powered Lead Qualification\n\nThis template automatically qualifies, enriches, and routes incoming leads using AI.\n\n### What it does\n- Captures leads via built-in form\n- Enriches company data from LinkedIn (via Apify)\n- AI scores leads 0-100 and assigns tier\n- Routes Hot/Warm/Cold leads to appropriate actions\n- Sends personalized emails & Slack alerts\n\n### How to use\n1. Configure credentials (see Requirements)\n2. Customize the form fields if needed\n3. Activate the workflow\n4. Embed the form or share the URL\n\n### Requirements\n- **OpenAI** - For AI qualification\n- **Apify** - For LinkedIn enrichment\n- **Slack** (optional) - For alerts\n- **HubSpot** (optional) - For CRM\n- **Gmail** (optional) - For emails\n- **Google Sheets** (optional) - For logging\n\n### Apify Setup\nCreate \"HTTP Query Auth\" credential:\n- Parameter Name: `token`\n- Parameter Value: `your-apify-api-key`\n\n### Cost\n~$0.02-0.03 per enriched lead\n\n### Need Help?\nJoin the [n8n Discord](https://discord.gg/n8n) or contact [Agentical AI](https://agenticalai.com)"
      },
      "typeVersion": 1
    },
    {
      "id": "88355b51-b396-480c-9424-74f2e288b6c2",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3808,
        1280
      ],
      "parameters": {
        "color": 4,
        "width": 440,
        "height": 212,
        "content": "### 1. Lead Capture & Validation\n\nThe form captures lead data and validates:\n- Email format check\n- Business vs personal email detection\n- Data normalization\n\nPersonal emails (Gmail, Yahoo, etc.) skip enrichment but still get AI qualified."
      },
      "typeVersion": 1
    },
    {
      "id": "77ac0198-88de-4d04-91e8-0e2409a18599",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2704,
        1184
      ],
      "parameters": {
        "color": 4,
        "width": 500,
        "height": 284,
        "content": "### 2. Company Enrichment (Apify)\n\nFor business emails:\n1. Google Search finds LinkedIn company URL\n2. LinkedIn Scraper extracts company profile\n3. Data merged with lead info\n\n**Actors Used:**\n- Google Search Scraper PPR\n- LinkedIn Company Scraper PPR\n\nIf LinkedIn not found, proceeds without enrichment."
      },
      "typeVersion": 1
    },
    {
      "id": "b38bf6ae-7e99-4d69-8d16-1799df9ec08c",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1600,
        1440
      ],
      "parameters": {
        "color": 4,
        "width": 360,
        "height": 284,
        "content": "### 3. AI Qualification (GPT-4o)\n\nAI analyzes lead data and returns:\n- **Score**: 0-100\n- **Tier**: Hot/Warm/Cold/Disqualified\n- **Buyer Persona**: Decision Maker, Influencer, etc.\n- **Key Insights**: Why this score\n- **Talking Points**: For sales outreach\n- **Risk Factors**: Potential objections\n\nEdit the system prompt to customize scoring criteria."
      },
      "typeVersion": 1
    },
    {
      "id": "b7bab488-6088-4051-9a16-2eac6649e702",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1024,
        1440
      ],
      "parameters": {
        "color": 4,
        "width": 300,
        "height": 280,
        "content": "### 4. Lead Routing & Actions\n\n**\ud83d\udd25 Hot (80-100)**\n\u2192 Slack alert + AI email + HubSpot\n\n**\ud83c\udf21\ufe0f Warm (60-79)**\n\u2192 Slack notification\n\n**\u2744\ufe0f Cold (<60)**\n\u2192 Logged only\n\n**All leads** \u2192 Google Sheets"
      },
      "typeVersion": 1
    },
    {
      "id": "7fd13407-5c32-4f2f-a4e8-b3ef37ef6c83",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -432,
        1232
      ],
      "parameters": {
        "color": 6,
        "width": 444,
        "height": 188,
        "content": "### 5. Hot Lead Actions\n\n1. **Slack Alert** - Instant notification with all details\n2. **AI Email** - Personalized outreach generated by GPT\n3. **HubSpot** - Contact created with lead score & insights"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Hot Lead?1": {
      "main": [
        [
          {
            "node": "Slack Hot Lead Alert1",
            "type": "main",
            "index": 0
          },
          {
            "node": "AI Generate Personalized Email1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Warm Lead?1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Warm Lead?1": {
      "main": [
        [
          {
            "node": "Slack Warm Lead Notification1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Slack Cold Lead Log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Valid Lead?1": {
      "main": [
        [
          {
            "node": "Business Email?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Handle Invalid Lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Business Email?": {
      "main": [
        [
          {
            "node": "Google Search (Find LinkedIn URL)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Skip Enrichment (Fallback)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Lead Capture Form": {
      "main": [
        [
          {
            "node": "Send Form Response",
            "type": "main",
            "index": 0
          },
          {
            "node": "Normalize Lead Data1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LinkedIn URL Found?": {
      "main": [
        [
          {
            "node": "LinkedIn Company Scraper",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Skip Enrichment (Fallback)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge LinkedIn Data": {
      "main": [
        [
          {
            "node": "AI Lead Qualification1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract LinkedIn URL": {
      "main": [
        [
          {
            "node": "LinkedIn URL Found?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Lead Data1": {
      "main": [
        [
          {
            "node": "Valid Lead?1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack Hot Lead Alert1": {
      "main": [
        [
          {
            "node": "Create HubSpot Contact1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Lead Qualification1": {
      "main": [
        [
          {
            "node": "Build Qualified Lead Profile1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LinkedIn Company Scraper": {
      "main": [
        [
          {
            "node": "Merge LinkedIn Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Skip Enrichment (Fallback)": {
      "main": [
        [
          {
            "node": "AI Lead Qualification1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Qualified Lead Profile1": {
      "main": [
        [
          {
            "node": "Hot Lead?1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Log to Google Sheets1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Generate Personalized Email1": {
      "main": [
        [
          {
            "node": "Send Personalized Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Search (Find LinkedIn URL)": {
      "main": [
        [
          {
            "node": "Extract LinkedIn URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}