8
n8n 中文网amn8n.com

使用AI丰富线索并评分

高级

这是一个自动化工作流,包含 28 个节点。主要使用 Code, Gmail, Merge, Slack, Switch 等节点。 使用Claude AI、PDL和Perplexity自动丰富和评分线索

前置要求
  • Google 账号和 Gmail API 凭证
  • Slack Bot Token 或 Webhook URL
  • HubSpot API Key
  • HTTP Webhook 端点(n8n 会自动生成)
  • 可能需要目标 API 的认证凭证
  • Anthropic API Key

分类

-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "RGhbI0ICGWVFNcVv",
  "meta": {
    "instanceId": "42b2652ebb0a87755df4710a5630695eec8e35cb0ce04a63b0e25751b1f044f1",
    "templateCredsSetupCompleted": true
  },
  "name": "使用 AI 丰富线索并评分",
  "tags": [],
  "nodes": [
    {
      "id": "b66eb945-3521-4613-948d-a75c36ad09c4",
      "name": "验证和解析输入",
      "type": "n8n-nodes-base.code",
      "position": [
        -784,
        480
      ],
      "parameters": {
        "jsCode": "const chatInput = $json.chatInput ? $json.chatInput.trim() : '';\n\nif (!chatInput) {\n  return [{json: {error: 'No input provided', validationPassed: false}}];\n}\n\nconst parts = chatInput.split(',').map(p => p.trim());\nlet email, name;\n\nif (parts.length === 2) {\n  email = parts[0].toLowerCase().replace(/['\"]/g, '');\n  name = parts[1].replace(/['\"]/g, '');\n} else if (parts.length === 1) {\n  email = parts[0].toLowerCase().replace(/['\"]/g, '');\n  name = null;\n} else {\n  return [{json: {error: 'Invalid format. Use: email or email, name', validationPassed: false}}];\n}\n\nconst emailRegex = new RegExp('^[^\\\\s@]+@[^\\\\s@]+\\\\.[^\\\\s@]+$');\nif (!emailRegex.test(email)) {\n  return [{json: {error: 'Invalid email format: ' + email, validationPassed: false}}];\n}\n\nconst domain = email.split('@')[1];\nconst isFreeEmail = ['gmail.com', 'yahoo.com', 'hotmail.com', 'outlook.com'].includes(domain);\n\nreturn [{\n  json: {\n    email: email,\n    name: name,\n    domain: domain,\n    isFreeEmail: isFreeEmail,\n    originalInput: chatInput,\n    timestamp: new Date().toISOString(),\n    validationPassed: true\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "13770db8-7d8e-477f-ba58-6996ad31fc9a",
      "name": "PDL 丰富",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -608,
        384
      ],
      "parameters": {
        "url": "https://api.peopledatalabs.com/v5/person/enrich",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "email",
              "value": "={{ $json.email }}"
            },
            {
              "name": "pretty",
              "value": "true"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "ueZhQQeVyWm8j5Wb",
          "name": "Zoom"
        }
      },
      "typeVersion": 4.2,
      "continueOnFail": true
    },
    {
      "id": "0d603f14-9665-4563-aa6c-3f48f1b9d57e",
      "name": "个人研究",
      "type": "n8n-nodes-base.perplexity",
      "position": [
        -368,
        272
      ],
      "parameters": {
        "options": {},
        "messages": {
          "message": [
            {
              "content": "=Research {{ $json.data.full_name }} at {{ $json.data.job_company_name }} for B2B sales context.\n\nFocus on:\n1. Recent career moves or promotions (last 6 months)\n2. Professional achievements and thought leadership\n3. Speaking engagements or publications\n4. Relevant timing signals for outreach\n\nProvide ONLY actionable insights for sales in under 150 words.\n\nFormat:\nRECENT ACTIVITY: [Key recent developments]\nEXPERTISE: [Professional focus areas]\nOUTREACH ANGLE: [Best conversation starter]\nTIMING: [High/Medium/Low urgency]"
            }
          ]
        },
        "requestOptions": {}
      },
      "credentials": {
        "perplexityApi": {
          "id": "zcUXOu9Mm9oaXJep",
          "name": "Perplexity account"
        }
      },
      "typeVersion": 1,
      "continueOnFail": true
    },
    {
      "id": "e40a3d01-cf95-4a7e-818c-3df1609c2b61",
      "name": "公司研究",
      "type": "n8n-nodes-base.perplexity",
      "position": [
        -368,
        416
      ],
      "parameters": {
        "options": {},
        "messages": {
          "message": [
            {
              "content": "=Research {{ $json.data.job_company_name }} for B2B sales intelligence.\n\nFocus ONLY on last 90 days:\n1. Funding rounds, acquisitions, or financial news\n2. Executive changes or restructuring\n3. New product launches or market expansion\n4. Technology stack changes or digital transformation\n5. Growth signals (hiring, new offices, partnerships)\n\nProvide under 150 words.\n\nFormat:\nRECENT DEVELOPMENTS: [Key changes]\nBUYING SIGNALS: [What suggests they're in market]\nCOMPANY HEALTH: [Financial/growth status]\nPRIORITY: [High/Medium/Low for sales timing]"
            }
          ]
        },
        "requestOptions": {}
      },
      "credentials": {
        "perplexityApi": {
          "id": "zcUXOu9Mm9oaXJep",
          "name": "Perplexity account"
        }
      },
      "typeVersion": 1,
      "continueOnFail": true
    },
    {
      "id": "13eb8525-4863-4b36-8291-1dc811314255",
      "name": "合并丰富数据",
      "type": "n8n-nodes-base.code",
      "position": [
        224,
        416
      ],
      "parameters": {
        "jsCode": "const inputs = $input.all();\n\nconst enrichedData = {\n  contact: {\n    email: null,\n    name: null\n  },\n  enrichment: {\n    pdl: {},\n    individual: {},\n    company: {},\n    linkedin: {}\n  },\n  metadata: {\n    enrichmentTimestamp: new Date().toISOString(),\n    sourcesSuccessful: [],\n    sourcesFailed: []\n  }\n};\n\ninputs.forEach((input, index) => {\n  const data = input.json;\n  \n  if (index === 0 && data.choices && data.choices[0] && data.choices[0].message && data.choices[0].message.content) {\n    const content = data.choices[0].message.content;\n    enrichedData.enrichment.individual = {\n      rawResearch: content,\n      recentActivity: extractSection(content, 'RECENT ACTIVITY'),\n      expertise: extractSection(content, 'EXPERTISE'),\n      outreachAngle: extractSection(content, 'OUTREACH ANGLE'),\n      timing: extractSection(content, 'TIMING')\n    };\n    enrichedData.metadata.sourcesSuccessful.push('Individual Research');\n  }\n  \n  else if (index === 1 && data && !data.error) {\n    const pdl = data.data || data;\n    enrichedData.enrichment.pdl = {\n      fullName: pdl.full_name,\n      jobTitle: pdl.job_title,\n      companyName: pdl.job_company_name,\n      companySize: pdl.job_company_size,\n      industry: pdl.job_company_industry,\n      seniorityLevel: pdl.job_title_levels,\n      linkedinUrl: pdl.linkedin_url,\n      location: pdl.location_name,\n      skills: pdl.skills\n    };\n    enrichedData.contact.name = pdl.full_name;\n    enrichedData.metadata.sourcesSuccessful.push('PDL');\n  }\n  \n  else if (index === 2 && data.choices && data.choices[0] && data.choices[0].message && data.choices[0].message.content) {\n    const content = data.choices[0].message.content;\n    enrichedData.enrichment.company = {\n      rawResearch: content,\n      developments: extractSection(content, 'RECENT DEVELOPMENTS'),\n      buyingSignals: extractSection(content, 'BUYING SIGNALS'),\n      companyHealth: extractSection(content, 'COMPANY HEALTH'),\n      priority: extractSection(content, 'PRIORITY')\n    };\n    enrichedData.metadata.sourcesSuccessful.push('Company Research');\n  }\n  \n  else if (index === 3 && data && Array.isArray(data) && data.length > 0) {\n    const profile = data[0];\n    enrichedData.enrichment.linkedin = {\n      headline: profile.headline,\n      summary: profile.summary,\n      recentPosts: profile.posts ? profile.posts.slice(0, 5) : [],\n      connectionsCount: profile.connectionsCount,\n      postsAnalyzed: true\n    };\n    enrichedData.metadata.sourcesSuccessful.push('LinkedIn');\n  }\n  \n  else if (index === 4 && data.validationPassed) {\n    enrichedData.contact.email = data.email;\n    enrichedData.contact.domain = data.domain;\n    enrichedData.contact.isFreeEmail = data.isFreeEmail;\n  }\n});\n\nconst qualityScore = calculateQuality(enrichedData);\nenrichedData.metadata.dataQualityScore = qualityScore;\n\nfunction extractSection(text, header) {\n  const pattern = header + ': ';\n  const startIdx = text.indexOf(pattern);\n  if (startIdx === -1) return 'N/A';\n  const afterHeader = text.substring(startIdx + pattern.length);\n  const endIdx = afterHeader.search(/\\n[A-Z]/);\n  return endIdx === -1 ? afterHeader.trim() : afterHeader.substring(0, endIdx).trim();\n}\n\nfunction calculateQuality(data) {\n  let score = 0;\n  if (data.enrichment.pdl.fullName) score += 25;\n  if (data.enrichment.individual.recentActivity !== 'N/A') score += 25;\n  if (data.enrichment.company.developments !== 'N/A') score += 25;\n  if (data.enrichment.linkedin.postsAnalyzed) score += 25;\n  return score;\n}\n\nreturn [{ json: enrichedData }];"
      },
      "typeVersion": 2
    },
    {
      "id": "c23aed66-e846-4781-a030-6cfb42b397ef",
      "name": "合并所有来源",
      "type": "n8n-nodes-base.merge",
      "position": [
        32,
        368
      ],
      "parameters": {
        "numberInputs": 5
      },
      "typeVersion": 3.2
    },
    {
      "id": "51e743be-5ec5-4de3-9dfb-0e4ef85f511a",
      "name": "解析和结构化输出",
      "type": "n8n-nodes-base.code",
      "position": [
        704,
        416
      ],
      "parameters": {
        "jsCode": "const raw = $input.first().json.output;\n\nlet scoring;\ntry {\n  let cleaned = raw.replace(/```json\\n?|```\\n?/g, '').trim();\n  cleaned = cleaned.replace(/,(\\s*[}\\]])/g, '$1');\n  scoring = JSON.parse(cleaned);\n  \n} catch (err) {\n  const extract = (field) => {\n    const regex = new RegExp('\"' + field + '\":\\\\s*\"([^\"]*(?:\\\\\\\\.[^\"]*)*)\"', 's');\n    const match = raw.match(regex);\n    return match ? match[1].replace(/\\\\n/g, '\\n').replace(/\\\\\"/g, '\"') : null;\n  };\n  \n  const extractArray = (field) => {\n    const regex = new RegExp('\"' + field + '\":\\\\s*\\\\[([^\\\\]]+)\\\\]', 's');\n    const match = raw.match(regex);\n    if (!match) return [];\n    return match[1].split(',').map(s => s.trim().replace(/^\"|\"$/g, ''));\n  };\n  \n  const extractNumber = (field) => {\n    const regex = new RegExp('\"' + field + '\":\\\\s*(\\\\d+)');\n    const match = raw.match(regex);\n    return match ? parseInt(match[1]) : 0;\n  };\n  \n  const extractObject = (field) => {\n    const regex = new RegExp('\"' + field + '\":\\\\s*({[^}]+})');\n    const match = raw.match(regex);\n    if (!match) return {};\n    try {\n      return JSON.parse(match[1]);\n    } catch {\n      return {};\n    }\n  };\n  \n  scoring = {\n    email: extract('email'),\n    name: extract('name'),\n    title: extract('title'),\n    companyName: extract('companyName'),\n    companySize: extract('companySize'),\n    industry: extract('industry'),\n    seniorityLevel: extractArray('seniorityLevel'),\n    linkedinUrl: extract('linkedinUrl'),\n    individualResearch: extract('individualResearch'),\n    companyResearch: extract('companyResearch'),\n    dataQualityScore: extractNumber('dataQualityScore'),\n    leadScore: extractNumber('leadScore'),\n    scoreBreakdown: extractObject('scoreBreakdown'),\n    icpMatch: extractObject('icpMatch'),\n    keyInsights: extractArray('keyInsights'),\n    outreachRecommendation: extract('outreachRecommendation'),\n    conversationStarters: extractArray('conversationStarters'),\n    timingOpportunities: extractArray('timingOpportunities'),\n    redFlags: extractArray('redFlags'),\n    nextAction: extract('nextAction'),\n    confidenceLevel: extract('confidenceLevel'),\n    routingCategory: extract('routingCategory')\n  };\n}\n\nconst finalLead = {\n  email: scoring.email,\n  name: scoring.name,\n  title: scoring.title,\n  companyName: scoring.companyName,\n  companySize: scoring.companySize,\n  industry: scoring.industry,\n  seniorityLevel: scoring.seniorityLevel,\n  linkedinUrl: scoring.linkedinUrl,\n  individualResearch: scoring.individualResearch,\n  companyResearch: scoring.companyResearch,\n  dataQualityScore: scoring.dataQualityScore,\n  leadScore: scoring.leadScore,\n  scoreBreakdown: scoring.scoreBreakdown,\n  scoreReasoning: scoring.leadScore + '/10 - ' + Object.entries(scoring.scoreBreakdown || {}).map(function(pair) { return pair[0] + ': ' + pair[1]; }).join(', '),\n  icpMatch: scoring.icpMatch,\n  companySizeMatch: scoring.icpMatch ? scoring.icpMatch.companySizeMatch : null,\n  industryMatch: scoring.icpMatch ? scoring.icpMatch.industryMatch : null,\n  titleMatch: scoring.icpMatch ? scoring.icpMatch.titleMatch : null,\n  keyInsights: scoring.keyInsights || [],\n  outreachRecommendation: scoring.outreachRecommendation,\n  conversationStarters: scoring.conversationStarters || [],\n  timingOpportunities: scoring.timingOpportunities || [],\n  redFlags: scoring.redFlags || [],\n  nextAction: scoring.nextAction,\n  confidenceLevel: scoring.confidenceLevel,\n  routingCategory: scoring.routingCategory,\n  processedAt: new Date().toISOString()\n};\n\nreturn [{ json: finalLead }];"
      },
      "typeVersion": 2
    },
    {
      "id": "7589e25e-910e-4304-8449-27ace6765c1c",
      "name": "按分数路由",
      "type": "n8n-nodes-base.switch",
      "position": [
        896,
        400
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Hot Lead",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "99013e96-7d32-48fc-907d-d524c3cfb81d",
                    "operator": {
                      "type": "number",
                      "operation": "gte"
                    },
                    "leftValue": "={{ $json.leadScore }}",
                    "rightValue": 8
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Warm Lead",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "2b850a5b-5f06-482b-925c-0dee244e61ed",
                    "operator": {
                      "type": "number",
                      "operation": "gte"
                    },
                    "leftValue": "={{ $json.leadScore }}",
                    "rightValue": 5
                  },
                  {
                    "id": "186f945d-b433-44e4-8954-e89781754d4e",
                    "operator": {
                      "type": "number",
                      "operation": "lt"
                    },
                    "leftValue": "={{ $json.leadScore }}",
                    "rightValue": 8
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Cold Lead",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "d54da592-8730-409e-80e1-d4550c85ae9d",
                    "operator": {
                      "type": "number",
                      "operation": "lt"
                    },
                    "leftValue": "={{ $json.leadScore }}",
                    "rightValue": 5
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "7ed0a825-6e4c-49ef-92b7-3f1ec790beb0",
      "name": "发送热门线索 Slack 提醒",
      "type": "n8n-nodes-base.slack",
      "position": [
        2048,
        144
      ],
      "webhookId": "a387ee5b-e454-4f69-af8a-4447539ec064",
      "parameters": {
        "text": "={{ $json.content.parts[0].text }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C096FHNCPUM",
          "cachedResultName": "all-connors-personal-slack"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "id": "WTvc9wCjXLzxylDB",
          "name": "Slack account"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "261f7748-68b5-4839-9df4-128af5724b6c",
      "name": "解析邮件 JSON",
      "type": "n8n-nodes-base.code",
      "position": [
        1872,
        320
      ],
      "parameters": {
        "jsCode": "const inputData = $input.first().json;\n\nconst raw = inputData.content && inputData.content.parts && inputData.content.parts[0] ? inputData.content.parts[0].text : null;\n\nif (!raw) {\n  return [{json: {error: 'Could not find email content in response'}}];\n}\n\nconst cleanedRaw = raw.replace(/```json\\n?|```\\n?/g, '').trim();\nconst emailData = JSON.parse(cleanedRaw);\n\nreturn [{\n  json: {\n    to: emailData.email,\n    subject: emailData.subject,\n    body: emailData.body\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "7435b309-71ef-447f-b90d-0024e576a6a2",
      "name": "发送热门线索邮件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2048,
        320
      ],
      "webhookId": "e733042b-2ce4-45c1-805d-e956a4593d07",
      "parameters": {
        "sendTo": "={{ $json.to }}",
        "message": "={{ $json.body }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "={{ $json.subject }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "0YFKsvO6JXOfT7wI",
          "name": "Gmail account 2"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "bf14b094-a26d-4eac-882c-f4255b4907e8",
      "name": "发送温线索到摘要",
      "type": "n8n-nodes-base.slack",
      "position": [
        2048,
        496
      ],
      "webhookId": "68ba787c-94c7-4833-ba59-3d03ac6510bc",
      "parameters": {
        "text": "={{ $json.content.parts[0].text }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C096FHNCPUM",
          "cachedResultName": "all-connors-personal-slack"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "id": "WTvc9wCjXLzxylDB",
          "name": "Slack account"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "305c329d-2e65-42e0-b165-e94001ae3b1b",
      "name": "为 CRM 格式化",
      "type": "n8n-nodes-base.code",
      "position": [
        1552,
        672
      ],
      "parameters": {
        "jsCode": "const lead = $json;\n\nreturn [{\n  json: {\n    email: lead.email,\n    firstname: lead.name ? lead.name.split(' ')[0] : null,\n    lastname: lead.name ? lead.name.split(' ').slice(1).join(' ') : null,\n    jobtitle: lead.title,\n    company: lead.companyName,\n    linkedin_url: lead.linkedinUrl,\n    lead_score: lead.leadScore,\n    lead_score_reasoning: lead.scoreReasoning,\n    routing_category: lead.routingCategory,\n    icp_company_size_match: lead.companySizeMatch,\n    icp_industry_match: lead.industryMatch,\n    icp_title_match: lead.titleMatch,\n    key_insights: lead.keyInsights ? lead.keyInsights.join(' | ') : null,\n    conversation_starters: lead.conversationStarters ? lead.conversationStarters.join(' | ') : null,\n    timing_opportunities: lead.timingOpportunities ? lead.timingOpportunities.join(' | ') : null,\n    outreach_recommendation: lead.outreachRecommendation,\n    red_flags: lead.redFlags ? lead.redFlags.join(' | ') : null,\n    individual_research_summary: lead.individualResearch,\n    company_research_summary: lead.companyResearch,\n    data_quality_score: lead.dataQualityScore,\n    enrichment_sources: lead.sourcesUsed ? lead.sourcesUsed.join(', ') : null,\n    last_enrichment_date: lead.processedAt,\n    lifecyclestage: lead.routingCategory === 'hot' ? 'salesqualifiedlead' : 'lead',\n    hs_lead_status: lead.routingCategory === 'hot' ? 'OPEN' : 'NEW'\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "aca601b2-b493-4682-919a-88e0bd4f404f",
      "name": "更新/插入到 HubSpot CRM",
      "type": "n8n-nodes-base.hubspot",
      "notes": "Enable after configuring HubSpot credentials",
      "position": [
        2048,
        672
      ],
      "parameters": {
        "email": "={{ $json.email }}",
        "options": {},
        "additionalFields": {
          "customPropertiesUi": {
            "customPropertiesValues": [
              {
                "value": "={{ $json.firstname }}",
                "property": "firstname"
              },
              {
                "value": "={{ $json.lastname }}",
                "property": "lastname"
              },
              {
                "value": "={{ $json.jobtitle }}",
                "property": "jobtitle"
              },
              {
                "value": "={{ $json.company }}",
                "property": "company"
              },
              {
                "value": "={{ $json.lead_score }}",
                "property": "lead_score"
              },
              {
                "value": "={{ $json.lifecyclestage }}",
                "property": "lifecyclestage"
              }
            ]
          }
        }
      },
      "typeVersion": 2
    },
    {
      "id": "c87419fe-28ab-45cf-89c3-b9f9d9de3efd",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        384,
        416
      ],
      "parameters": {
        "text": "=You are a B2B lead scoring AI with access to ICP rules stored in a Google Doc.\n\nCRITICAL FIRST STEP: Use the available Google Docs tool to fetch the ICP scoring rules document before analyzing the lead.\n\nLead Data:\n{{ JSON.stringify($json, null, 2) }}\n\nSCORING PROCESS:\n1. Fetch ICP rules from the doc\n2. Score each component (0-3 for company, 0-3 for title, 0-2 for signals, 0-2 for timing) based on the rules\n3. CRITICAL: Calculate leadScore by ADDING the four breakdown scores together\n   leadScore equals companyFit plus titleFit plus buyingSignals plus timing\n4. Determine routing category based on total score:\n   - 8-10 equals hot\n   - 5-7 equals warm  \n   - 0-4 equals cold\n\nSCORING RULES:\n- Company Fit (0-3): Compare company size, industry, and geography against ICP criteria in doc\n- Title Fit (0-3): Match persona title against ICP persona tiers in doc\n- Buying Signals (0-2): Count strong/medium signals from research data\n- Timing (0-2): Assess urgency based on recent changes and signals\n\nReturn ONLY valid JSON (no markdown, no code blocks) with these fields: email, name, title, companyName, companySize, industry, seniorityLevel, linkedinUrl, individualResearch, companyResearch, dataQualityScore, leadScore (sum of breakdown scores), scoreBreakdown object with companyFit/titleFit/buyingSignals/timing, icpMatch object with companySizeMatch/industryMatch/titleMatch booleans, keyInsights array, outreachRecommendation string, conversationStarters array, timingOpportunities array, redFlags array, nextAction string, confidenceLevel string, routingCategory string based on score thresholds above.",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "cbf742e7-a18e-47e8-85e2-6537abe0b4f9",
      "name": "Anthropic 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        384,
        608
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-20250514",
          "cachedResultName": "Claude 4 Sonnet"
        },
        "options": {}
      },
      "credentials": {
        "anthropicApi": {
          "id": "JEgF1ooDsuHYBKx5",
          "name": "Anthropic account"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "9c9f0f0f-b6a3-4f72-88e5-760ab64305d3",
      "name": "格式化热门线索 Slack",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        1552,
        144
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.5-flash",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=Create a concise Slack alert for a HOT LEAD that requires immediate sales attention.\n\nLead Data:\n{{ JSON.stringify($json, null, 2) }}\n\nUsing the data above, create a Slack message in mrkdwn format with this structure:\n\nHOT LEAD ALERT\n\n[name] | [title] at [companyName]\nScore: [leadScore]/10 | [confidenceLevel] confidence\n[email]\n\nKey Insights:\n- [First 3-4 items from keyInsights array as bullets]\n\nWhy This Matters:\n[Pull from timingOpportunities - 1-2 sentences on urgency]\n\nRecommended Approach:\n[outreachRecommendation - keep concise]\n\nConversation Starters:\n- [First 2 from conversationStarters array]\n\nNote: [First redFlag if exists]\n\nNext Action: [nextAction]\n\nKeep it under 300 words and extremely scannable. Use actual values from the JSON data."
            }
          ]
        }
      },
      "credentials": {
        "googlePalmApi": {
          "id": "d8ipU9ibs2OJxC51",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4de89a82-f720-4ee6-88f5-fa35006e4f29",
      "name": "格式化热门线索邮件",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        1552,
        320
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.5-flash",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=Create a personalized welcome email for a HOT LEAD.\n\nLead Data:\n{{ JSON.stringify($json, null, 2) }}\n\nRequirements:\n- Warm, professional tone\n- Reference 1-2 relevant insights naturally\n- Clear value proposition for their role/company\n- Soft CTA (calendar link or reply)\n- 100-150 words max\n- Feel human-written, not templated\n\nReturn JSON (include the email from the input) with fields: email (extract from input data), subject (engaging subject line), body (email body with paragraph tags, not HTML angle brackets)."
            }
          ]
        }
      },
      "credentials": {
        "googlePalmApi": {
          "id": "d8ipU9ibs2OJxC51",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e6092336-93a4-402e-b38e-2b6d2a8a5792",
      "name": "格式化温线索 Slack",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        1552,
        496
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.5-flash",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=Create a Slack digest entry for a WARM LEAD.\n\nLead Data:\n{{ JSON.stringify($json, null, 2) }}\n\nUsing the data above, create a message:\n\n[name] | [title] at [companyName]\nScore: [leadScore]/10\n\nQuick Context:\n- [2-3 items from keyInsights]\n\nNext Steps: [nextAction]\n\nKeep it under 150 words. Use actual values from the JSON."
            }
          ]
        }
      },
      "credentials": {
        "googlePalmApi": {
          "id": "d8ipU9ibs2OJxC51",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "fc94e4bf-f9ca-45f4-85e2-4d545a76b6ad",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -976,
        480
      ],
      "webhookId": "1d670952-c57f-4985-980a-b740fc9a5f6c",
      "parameters": {
        "path": "lead-intake",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2.1
    },
    {
      "id": "55e71e16-4550-47ac-b5fb-7c903903dfa8",
      "name": "LinkedIn 资料抓取器",
      "type": "@apify/n8n-nodes-apify.apify",
      "position": [
        -368,
        560
      ],
      "parameters": {
        "memory": {},
        "actorId": {
          "__rl": true,
          "mode": "url",
          "value": "https://console.apify.com/actors/LQQIXN9Othf8f7R5n/input"
        },
        "timeout": {},
        "operation": "Run actor",
        "customBody": "={ \"username\": \"{{ $json.data.profiles[0].url }}\" }",
        "actorSource": "store",
        "waitForFinish": 60,
        "authentication": "apifyOAuth2Api"
      },
      "credentials": {
        "apifyOAuth2Api": {
          "id": "k2EtiqJb7kjmtjRn",
          "name": "Apify account"
        }
      },
      "typeVersion": 1,
      "continueOnFail": true
    },
    {
      "id": "cca5c728-3ee5-4192-91e3-33ba69630dc9",
      "name": "ICP 和用例",
      "type": "n8n-nodes-base.googleDocsTool",
      "position": [
        528,
        608
      ],
      "parameters": {
        "operation": "get",
        "documentURL": "https://docs.google.com/document/d/YOUR_DOCUMENT_ID/edit"
      },
      "credentials": {
        "googleDocsOAuth2Api": {
          "id": "UxwVvTjaY2WY3bMb",
          "name": "Google Docs account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "6d3fcf37-6aa7-45c5-ae0f-49666579be13",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        -144
      ],
      "parameters": {
        "color": 4,
        "width": 704,
        "height": 528,
        "content": "## 使用 AI 丰富线索并评分"
      },
      "typeVersion": 1
    },
    {
      "id": "f951f6b2-cae8-4287-bccc-3bcb8090287e",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -656,
        256
      ],
      "parameters": {
        "width": 176,
        "height": 112,
        "content": "**需要设置:**"
      },
      "typeVersion": 1
    },
    {
      "id": "d3d0ab31-2b0c-40aa-8ecf-c1c3207482c8",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -432,
        704
      ],
      "parameters": {
        "content": "**可选:**"
      },
      "typeVersion": 1
    },
    {
      "id": "45baaf4f-6afa-4e21-b04e-b05d091f6e7d",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        768
      ],
      "parameters": {
        "width": 150,
        "height": 144,
        "content": "**需要设置:**"
      },
      "typeVersion": 1
    },
    {
      "id": "684eb148-af5f-404c-9307-d8bfe705afa6",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1856,
        656
      ],
      "parameters": {
        "width": 150,
        "height": 196,
        "content": "**可选:**"
      },
      "typeVersion": 1
    },
    {
      "id": "21a65fe2-b9ad-4b52-ac4d-590edabd0a3f",
      "name": "AI 推理",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        656,
        608
      ],
      "parameters": {},
      "typeVersion": 1.1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "0cc18b9c-0d69-4c44-b726-b00d21fb7afd",
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Validate & Parse Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Parse & Structure Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "PDL Enrich": {
      "main": [
        [
          {
            "node": "Merge All Sources",
            "type": "main",
            "index": 1
          },
          {
            "node": "Individual Research",
            "type": "main",
            "index": 0
          },
          {
            "node": "Company Research",
            "type": "main",
            "index": 0
          },
          {
            "node": "LinkedIn Profile Scraper",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Reasoning": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Format for CRM": {
      "main": [
        [
          {
            "node": "Upsert to HubSpot CRM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ICP & Use Case": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Route by Score": {
      "main": [
        [
          {
            "node": "Format for CRM",
            "type": "main",
            "index": 0
          },
          {
            "node": "Format Hot Lead Slack",
            "type": "main",
            "index": 0
          },
          {
            "node": "Format Hot Lead Email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Format for CRM",
            "type": "main",
            "index": 0
          },
          {
            "node": "Format Warm Lead Slack",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Format for CRM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Company Research": {
      "main": [
        [
          {
            "node": "Merge All Sources",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Parse Email JSON": {
      "main": [
        [
          {
            "node": "Send Hot Lead Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge All Sources": {
      "main": [
        [
          {
            "node": "Merge Enrichment Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Individual Research": {
      "main": [
        [
          {
            "node": "Merge All Sources",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Format Hot Lead Email": {
      "main": [
        [
          {
            "node": "Parse Email JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Hot Lead Slack": {
      "main": [
        [
          {
            "node": "Send Hot Lead Slack Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Enrichment Data": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Warm Lead Slack": {
      "main": [
        [
          {
            "node": "Send Warm Lead to Digest",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate & Parse Input": {
      "main": [
        [
          {
            "node": "PDL Enrich",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge All Sources",
            "type": "main",
            "index": 4
          }
        ]
      ]
    },
    "LinkedIn Profile Scraper": {
      "main": [
        [
          {
            "node": "Merge All Sources",
            "type": "main",
            "index": 3
          }
        ]
      ]
    },
    "Parse & Structure Output": {
      "main": [
        [
          {
            "node": "Route by Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量28
分类-
节点类型16
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

外部链接
在 n8n.io 查看

分享此工作流