8
n8n 中文网amn8n.com

12 - 智能潜在客户信息增强器

中级

这是一个AI Summarization, Multimodal AI领域的自动化工作流,包含 13 个节点。主要使用 If, Code, Merge, Hubspot, Agent 等节点。 基于AI的潜在客户信息增强:从Typeform和Calendly到HubSpot CRM

前置要求
  • HubSpot API Key
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "name": "12 - 智能潜在客户信息增强器",
  "tags": [],
  "nodes": [
    {
      "id": "4dcd168b-82b8-46d1-93b8-b8939e13af53",
      "name": "🧾 Typeform 触发器",
      "type": "n8n-nodes-base.typeformTrigger",
      "position": [
        -280,
        0
      ],
      "webhookId": "WEBHOOK_ID_PLACEHOLDER",
      "parameters": {
        "formId": "YOUR_TYPEFORM_ID"
      },
      "credentials": {
        "typeformApi": {
          "id": "CREDENTIAL_ID_PLACEHOLDER",
          "name": "Typeform account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e1d060c4-8025-4418-a560-63a79c0b2788",
      "name": "📅 Calendly 触发器",
      "type": "n8n-nodes-base.calendlyTrigger",
      "position": [
        -280,
        200
      ],
      "webhookId": "WEBHOOK_ID_PLACEHOLDER",
      "parameters": {
        "events": [
          "invitee.created"
        ]
      },
      "credentials": {
        "calendlyApi": {
          "id": "CREDENTIAL_ID_PLACEHOLDER",
          "name": "Calendly account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a063356b-8248-4d72-ac54-2069653a788c",
      "name": "🔀 合并潜在客户来源",
      "type": "n8n-nodes-base.merge",
      "position": [
        -60,
        100
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "00b454c8-a16c-4697-9567-3bbb5725188b",
      "name": "🛠️ 标准化潜在客户数据",
      "type": "n8n-nodes-base.code",
      "position": [
        160,
        100
      ],
      "parameters": {
        "jsCode": "let input = items[0].json;\nlet output = {};\n\n// Utility: Extract domain from email\nfunction extractDomain(email) {\n  return typeof email === 'string' && email.includes('@')\n    ? email.split('@')[1].toLowerCase()\n    : null;\n}\n\n// Case 1: Direct object (Typeform-style)\nif (input?.Name && input?.Email) {\n  output = {\n    name: input[\"Name\"] || null,\n    email: input[\"Email\"] || null,\n    phone: input[\"Phone Number\"] || null,\n    message: input[\"Message\"] || null,\n    domain: extractDomain(input[\"Email\"]),\n    source: \"Typeform\"\n  };\n}\n\n// Case 2: Array of one object (Typeform-style)\nelse if (Array.isArray(input) && input[0]?.Name && input[0]?.Email) {\n  const data = input[0];\n  output = {\n    name: data[\"Name\"] || null,\n    email: data[\"Email\"] || null,\n    phone: data[\"Phone Number\"] || null,\n    message: data[\"Message\"] || null,\n    domain: extractDomain(data[\"Email\"]),\n    source: \"Typeform\"\n  };\n}\n\n// Case 3: Calendly payload\nelse if (input?.event === \"invitee.created\" && input?.payload) {\n  const payload = input.payload;\n  const email = payload.email || null;\n  output = {\n    name: payload.name || `${payload.first_name || \"\"} ${payload.last_name || \"\"}`.trim(),\n    email: email,\n    phone: payload.text_reminder_number || null,\n    message: payload.questions_and_answers?.[0]?.answer || null,\n    domain: extractDomain(email),\n    source: \"Calendly\"\n  };\n}\n\n// Else: unsupported\nelse {\n  output = {\n    error: \"Unsupported input format\",\n    inputType: typeof input,\n    preview: JSON.stringify(input)\n  };\n}\n\nreturn [{ json: output }];"
      },
      "typeVersion": 2
    },
    {
      "id": "9720f9d6-047c-46bc-b703-9f47acddd5c2",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        -200
      ],
      "parameters": {
        "color": 6,
        "width": 700,
        "height": 700,
        "content": "## 潜在客户收集与标准化"
      },
      "typeVersion": 1
    },
    {
      "id": "31a89eaf-a2e2-49c4-b688-231e53d137d5",
      "name": "⚖️ 邮箱域名过滤器",
      "type": "n8n-nodes-base.if",
      "position": [
        380,
        100
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "412e4bc6-7d47-4786-bafc-85e68b898b22",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.domain }}",
              "rightValue": "gmail.com"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "cab2469b-cdb9-4d8d-8193-bfa8225b56a9",
      "name": "🤖 AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        600,
        100
      ],
      "parameters": {
        "text": "=You are a company research assistant. I will give you a domain name.\n\nHere's the domain: {{ $json.domain }}\n\nYour task is to return a JSON object with the following details about the company:\n\ncompany_name: Full name of the company\n\nindustry: The primary industry the company belongs to\n\nheadquarters: City and country of the company headquarters\n\nemployee_count: Approximate number of employees (numeric or range)\n\nwebsite: Official website URL\n\nlinkedin: LinkedIn profile link (if available)\n\ndescription: 1-2 sentence summary of the company and what it does\n\nOnly use verified, credible information. Respond only in JSON. ",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "12b43543-207a-46d0-93fd-400d8729b493",
      "name": "💬 LLM (OpenAI / Claude)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        688,
        320
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "CREDENTIAL_ID_PLACEHOLDER",
          "name": "OpenAI account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0202fe5f-f6d1-4a05-9c2e-f077aef85a29",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        340,
        -200
      ],
      "parameters": {
        "width": 540,
        "height": 700,
        "content": "## 域名检查与AI信息增强"
      },
      "typeVersion": 1
    },
    {
      "id": "4da58027-c7ca-4fe5-8236-210d66f206bb",
      "name": "🧬 合并潜在客户与AI输出",
      "type": "n8n-nodes-base.code",
      "position": [
        976,
        100
      ],
      "parameters": {
        "jsCode": "// Access data from previous nodes using correct n8n syntax\n// Replace \"If\" and \"AI Agent\" with your actual node names\n\n// Method 1: Try accessing by node name (replace with your actual node names)\nlet leadData = {};\nlet aiEnrichment = {};\n\ntry {\n  // Try to get data from IF node - replace \"If\" with your actual node name\n  const ifNodeData = $node[\"⚖️ Email Domain Filter\"].json;\n  if (Array.isArray(ifNodeData)) {\n    leadData = ifNodeData[0];\n  } else {\n    leadData = ifNodeData;\n  }\n  console.log('Lead data from If node:', leadData);\n} catch (error) {\n  console.log('Could not access If node:', error.message);\n}\n\ntry {\n  // Try to get data from AI Agent node - replace \"AI Agent\" with your actual node name  \n  const aiNodeData = $node[\"🤖 AI Agent\"].json;\n  let aiOutput = '';\n  \n  if (Array.isArray(aiNodeData)) {\n    aiOutput = aiNodeData[0].output || aiNodeData[0];\n  } else {\n    aiOutput = aiNodeData.output || aiNodeData;\n  }\n  \n  console.log('AI output:', aiOutput);\n  \n  // Parse AI output if it's in JSON format\n  if (typeof aiOutput === 'string') {\n    const jsonMatch = aiOutput.match(/```json\\n([\\s\\S]*?)\\n```/);\n    if (jsonMatch && jsonMatch[1]) {\n      aiEnrichment = JSON.parse(jsonMatch[1]);\n    } else {\n      try {\n        aiEnrichment = JSON.parse(aiOutput);\n      } catch (parseError) {\n        aiEnrichment = { raw_output: aiOutput };\n      }\n    }\n  } else {\n    aiEnrichment = aiOutput;\n  }\n  \n  console.log('Parsed AI enrichment:', aiEnrichment);\n} catch (error) {\n  console.log('Could not access AI Agent node:', error.message);\n  aiEnrichment = { error: 'Could not access AI data' };\n}\n\n// Combine the data (no duplication)\nconst enrichedLead = {\n  // Original lead data\n  name: leadData.name || '',\n  email: leadData.email || '',\n  phone: leadData.phone || '',\n  message: leadData.message || '',\n  domain: leadData.domain || '',\n  source: leadData.source || '',\n  \n  // AI enrichment data\n  company_name: aiEnrichment.company_name || 'Unknown',\n  industry: aiEnrichment.industry || 'Unknown',\n  headquarters: aiEnrichment.headquarters || '',\n  employee_count: aiEnrichment.employee_count || '',\n  website: aiEnrichment.website || '',\n  linkedin: aiEnrichment.linkedin || '',\n  company_description: aiEnrichment.description || '',\n  \n  // Metadata\n  enriched_at: new Date().toISOString(),\n  workflow_id: $workflow.id\n};\n\nconsole.log('Final enriched lead:', enrichedLead);\n\nreturn { json: enrichedLead };"
      },
      "typeVersion": 2
    },
    {
      "id": "b766d9b2-450a-465d-a047-2d0fa5bc18ce",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        900,
        -200
      ],
      "parameters": {
        "color": 4,
        "height": 700,
        "content": "## 合并潜在客户与增强数据"
      },
      "typeVersion": 1
    },
    {
      "id": "bfb6c543-5b49-4a58-b51b-12afd6a10a1d",
      "name": "💼 CRM集成",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        1196,
        100
      ],
      "parameters": {
        "email": "={{ $json.email }}",
        "options": {},
        "authentication": "appToken",
        "additionalFields": {
          "country": "={{ $json.headquarters }}",
          "message": "={{ $json.message }}",
          "industry": "={{ $json.industry }}",
          "firstName": "={{ $json.name }}",
          "websiteUrl": "={{ $json.website }}",
          "companyName": "={{ $json.company_name }}",
          "phoneNumber": "={{ $json.phone }}",
          "customPropertiesUi": {
            "customPropertiesValues": [
              {
                "value": "={{ $json.linkedin }}",
                "property": "company_s_linkedin"
              },
              {
                "value": "={{ $json.company_description }}",
                "property": "company_descreption"
              }
            ]
          }
        }
      },
      "credentials": {
        "hubspotAppToken": {
          "id": "CREDENTIAL_ID_PLACEHOLDER",
          "name": "HubSpot account"
        }
      },
      "typeVersion": 2.1,
      "alwaysOutputData": false
    },
    {
      "id": "b055d32e-692a-49b1-9a8b-31ff95d9cc66",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1160,
        -200
      ],
      "parameters": {
        "color": 3,
        "width": 220,
        "height": 700,
        "content": "## CRM同步(如HubSpot)"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "TEMPLATE_VERSION_ID",
  "connections": {
    "🤖 AI Agent": {
      "main": [
        [
          {
            "node": "🧬 Combine Lead + AI Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "💼 CRM Integration": {
      "main": [
        []
      ]
    },
    "📅 Calendly Trigger": {
      "main": [
        [
          {
            "node": "🔀 Merge Lead Sources",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "🧾 Typeform Trigger": {
      "main": [
        [
          {
            "node": "🔀 Merge Lead Sources",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🔀 Merge Lead Sources": {
      "main": [
        [
          {
            "node": "🛠️ Standardize Lead Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "⚖️ Email Domain Filter": {
      "main": [
        [
          {
            "node": "🤖 AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "💬 LLM (OpenAI / Claude)": {
      "ai_languageModel": [
        [
          {
            "node": "🤖 AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "🛠️ Standardize Lead Data": {
      "main": [
        [
          {
            "node": "⚖️ Email Domain Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🧬 Combine Lead + AI Output": {
      "main": [
        [
          {
            "node": "💼 CRM Integration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - AI 摘要总结, 多模态 AI

需要付费吗?

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

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

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

作者
Avkash Kakdiya

Avkash Kakdiya

@itechnotion

🚀 Founder of iTechNotion — we build custom AI-powered automation workflows for startups, agencies, and founders. 💡 Specializing in agentic AI systems, content automation, sales funnels, and digital workers. 🔧 14+ years in tech | Building scalable no-code/low-code solutions using n8n, OpenAI, and other API-first tools. 📬 Let’s automate what slows you down.

外部链接
在 n8n.io 查看

分享此工作流