8
n8n 中文网amn8n.com

我的工作流程 2

中级

这是一个Lead Generation, AI Summarization领域的自动化工作流,包含 12 个节点。主要使用 Code, Slack, Hubspot, Webhook, ScrapegraphAi 等节点。 网站智能分析与线索评分(ScrapeGraphAI、HubSpot和Slack)

前置要求
  • Slack Bot Token 或 Webhook URL
  • HubSpot API Key
  • HTTP Webhook 端点(n8n 会自动生成)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "VhEwspDqzu7ssFVE",
  "meta": {
    "instanceId": "f4b0efaa33080e7774e0d9285c40c7abcd2c6f7cf1a8b901fa7106170dd4cda3",
    "templateCredsSetupCompleted": true
  },
  "name": "我的工作流程 2",
  "tags": [
    {
      "id": "DxXGubfBzRKh6L8T",
      "name": "Revenue Optimization",
      "createdAt": "2025-07-25T16:24:30.370Z",
      "updatedAt": "2025-07-25T16:24:30.370Z"
    },
    {
      "id": "IxkcJ2IpYIxivoHV",
      "name": "Content Strategy",
      "createdAt": "2025-07-25T12:57:37.677Z",
      "updatedAt": "2025-07-25T12:57:37.677Z"
    },
    {
      "id": "PAKIJ2Mm9EvRcR3u",
      "name": "Trend Monitoring",
      "createdAt": "2025-07-25T12:57:37.670Z",
      "updatedAt": "2025-07-25T12:57:37.670Z"
    },
    {
      "id": "YtfXmaZk44MYedPO",
      "name": "Dynamic Pricing",
      "createdAt": "2025-07-25T16:24:30.369Z",
      "updatedAt": "2025-07-25T16:24:30.369Z"
    }
  ],
  "nodes": [
    {
      "id": "2edae932-a3e1-42b6-b898-24adff666dd8",
      "name": "Webhook触发器",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1600,
        672
      ],
      "webhookId": "fc8ca16a-2ac9-4099-a19b-96057eb1a554",
      "parameters": {
        "path": "visitor-tracking",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 1.1
    },
    {
      "id": "f8ff3605-a05d-49a8-b739-9b07ca1497a6",
      "name": "ScrapeGraphAI - 公司情报",
      "type": "n8n-nodes-scrapegraphai.scrapegraphAi",
      "position": [
        -1088,
        640
      ],
      "parameters": {
        "userPrompt": "Extract comprehensive company information from this website. Use the following schema for response: { \"company_name\": \"Company Name\", \"industry\": \"Technology/Healthcare/etc\", \"company_size\": \"1-50/51-200/201-1000/1000+\", \"description\": \"Brief company description\", \"services\": [\"Service 1\", \"Service 2\"], \"contact_info\": { \"email\": \"contact@company.com\", \"phone\": \"+1-555-0123\", \"address\": \"123 Business St, City, State\" }, \"social_media\": { \"linkedin\": \"linkedin.com/company/name\", \"twitter\": \"@company\" }, \"key_personnel\": [{ \"name\": \"John Doe\", \"title\": \"CEO\" }], \"technologies\": [\"React\", \"AWS\", \"etc\"], \"recent_news\": [\"Recent announcement or news\"], \"funding_info\": \"Series A, $5M raised\", \"competitors\": [\"Competitor 1\", \"Competitor 2\"] }",
        "websiteUrl": "={{ $json.company_domain ? 'https://' + $json.company_domain : 'https://' + $json.visitor_ip_domain }}"
      },
      "typeVersion": 1
    },
    {
      "id": "50729cf8-6781-4f80-9b4f-acb57f4a1d4c",
      "name": "访客信息增强",
      "type": "n8n-nodes-base.code",
      "position": [
        -480,
        656
      ],
      "parameters": {
        "jsCode": "// Get input data from webhook and scraped company data\nconst visitorData = $input.first().json;\nconst companyData = $input.last().json.result || {};\n\n// Enrich visitor data with company intelligence\nfunction enrichVisitorData(visitor, company) {\n  const enrichedData = {\n    // Original visitor data\n    visitor_id: visitor.visitor_id || generateVisitorId(),\n    timestamp: visitor.timestamp || new Date().toISOString(),\n    ip_address: visitor.ip_address,\n    user_agent: visitor.user_agent,\n    page_visited: visitor.page_visited,\n    referrer: visitor.referrer,\n    session_duration: visitor.session_duration || 0,\n    pages_viewed: visitor.pages_viewed || 1,\n    \n    // Enriched company data\n    company: {\n      name: company.company_name || 'Unknown Company',\n      domain: visitor.company_domain || visitor.visitor_ip_domain,\n      industry: company.industry || 'Unknown',\n      size: company.company_size || 'Unknown',\n      description: company.description || '',\n      services: company.services || [],\n      technologies: company.technologies || [],\n      funding_info: company.funding_info || '',\n      competitors: company.competitors || []\n    },\n    \n    // Contact information\n    contact_info: company.contact_info || {},\n    social_media: company.social_media || {},\n    key_personnel: company.key_personnel || [],\n    \n    // Behavioral data\n    behavior: {\n      visit_type: determineVisitType(visitor),\n      engagement_level: calculateEngagement(visitor),\n      intent_signals: identifyIntentSignals(visitor),\n      device_type: getDeviceType(visitor.user_agent),\n      location: visitor.location || 'Unknown'\n    },\n    \n    // Recent company activity\n    recent_activity: {\n      news: company.recent_news || [],\n      last_updated: new Date().toISOString()\n    }\n  };\n  \n  return enrichedData;\n}\n\nfunction generateVisitorId() {\n  return 'visitor_' + Date.now() + '_' + Math.random().toString(36).substr(2, 9);\n}\n\nfunction determineVisitType(visitor) {\n  if (visitor.referrer && visitor.referrer.includes('google.com')) {\n    return 'organic_search';\n  } else if (visitor.referrer && visitor.referrer.includes('linkedin.com')) {\n    return 'social_media';\n  } else if (!visitor.referrer) {\n    return 'direct';\n  } else {\n    return 'referral';\n  }\n}\n\nfunction calculateEngagement(visitor) {\n  const duration = visitor.session_duration || 0;\n  const pages = visitor.pages_viewed || 1;\n  \n  if (duration > 300 && pages > 3) return 'high';\n  if (duration > 120 && pages > 1) return 'medium';\n  return 'low';\n}\n\nfunction identifyIntentSignals(visitor) {\n  const signals = [];\n  const page = visitor.page_visited || '';\n  \n  if (page.includes('/pricing')) signals.push('pricing_interest');\n  if (page.includes('/demo')) signals.push('demo_request');\n  if (page.includes('/contact')) signals.push('contact_intent');\n  if (page.includes('/case-study')) signals.push('research_mode');\n  if (page.includes('/careers')) signals.push('hiring_interest');\n  \n  return signals;\n}\n\nfunction getDeviceType(userAgent) {\n  if (!userAgent) return 'unknown';\n  if (/Mobile|Android|iPhone/i.test(userAgent)) return 'mobile';\n  if (/Tablet|iPad/i.test(userAgent)) return 'tablet';\n  return 'desktop';\n}\n\n// Process the enrichment\nconst enrichedVisitor = enrichVisitorData(visitorData, companyData);\n\nconsole.log('Visitor enriched with company intelligence:', enrichedVisitor.company.name);\n\nreturn {\n  json: enrichedVisitor\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "e79a7dce-bbad-49ae-9f59-cc41593b503f",
      "name": "线索评分",
      "type": "n8n-nodes-base.code",
      "position": [
        48,
        656
      ],
      "parameters": {
        "jsCode": "// Get enriched visitor data\nconst enrichedData = $input.first().json;\n\n// Lead scoring algorithm\nfunction calculateLeadScore(data) {\n  let score = 0;\n  const factors = {};\n  \n  // Company size scoring (0-25 points)\n  const companySize = data.company.size;\n  if (companySize === '1000+') {\n    score += 25;\n    factors.company_size = 25;\n  } else if (companySize === '201-1000') {\n    score += 20;\n    factors.company_size = 20;\n  } else if (companySize === '51-200') {\n    score += 15;\n    factors.company_size = 15;\n  } else if (companySize === '1-50') {\n    score += 10;\n    factors.company_size = 10;\n  } else {\n    factors.company_size = 0;\n  }\n  \n  // Industry relevance (0-20 points)\n  const targetIndustries = ['Technology', 'SaaS', 'Software', 'Finance', 'Healthcare'];\n  if (targetIndustries.includes(data.company.industry)) {\n    score += 20;\n    factors.industry_fit = 20;\n  } else {\n    factors.industry_fit = 0;\n  }\n  \n  // Engagement level (0-20 points)\n  if (data.behavior.engagement_level === 'high') {\n    score += 20;\n    factors.engagement = 20;\n  } else if (data.behavior.engagement_level === 'medium') {\n    score += 12;\n    factors.engagement = 12;\n  } else {\n    score += 5;\n    factors.engagement = 5;\n  }\n  \n  // Intent signals (0-25 points)\n  const intentPoints = data.behavior.intent_signals.length * 5;\n  score += Math.min(intentPoints, 25);\n  factors.intent_signals = Math.min(intentPoints, 25);\n  \n  // Technology stack alignment (0-10 points)\n  const ourTechnologies = ['React', 'AWS', 'Python', 'Node.js', 'Docker'];\n  const commonTech = data.company.technologies.filter(tech => \n    ourTechnologies.includes(tech)\n  ).length;\n  const techScore = Math.min(commonTech * 2, 10);\n  score += techScore;\n  factors.tech_alignment = techScore;\n  \n  return { score, factors };\n}\n\n// Calculate lead qualification\nfunction qualifyLead(score) {\n  if (score >= 80) return 'hot';\n  if (score >= 60) return 'warm';\n  if (score >= 40) return 'qualified';\n  if (score >= 20) return 'cold';\n  return 'unqualified';\n}\n\n// Determine priority level\nfunction getPriority(qualification, intentSignals) {\n  if (qualification === 'hot' || intentSignals.includes('demo_request')) {\n    return 'immediate';\n  }\n  if (qualification === 'warm' || intentSignals.includes('pricing_interest')) {\n    return 'high';\n  }\n  if (qualification === 'qualified') {\n    return 'medium';\n  }\n  return 'low';\n}\n\n// Generate recommended actions\nfunction getRecommendedActions(data, qualification, priority) {\n  const actions = [];\n  \n  if (priority === 'immediate') {\n    actions.push('Schedule immediate sales call');\n    actions.push('Send personalized demo invitation');\n  }\n  \n  if (data.behavior.intent_signals.includes('pricing_interest')) {\n    actions.push('Share pricing information');\n    actions.push('Offer custom quote');\n  }\n  \n  if (data.behavior.intent_signals.includes('contact_intent')) {\n    actions.push('Initiate contact within 24 hours');\n  }\n  \n  if (qualification === 'warm' || qualification === 'hot') {\n    actions.push('Add to priority nurture campaign');\n    actions.push('Research key contacts at company');\n  }\n  \n  if (data.company.funding_info) {\n    actions.push('Review recent funding for expansion opportunities');\n  }\n  \n  return actions;\n}\n\n// Process scoring\nconst scoringResult = calculateLeadScore(enrichedData);\nconst qualification = qualifyLead(scoringResult.score);\nconst priority = getPriority(qualification, enrichedData.behavior.intent_signals);\nconst recommendedActions = getRecommendedActions(enrichedData, qualification, priority);\n\n// Create final scored lead data\nconst scoredLead = {\n  ...enrichedData,\n  lead_score: {\n    total_score: scoringResult.score,\n    max_score: 100,\n    scoring_factors: scoringResult.factors,\n    qualification: qualification,\n    priority: priority,\n    scored_at: new Date().toISOString()\n  },\n  recommendations: {\n    actions: recommendedActions,\n    next_steps: getNextSteps(qualification, priority),\n    estimated_deal_size: estimateDealSize(enrichedData.company.size, enrichedData.company.industry)\n  }\n};\n\nfunction getNextSteps(qualification, priority) {\n  if (priority === 'immediate') {\n    return 'Contact within 1 hour';\n  } else if (priority === 'high') {\n    return 'Contact within 4 hours';\n  } else if (priority === 'medium') {\n    return 'Contact within 24 hours';\n  }\n  return 'Add to nurture sequence';\n}\n\nfunction estimateDealSize(companySize, industry) {\n  let baseSize = 5000; // Base deal size\n  \n  // Adjust by company size\n  if (companySize === '1000+') baseSize *= 10;\n  else if (companySize === '201-1000') baseSize *= 5;\n  else if (companySize === '51-200') baseSize *= 2;\n  \n  // Adjust by industry\n  if (['Finance', 'Healthcare'].includes(industry)) baseSize *= 1.5;\n  if (industry === 'Technology') baseSize *= 1.3;\n  \n  return `$${baseSize.toLocaleString()} - $${(baseSize * 3).toLocaleString()}`;\n}\n\nconsole.log(`Lead scored: ${scoringResult.score}/100 - ${qualification} (${priority} priority)`);\n\nreturn {\n  json: scoredLead\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "2b7a58ba-2086-479d-b90b-99487760145a",
      "name": "CRM更新",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        576,
        672
      ],
      "parameters": {
        "email": "={{ $json.contact_info.email || $json.visitor_id + '@' + $json.company.domain }}",
        "options": {},
        "additionalFields": {
          "industry": "={{ $json.company.industry }}"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "f8703761-8c95-41e1-a1a7-6a1f937021ce",
      "name": "销售提醒",
      "type": "n8n-nodes-base.slack",
      "position": [
        1056,
        800
      ],
      "webhookId": "c558d86d-104d-4ca0-aa1d-c4cef09f35da",
      "parameters": {
        "text": "🚨 **HIGH PRIORITY LEAD ALERT** 🚨\n\n👤 **Visitor Details:**\n• Company: {{ $json.company.name }}\n• Industry: {{ $json.company.industry }}\n• Size: {{ $json.company.size }}\n• Website: {{ $json.company.domain }}\n\n📊 **Lead Score: {{ $json.lead_score.total_score }}/100**\n🎯 **Qualification: {{ $json.lead_score.qualification.toUpperCase() }}**\n⚡ **Priority: {{ $json.lead_score.priority.toUpperCase() }}**\n\n🔍 **Intent Signals:**\n{{ $json.behavior.intent_signals.length > 0 ? $json.behavior.intent_signals.map(signal => '• ' + signal.replace('_', ' ')).join('\\n') : '• No specific signals detected' }}\n\n🎯 **Recommended Actions:**\n{{ $json.recommendations.actions.map(action => '• ' + action).join('\\n') }}\n\n💰 **Estimated Deal Size:** {{ $json.recommendations.estimated_deal_size }}\n⏰ **Next Steps:** {{ $json.recommendations.next_steps }}\n\n📱 **Visit Details:**\n• Page: {{ $json.page_visited }}\n• Source: {{ $json.behavior.visit_type }}\n• Engagement: {{ $json.behavior.engagement_level }}\n• Device: {{ $json.behavior.device_type }}\n\n🕐 **Detected:** {{ new Date($json.timestamp).toLocaleString() }}\n\n---\n*Visitor ID: {{ $json.visitor_id }}*",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C1234567890"
        },
        "otherOptions": {
          "mrkdwn": true
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "5225845d-d700-4fec-95bd-8c4fc4d9a309",
      "name": "JSON 主体示例:",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1808,
        32
      ],
      "parameters": {
        "color": 4,
        "width": 550,
        "height": 962,
        "content": "# 步骤1:Webhook触发器 🎣"
      },
      "typeVersion": 1
    },
    {
      "id": "ffe05945-e48b-418e-90f1-9a60b089a33a",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1264,
        32
      ],
      "parameters": {
        "color": 5,
        "width": 550,
        "height": 962,
        "content": "# 步骤2:ScrapeGraphAI - 公司情报 🕵️"
      },
      "typeVersion": 1
    },
    {
      "id": "2f417273-502f-4063-b645-ea0768282376",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        32
      ],
      "parameters": {
        "color": 6,
        "width": 550,
        "height": 962,
        "content": "# 步骤3:访客信息增强 🔍"
      },
      "typeVersion": 1
    },
    {
      "id": "16cdaabe-0e33-46d0-ac39-cdac97f5469b",
      "name": "### DeepSeek Reasoner R1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        32
      ],
      "parameters": {
        "color": 7,
        "width": 550,
        "height": 962,
        "content": "# 步骤4:线索评分 📊"
      },
      "typeVersion": 1
    },
    {
      "id": "62de77ee-8872-4dd9-8697-630d7cb38740",
      "name": "## 带记忆功能的 DeepSeek 对话代理",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        352,
        32
      ],
      "parameters": {
        "color": 3,
        "width": 550,
        "height": 962,
        "content": "# 步骤5:CRM更新 💾"
      },
      "typeVersion": 1
    },
    {
      "id": "13f3e379-bc37-4fd8-98c0-6506801d7016",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        32
      ],
      "parameters": {
        "color": 2,
        "width": 550,
        "height": 978,
        "content": "# 步骤6:销售提醒 🚨"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "8d04ee78-cffe-4783-9d8a-f0aae110ca60",
  "connections": {
    "CRM Update": {
      "main": [
        [
          {
            "node": "Sales Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Lead Scorer": {
      "main": [
        [
          {
            "node": "CRM Update",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "ScrapeGraphAI - Company Intel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Visitor Enricher": {
      "main": [
        [
          {
            "node": "Lead Scorer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ScrapeGraphAI - Company Intel": {
      "main": [
        [
          {
            "node": "Visitor Enricher",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 潜在客户开发, AI 摘要总结

需要付费吗?

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

工作流信息
难度等级
中级
节点数量12
分类2
节点类型6
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

外部链接
在 n8n.io 查看

分享此工作流