8
n8n 中文网amn8n.com

基于RapidAPI、Hunter.io、GPT和Gmail的自动化B2B潜在客户挖掘

高级

这是一个Lead Generation, Multimodal AI领域的自动化工作流,包含 21 个节点。主要使用 If, Set, Code, Html, Gmail 等节点。 基于RapidAPI、Hunter.io、GPT和Gmail的自动化B2B潜在客户挖掘

前置要求
  • Google 账号和 Gmail API 凭证
  • 可能需要目标 API 的认证凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "8599d7845a778242eb2b590f9276e0b22e25a242e7728a8fa6887cb7c35c668a"
  },
  "nodes": [
    {
      "id": "5aeaafb8-ecf0-482f-aff8-07cac51b5fef",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1160,
        160
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5-nano-2025-08-07",
          "cachedResultName": "gpt-5-nano-2025-08-07"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "QrtszTAQelTLppHh",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c6c57e72-d4d3-4421-b915-20369d4be3c5",
      "name": "公司搜索",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -380,
        20
      ],
      "webhookId": "64da8fef-966f-43e5-8ba2-f64b1a8f879a",
      "parameters": {
        "options": {},
        "formTitle": "compagny_search",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Business Sector",
              "placeholder": "[ engineering ]",
              "requiredField": true
            },
            {
              "fieldLabel": "city",
              "placeholder": "[ London ]"
            },
            {
              "fieldLabel": "Number of Leads",
              "placeholder": "[ 20 ]"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "b13ac03b-4bb5-4264-91b3-e0c03765bc94",
      "name": "搜索本地企业",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        60,
        20
      ],
      "parameters": {
        "url": "https://local-business-data.p.rapidapi.com/search",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "query",
              "value": "={{ $json[\"Business Sector\"] }} {{ $json.city }}"
            },
            {
              "name": "limit",
              "value": "={{ $json[\"Number of Leads\"] }}"
            },
            {
              "name": "zoom",
              "value": "13"
            },
            {
              "name": "language",
              "value": "fr"
            },
            {
              "name": "region",
              "value": "fr"
            },
            {
              "name": "extract_emails_and_contacts",
              "value": "false"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "local-business-data.p.rapidapi.com"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "gXkUK6CJRdlslxOy",
          "name": "local_business_data"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "66a87c7e-b194-4358-8b54-2ed949bd87bd",
      "name": "拆分企业",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -140,
        260
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "data"
      },
      "typeVersion": 1
    },
    {
      "id": "d5228b9a-a0ac-4366-83d2-6143f5fcd7dc",
      "name": "如果网站存在",
      "type": "n8n-nodes-base.if",
      "position": [
        80,
        260
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "b86f0175-b755-49c1-becc-e3e6ca4747b4",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.website }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e2298683-1c78-461d-a6f3-a51ad5760ff9",
      "name": "抓取网站",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        380,
        -180
      ],
      "parameters": {
        "url": "={{ $json.website }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {}
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d8319ac4-a8bc-4659-93c3-d762b2e60c1e",
      "name": "如果抓取成功",
      "type": "n8n-nodes-base.if",
      "position": [
        420,
        40
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "324f2d98-a187-43bd-be7b-2ce74333d1a9",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ !$json.hasOwnProperty('error') }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "ef9347c3-543d-4c80-aa27-ab01989197b1",
      "name": "提取标题和描述",
      "type": "n8n-nodes-base.html",
      "position": [
        620,
        -200
      ],
      "parameters": {
        "options": {},
        "operation": "extractHtmlContent",
        "extractionValues": {
          "values": [
            {
              "key": "scraped_title",
              "cssSelector": "title"
            },
            {
              "key": "scraped_description",
              "attribute": "content",
              "cssSelector": "meta[name=\"description\"]",
              "returnValue": "attribute"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "485ba79a-899f-45d5-a701-51a1ab8c678a",
      "name": "查找联系人 (Hunter)",
      "type": "n8n-nodes-base.hunter",
      "position": [
        620,
        40
      ],
      "parameters": {
        "limit": 10,
        "domain": "={{ $('Split Out Businesses').item.json.tld }}",
        "filters": {}
      },
      "credentials": {
        "hunterApi": {
          "id": "bX3XAndw3GntxnxS",
          "name": "Hunter account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "45d46c83-22a5-45ab-9151-ea5eb48a136e",
      "name": "拆分联系人",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        840,
        -200
      ],
      "parameters": {
        "include": "allOtherFields",
        "options": {},
        "fieldToSplitOut": "value"
      },
      "typeVersion": 1
    },
    {
      "id": "82e9a446-fdf9-44b8-832d-ed0cf4329dbe",
      "name": "如果联系人有效",
      "type": "n8n-nodes-base.if",
      "position": [
        840,
        60
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "7e49f6e9-2024-4bb7-9010-76c14446f6fd",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.first_name }}",
              "rightValue": ""
            },
            {
              "id": "1405a866-f79f-4293-88f1-cde8fa48e0ea",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $('Find Contacts (Hunter)').item.json.verification.status }}",
              "rightValue": "valid"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "64081640-91a1-4110-a0b7-688f8ed458e4",
      "name": "生成邮件正文 (AI)",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1160,
        -40
      ],
      "parameters": {
        "text": "=Here is the information about your target :\n\n- Contact firstname : {{ $json.first_name }}\n- Jobtittle : {{ $json.position }}\n- Compagny name: {{ $('If Website Exists').item.json.name }}\n- Website Tittle : \"{{ $('Extract Title & Description').item.json.scraped_title }}\"\n- Website Description : \"{{ $('Extract Title & Description').item.json.scraped_description }}\"\n\n\n",
        "options": {
          "systemMessage": "=You are an expert in B2B sales prospecting, writing impactful outreach emails for the company [ Your_Compagny ] ([YOUR_COMPAGNY_WEBSITE]). \n\nYour mission: Write a short (about 100 words), friendly, and professional email. The goal is to generate interest for a potential project in automation, technical SEO, and customer acquisition campaigns. \nStart with a personalized hook based on their website's title or description. Show you've done your research. \nAddress the person according to their job title. \n\nEnd with a simple, open-ended question to encourage a reply. The output must ONLY be the email body in plain text. Do NOT start with 'Hello [First Name],' and do NOT sign off at the end."
        },
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "c21fff57-d1c0-444a-96b8-42e9d9efcb43",
      "name": "格式化 AI 输出",
      "type": "n8n-nodes-base.code",
      "position": [
        1560,
        -40
      ],
      "parameters": {
        "jsCode": "// On récupère tous les items en entrée sous forme de tableau.\n// Dans votre cas, ce sera un tableau avec un seul item.\nconst items = $items();\n\n// On utilise .map() pour créer un nouveau tableau avec les items modifiés.\n// C'est la méthode la plus propre et la plus sûre.\nconst newItems = items.map(item => {\n  // On récupère les données JSON de l'item en cours\n  const json = item.json;\n  \n  // On récupère le texte brut généré par l'IA, qui est dans le champ 'output'\n  const rawText = json.output;\n\n  // On initialise une variable pour le texte formaté\n  let formattedText = \"\";\n\n  // On vérifie que le texte existe bien avant de le traiter\n  if (rawText && typeof rawText === 'string') {\n    const sentences = rawText.match(/[^.!?]+[.!?]*/g) || [];\n    formattedText = sentences\n      .map(s => s.trim())\n      .filter(s => s.length > 0)\n      .join('\\n\\n');\n  }\n\n  // On retourne un NOUVEL objet item, formaté comme n8n l'attend.\n  // On copie toutes les anciennes données (...json) et on ajoute notre nouveau champ.\n  return {\n    json: {\n      ...json,\n      formatted_text: formattedText\n    }\n  };\n});\n\n// On retourne le nouveau tableau d'items. C'est la sortie attendue par n8n.\nreturn newItems;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "f2541c58-120a-48a1-a8ff-4e2429b0f377",
      "name": "组装最终邮件",
      "type": "n8n-nodes-base.set",
      "position": [
        1340,
        220
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0d2f01ce-0d10-41c0-99ff-2ac2ba70abef",
              "name": "email_subject",
              "type": "string",
              "value": "=Developing the business of {{ $('If Website Exists').item.json.name }}"
            },
            {
              "id": "fbcfb7dc-53f4-4653-8464-dc26fd190c0f",
              "name": "email_body",
              "type": "string",
              "value": "=Hi {{ $('Split Out Contacts').item.json.first_name }},  \n\n{{ $json.formatted_text }}\n\nDear,\n"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "6d25c563-2351-4f78-96ac-00e750197ffc",
      "name": "发送邮件 (Gmail)",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1580,
        220
      ],
      "webhookId": "878900b6-d826-43bd-ac24-568d70097eab",
      "parameters": {
        "sendTo": "={{ $('Find Contacts (Hunter)').item.json.value }}",
        "message": "={{ $json.email_body }}",
        "options": {},
        "subject": "={{ $json.email_subject }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "d1E1TwOxZdNe1Ttn",
          "name": "Jimmy"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "074804f9-e975-4a2a-90b9-de682d0e68cd",
      "name": "设置任务数据",
      "type": "n8n-nodes-base.set",
      "position": [
        440,
        660
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "15424ccb-ff6d-4aa4-83d6-247a55023ffe",
              "name": "phone_number",
              "type": "string",
              "value": "={{ $json.phone_number }}"
            },
            {
              "id": "7f78f42f-414a-4e2e-b493-3c35ad9586bd",
              "name": "compagny_name",
              "type": "string",
              "value": "={{ $json.name }}"
            },
            {
              "id": "6a561bd7-42c2-4078-99d7-706f41f41636",
              "name": "adress",
              "type": "string",
              "value": "={{ $json.full_address }}"
            },
            {
              "id": "6682a516-030d-40b4-b14a-fd54fa3222a0",
              "name": "type",
              "type": "string",
              "value": "={{ $json.type }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "df43e879-9b1c-4eb1-8ee4-c2e21a6db8a4",
      "name": "创建 Google 任务用于跟进",
      "type": "n8n-nodes-base.googleTasks",
      "position": [
        1060,
        660
      ],
      "parameters": {
        "task": "MTI3OTk4MTA0ODg4NDY1ODkwMTc6MDow",
        "title": "=Appeler {{ $json.compagny_name }} au {{ $json.phone_number }} Pour création de site web ! ",
        "additionalFields": {}
      },
      "credentials": {
        "googleTasksOAuth2Api": {
          "id": "TmbvD4TKaMPnNqMQ",
          "name": "Google Tasks account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ef60a1bc-b42f-4e9a-a151-dc61b0b91616",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        -420
      ],
      "parameters": {
        "width": 1560,
        "height": 620,
        "content": "## 快速开始和必要设置"
      },
      "typeVersion": 1
    },
    {
      "id": "e9eabba1-a027-49c4-8b55-554325be9bea",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1020,
        -420
      ],
      "parameters": {
        "color": 4,
        "width": 980,
        "height": 960,
        "content": "## 自定义您的推广"
      },
      "typeVersion": 1
    },
    {
      "id": "3b6ca027-27ce-4843-9258-d3bd1872b7df",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        220
      ],
      "parameters": {
        "color": 5,
        "width": 1560,
        "height": 320,
        "content": "## 工作流逻辑概述"
      },
      "typeVersion": 1
    },
    {
      "id": "355635c9-3ed0-49a8-aec4-731111c3dae5",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        560
      ],
      "parameters": {
        "width": 2560,
        "height": 320,
        "content": "## 配置手动跟进"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Set Task Data": {
      "main": [
        [
          {
            "node": "Create Google Task for Follow-up",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Website": {
      "main": [
        [
          {
            "node": "If Scraping Succeeded",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "compagny_search": {
      "main": [
        [
          {
            "node": "Search Local Businesses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format AI Output": {
      "main": [
        [
          {
            "node": "Assemble Final Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Website Exists": {
      "main": [
        [
          {
            "node": "Scrape Website",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set Task Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Email Body (AI)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Contacts": {
      "main": [
        [
          {
            "node": "If Contact Is Valid",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Contact Is Valid": {
      "main": [
        [
          {
            "node": "Generate Email Body (AI)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Assemble Final Email": {
      "main": [
        [
          {
            "node": "Send Email (Gmail)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Businesses": {
      "main": [
        [
          {
            "node": "If Website Exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Scraping Succeeded": {
      "main": [
        [
          {
            "node": "Extract Title & Description",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find Contacts (Hunter)": {
      "main": [
        [
          {
            "node": "Split Out Contacts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search Local Businesses": {
      "main": [
        [
          {
            "node": "Split Out Businesses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Email Body (AI)": {
      "main": [
        [
          {
            "node": "Format AI Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Title & Description": {
      "main": [
        [
          {
            "node": "Find Contacts (Hunter)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 潜在客户开发, 多模态 AI

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流