8
n8n 中文网amn8n.com

潜在客户生成

中级

这是一个Lead Generation, Multimodal AI领域的自动化工作流,包含 9 个节点。主要使用 Set, Code, HttpRequest, GoogleSheets, ManualTrigger 等节点。 使用正则表达式从Google地图提取商业联系信息到Google表格

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "k0SRvELJY6Ec1q75",
  "meta": {
    "instanceId": "c6fffa5bc1b2dcfd92357a5ec64832af921376f0ee8e89f229233d1ed315a8c1",
    "templateCredsSetupCompleted": true
  },
  "name": "潜在客户生成",
  "tags": [],
  "nodes": [
    {
      "id": "ee70b334-c29f-41f3-9427-367c20c43fda",
      "name": "当点击\"测试工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1104,
        1584
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "bef87be5-29b5-483e-a684-326f0aaa278e",
      "name": "设置表单字段",
      "type": "n8n-nodes-base.set",
      "position": [
        -896,
        1584
      ],
      "parameters": {
        "values": {
          "number": [
            {
              "name": "max_results",
              "value": 10
            }
          ],
          "string": [
            {
              "name": "lead_type",
              "value": "Call centers"
            },
            {
              "name": "location",
              "value": "New York"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "28aab0fc-50e5-4513-a799-6953836e0a30",
      "name": "构建搜索URL",
      "type": "n8n-nodes-base.code",
      "position": [
        -688,
        1584
      ],
      "parameters": {
        "jsCode": "const lead = $json.lead_type.replace(/\\s+/g, '+');\nconst loc = $json.location.replace(/\\s+/g, '+');\nreturn {\n  json: {\n    search_url: `https://www.google.com/maps/search/${lead}+in+${loc}`,\n    max_results: $json.max_results\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "5131e56e-f828-45cb-bc57-89564a385a71",
      "name": "提取企业信息",
      "type": "n8n-nodes-base.code",
      "position": [
        -288,
        1584
      ],
      "parameters": {
        "jsCode": "const html = $input.first().json.data;\nconst results = [];\nconst businessRegex = /<div[^>]*aria-label=\"([^\"]+)\"/g;\nconst phoneRegex = /(\\+?\\d[\\d\\s\\-]{7,}\\d)/g;\nconst addressRegex = /<div class=\"[^\"]*\">([^<]*, [^<]*)<\\/div>/g;\nconst websiteRegex = /https?:\\/\\/[^\\/\\s\"'>]+/g;\nconst emailRegex = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.(?!jpeg|jpg|png|gif|webp|svg)[a-zA-Z]{2,}/g;\n\nconst names = [...html.matchAll(businessRegex)].map(m => m[1]);\nconst phones = [...html.matchAll(phoneRegex)].map(m => m[1]);\nconst addresses = [...html.matchAll(addressRegex)].map(m => m[1]);\nconst websites = [...html.matchAll(websiteRegex)];\nconst emails = [...html.matchAll(emailRegex)].map(m => m[0]);\n\nfor (let i = 0; i < names.length; i++) {\n  results.push({\n    json: {\n      name: names[i] || 'N/A',\n      phone: phones[i] || 'N/A',\n      address: addresses[i] || 'N/A',\n      website: websites[i] ? websites[i][0] : 'N/A',\n      email: emails[i] || 'N/A'\n    }\n  });\n}\nreturn results;"
      },
      "typeVersion": 2
    },
    {
      "id": "2b677452-ba15-4d41-8e6c-c4124319b2af",
      "name": "保存到 Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -80,
        1584
      ],
      "parameters": {
        "columns": {
          "value": {
            "Email": "={{ $json.email }}",
            "Phone": "={{ $json.phone }}",
            "Address": "={{ $json.address }}",
            "Website": "={{ $json.website }}",
            "Business Name": "={{ $json.name }}"
          },
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "your_google_sheet_id_here"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "p8TFiJI7j90cCF0X",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "56ec4bb5-5b95-41df-9592-f1af7fa2f871",
      "name": "抓取 Google Maps1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -496,
        1584
      ],
      "parameters": {
        "url": "={{ $json.search_url }}",
        "options": {
          "response": {
            "response": {
              "fullResponse": true
            }
          }
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "e3443da1-9709-4c8c-9c26-6e8a904a385b",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1168,
        1216
      ],
      "parameters": {
        "width": 350,
        "height": 324,
        "content": "## 🗺️ 步骤1:Google Maps 数据提取"
      },
      "typeVersion": 1
    },
    {
      "id": "dd0fc02d-c6ac-4fde-9464-6c7bb7cafdbc",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -768,
        1216
      ],
      "parameters": {
        "width": 380,
        "height": 312,
        "content": "## 🔗 步骤2:网站URL处理"
      },
      "typeVersion": 1
    },
    {
      "id": "26270815-b976-456b-b642-a74f90e077fd",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -336,
        1200
      ],
      "parameters": {
        "width": 400,
        "height": 348,
        "content": "## 📧 步骤3:邮箱提取与导出"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "54a9c9a4-501b-4277-a939-a4b35edde3aa",
  "connections": {
    "Set Form Fields": {
      "main": [
        [
          {
            "node": "Build Search URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Search URL": {
      "main": [
        [
          {
            "node": "Scrape Google Maps1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Google Maps1": {
      "main": [
        [
          {
            "node": "Extract Business Info",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Business Info": {
      "main": [
        [
          {
            "node": "Save to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Set Form Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

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

需要付费吗?

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

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

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

作者
Yar Malik (Asfandyar)

Yar Malik (Asfandyar)

@yar

AI Automation Expert | AI Call Center with Voho

外部链接
在 n8n.io 查看

分享此工作流