8
n8n 中文网amn8n.com

AI驱动的潜在客户抓取(使用APIFY爬虫、Gemini筛选,输出到Google Sheets)

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 19 个节点。主要使用 Wait, Telegram, HttpRequest, SplitInBatches, Agent 等节点。 基于AI的潜在客户处理:从Apify使用Gemini和Google Sheets

前置要求
  • Telegram Bot Token
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "37qfTKwl5HThtkgN",
  "meta": {
    "instanceId": "3dfb5a3650edc2b4757ba54350b9efb3f78be8117da0b1a84cc1dc9700b64bb4"
  },
  "name": "AI驱动的潜在客户抓取(使用APIFY爬虫、Gemini筛选,输出到Google Sheets)",
  "tags": [],
  "nodes": [
    {
      "id": "9a9e0e1e-63bf-43d6-8762-4bcae9a8528c",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1040,
        -224
      ],
      "parameters": {
        "color": 4,
        "width": 660,
        "height": 1312,
        "content": "## 📋 潜在客户抓取自动化 - 设置指南"
      },
      "typeVersion": 1
    },
    {
      "id": "7591ae13-e828-4925-9a0d-7703782751a4",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -352,
        368
      ],
      "parameters": {
        "color": 5,
        "width": 280,
        "height": 156,
        "content": "## 🚀 触发器"
      },
      "typeVersion": 1
    },
    {
      "id": "d66bd4db-6062-4c23-8359-cac89327d515",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        320
      ],
      "parameters": {
        "color": 6,
        "width": 280,
        "height": 224,
        "content": "## 🌐 API调用"
      },
      "typeVersion": 1
    },
    {
      "id": "130f0ea4-835a-464e-850a-4ae978577b06",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        208,
        816
      ],
      "parameters": {
        "color": 3,
        "width": 300,
        "height": 264,
        "content": "## 🔁 批量处理"
      },
      "typeVersion": 1
    },
    {
      "id": "81e229b5-555e-4e67-96a1-66038b88da45",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        768
      ],
      "parameters": {
        "color": 7,
        "width": 340,
        "height": 156,
        "content": "## ⏱️ 速率限制"
      },
      "typeVersion": 1
    },
    {
      "id": "302be8a6-560e-41f7-b8e6-980f716f4d44",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        592,
        -288
      ],
      "parameters": {
        "color": 2,
        "width": 392,
        "height": 420,
        "content": "## 🤖 AI处理引擎"
      },
      "typeVersion": 1
    },
    {
      "id": "c4027074-090c-4353-a314-76a12e51ddb8",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1312,
        416
      ],
      "parameters": {
        "width": 280,
        "height": 248,
        "content": "## 📊 GOOGLE SHEETS"
      },
      "typeVersion": 1
    },
    {
      "id": "f95fe9dd-9920-43ef-8930-d0b57902bda4",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1424,
        -112
      ],
      "parameters": {
        "color": 5,
        "width": 300,
        "height": 252,
        "content": "## 📱 TELEGRAM报告"
      },
      "typeVersion": 1
    },
    {
      "id": "bea27c22-afb2-44b2-9639-6d336ab905a8",
      "name": "当由另一个工作流执行时",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -320,
        560
      ],
      "parameters": {
        "inputSource": "passthrough"
      },
      "typeVersion": 1.1
    },
    {
      "id": "a2975651-6c44-4e27-86ea-5e99a2388672",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        320,
        560
      ],
      "parameters": {
        "options": {
          "reset": false
        },
        "batchSize": 1000
      },
      "typeVersion": 3
    },
    {
      "id": "b093d4cd-dae3-4e27-b84c-128ceb0408e5",
      "name": "知识库助手",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        672,
        160
      ],
      "parameters": {
        "text": "=# Role and Objective\n\nParse one or more scraped Apollo leads (structured or semi-structured) into validated, deduplicated Excel rows, and provide a **single well-formatted Telegram summary message** per batch. Each lead must still be processed individually for Excel (row by row).\n\n#Here is the Input Data:\n\n\n\n---\n\n# Instructions\n\n* Input data may contain:\n  `Name, Email, Phone, Company Name, Job Title, LinkedIn, Company Website, Location, Company Type, Company Summary, No. of Employees, Industry, Common Projects, Newest Updates, Relevant Partner`.\n* Extract required and available optional data per lead, validate, and append to the Excel sheet.\n* **Do not send a Telegram message per lead.** Instead, generate one **Telegram summary message per batch**.\n\n---\n\n## Excel Processing\n\n### Columns\n\n`Lead ID, Name, Email, Phone Number, Company Name, Job Title, LinkedIn, Company Website, Location, Company Type (opt), Company Summary (opt), No. of Employees (opt), Industry (opt), Common Projects (opt), Newest Updates (opt), Relevant Partner (opt)`\n\n### Lead ID Generation\n\n* Format: `AP-DDMMYY-xxxx`.\n* `DDMMYY` = today's date.\n* `xxxx` = incremental per batch, starting at 0001.\n\n### Field Formatting & Validation\n\n* **Phone Number**: Prefer mobile, else landline. Always wrap in `\"quotes\"`.\n* **Location**: Format as *City, Country*. Strip street info.\n* **Company Summary**: Short, clear, no fluff.\n* **Optional Columns**: Fill only if confidently present.\n\n### Validation Rules\n\n* **Required fields**: Name, Email, Company Name. Missing any → skip row.\n* **Deduplication**: Check by Email.\n* **Order**: Preserve input order in Excel output.\n\n---\n\n## Telegram Reporting\n\n* Generate **one consolidated message per batch**.\n* Show totals: processed, added, flagged, skipped.\n* Provide quick list of added leads with identifiers: `Name — Company — Email`.\n* For flagged rows: list missing non-critical fields.\n* For rejected rows: list missing critical fields.\n* Never show **n8n/system errors**. Only user-side data gaps.\n\n---\n\n## Telegram Message Examples\n\n### Batch Summary (All Good)\n\n```\n✅ Batch Complete  \n\nTotal Leads Processed: 10  \nAdded Successfully: 10  \nFlagged: 0  \nSkipped: 0  \n\nContacts Added:  \n- John Smith — Acme Inc. — john.smith@email.com  \n- Jane Doe — Beta Corp — jane.doe@email.com  \n- … (etc.)\n```\n\n### Batch Summary (With Warnings & Errors)\n\n```\n⚠️ Batch Complete With Issues  \n\nTotal Leads Processed: 12  \nAdded Successfully: 8  \nFlagged: 2  \nSkipped: 2  \n\nContacts Added:  \n- Sarah Lee — GreenTech — sarah.lee@email.com  \n- Ahmed Ali — FinSolve — ahmed.ali@email.com  \n…  \n\nFlagged (Missing Fields):  \n- Lead 5: Missing Job Title, LinkedIn  \n- Lead 9: Missing Website  \n\n❌ Skipped (Critical Missing):  \n- Lead 3: Missing Email  \n- Lead 7: Missing Company Name\n```\n\n---\n\n## Clarification\n\n* **✅ = All critical fields present** (Name, Email, Company Name).\n* **⚠️ = Missing important but not critical fields** (Job Title, Phone, LinkedIn, Website). Lead still added.\n* **❌ = Missing critical fields** (Name, Email, Company Name). Lead skipped.\n* Always consolidate into **one Telegram message per batch**, never one per lead.",
        "options": {
          "systemMessage": ""
        },
        "promptType": "define"
      },
      "typeVersion": 1.9
    },
    {
      "id": "16ba55c6-09e5-4a93-944e-8c4931782c08",
      "name": "Google Gemini 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        608,
        368
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "eace1550-8dc1-4a6c-8aff-9ca7e52628cc",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        768,
        400
      ],
      "parameters": {
        "sessionKey": "=memory_{{ $('Telegram Trigger').item.json.message.message_id }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 20
      },
      "typeVersion": 1.3
    },
    {
      "id": "a52239b9-2886-4544-95fe-139ae07373ea",
      "name": "在Google Sheets中附加行",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        992,
        368
      ],
      "parameters": {
        "columns": {
          "value": {
            "Name": "={{ $fromAI('Name', '', 'string') }}",
            "Email": "={{ $fromAI('Email', '', 'string') }}",
            "Address": "={{ $fromAI('Address', '', 'string') }}",
            "Lead \nID": "={{ $fromAI('Lead__ID', '', 'string') }}",
            "Job Title": "={{ $fromAI('Job_Title', '', 'string') }}",
            "Company Name": "={{ $fromAI('Company_Name', '', 'string') }}",
            "Phone Number": "={{ $fromAI('Phone_Number', '', 'string') }}",
            "Company Summary": "={{ $fromAI('Company_Summary', '', 'string') }}",
            "Relevant Partner": "={{ $fromAI('Relevant_Partner', '', 'string') }}",
            "Website / LinkedIn": "={{ $fromAI('Website___LinkedIn', '', 'string') }}"
          },
          "schema": [
            {
              "id": "Lead \nID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Lead \nID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone Number",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Phone Number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Company Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Job Title",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Job Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Website / LinkedIn",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Website / LinkedIn",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Address",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company Summary",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Company Summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Relevant Partner",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Relevant Partner",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Lead \nID"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1974176187,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1eJXVWo8FF8758gItdyfT5JOSInlm7xJ3QQL7zy7tCHc/edit#gid=1974176187",
          "cachedResultName": "Raw Scraping"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1eJXVWo8FF8758gItdyfT5JOSInlm7xJ3QQL7zy7tCHc",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1eJXVWo8FF8758gItdyfT5JOSInlm7xJ3QQL7zy7tCHc/edit?usp=drivesdk",
          "cachedResultName": "EDCON LEADS UNFILTERED"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "bf62c5ce-110d-4123-9f82-05954227f12e",
      "name": "在Google Sheets中获取行",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        1184,
        320
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1974176187,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1eJXVWo8FF8758gItdyfT5JOSInlm7xJ3QQL7zy7tCHc/edit#gid=1974176187",
          "cachedResultName": "Raw Scraping"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1eJXVWo8FF8758gItdyfT5JOSInlm7xJ3QQL7zy7tCHc",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1eJXVWo8FF8758gItdyfT5JOSInlm7xJ3QQL7zy7tCHc/edit?usp=drivesdk",
          "cachedResultName": "EDCON LEADS UNFILTERED"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "1ab18e0f-3d8d-43ed-b6db-bc0871970c38",
      "name": "发送文本消息",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1376,
        160
      ],
      "webhookId": "53b5dc25-a9ea-47b4-87b7-274984c1115d",
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "ccf8718f-a004-4c42-9cf3-611062d42235",
      "name": "APIFY POST请求",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        16,
        560
      ],
      "parameters": {
        "method": "POST",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "e1d8b798-d325-453e-b552-dc223e1d3177",
      "name": "等待APIFY抓取",
      "type": "n8n-nodes-base.wait",
      "position": [
        720,
        576
      ],
      "webhookId": "ccf0293c-0614-4542-b947-40e6da8c39b0",
      "parameters": {
        "amount": 30
      },
      "typeVersion": 1.1
    },
    {
      "id": "59ff55ac-dc9e-4276-af98-b1f9b01bfaf2",
      "name": "Apify GET请求",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1072,
        576
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 4.2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "4ccad03f-070d-40c5-a3eb-5071667c8982",
  "connections": {
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Knowledge Base Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Knowledge Base Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait for APIFY to Scrape",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Apify Get Request": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "APIFY Post Request": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Knowledge Base Agent": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Knowledge Base Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Wait for APIFY to Scrape": {
      "main": [
        [
          {
            "node": "Apify Get Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "APIFY Post Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet in Google Sheets": {
      "ai_tool": [
        [
          {
            "node": "Knowledge Base Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet in Google Sheets": {
      "ai_tool": [
        [
          {
            "node": "Knowledge Base Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 内容创作, 多模态 AI

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流