8
n8n 中文网amn8n.com

潜在客户工作流:通过 BrightData 进行 Yelp 和 Trustpilot 抓取 + OpenAI 分析

高级

这是一个Sales, AI领域的自动化工作流,包含 32 个节点。主要使用 If, Code, Wait, Gmail, FormTrigger 等节点,结合人工智能技术实现智能自动化。 通过 Yelp 和 Trustpilot 抓取 + AI 驱动的邮件外联生成销售线索

前置要求
  • Google 账号和 Gmail API 凭证
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
  • Anthropic API Key
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "bCzsdWA9ELzYNPUy",
  "meta": {
    "instanceId": "bc8ca75c203589705ae2e446cad7181d6f2a7cc1766f958ef9f34810e53b8cb2",
    "templateCredsSetupCompleted": true
  },
  "name": "潜在客户工作流:通过 BrightData 进行 Yelp 和 Trustpilot 抓取 + OpenAI 分析",
  "tags": [],
  "nodes": [
    {
      "id": "607d9645-e0ef-47a3-985d-15b50ffc522a",
      "name": "表单触发器 - 获取用户输入",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -640,
        -3320
      ],
      "webhookId": "37d0e84c-0cda-47f8-826d-9ae5b22ba1d5",
      "parameters": {
        "options": {},
        "formTitle": "YelpDataScraper",
        "formFields": {
          "values": [
            {
              "fieldLabel": "country"
            },
            {
              "fieldLabel": "category "
            },
            {
              "fieldLabel": "location"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "80bd12f9-5fd0-4255-9834-d80838dfcba2",
      "name": "AI 位置分析器",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -340,
        -3460
      ],
      "parameters": {
        "text": "=You are an intelligent assistant helping to guide in location like i will give me some details like country location and business category so what you have to do give me some location names based in location (city).\n\nhere are some details:\n- Country: {{ $json.country }}\n- Location: {{ $json.location }}\n- Category: {{ $json['category '] }}\n\nnow analyse this city and find some sub placeces in this city and give me their name commas seperated for example we have a city Fort Worth so in Fort Worth there are many famous location or areas so you have to give some location and area name in this city.\n\n- ouput should be comma seperated.\n- do not include intro outro supporting text.\n- dont use special characters like $,*,# and more.",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "7b6d4d3d-a76e-4b2f-8e75-d4a68da0b572",
      "name": "分割子位置",
      "type": "n8n-nodes-base.code",
      "position": [
        160,
        -3520
      ],
      "parameters": {
        "jsCode": "// Get the input data\nconst category = $('Form Trigger - Get User Input').first().json['category '];\nconst country = $('Form Trigger - Get User Input').first().json.country;\nconst aiOutput = $input.first().json.output;\n\n// Clean and split the AI output to get individual locations\nconst locationsString = aiOutput.replace(/[{}]/g, '').trim(); // Remove curly braces\nconst locations = locationsString\n  .split(',')\n  .map(location => location.trim())\n  .filter(location => location.length > 0); // Remove empty strings\n\n// Create output array with each location as a separate item\nconst output = locations.map((location, index) => {\n  return {\n    id: index + 1,\n    category: category,\n    country: country,\n    location: location\n  };\n});\n\n// Return the transformed data\nreturn output;"
      },
      "typeVersion": 2
    },
    {
      "id": "a82eeee9-66df-45ce-8604-4685bab3a67f",
      "name": "循环 Yelp 位置",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        460,
        -3520
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "304e8b0e-6c0d-48aa-b67a-2f37dd5a2c49",
      "name": "Yelp 抓取器",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        560,
        -3360
      ],
      "parameters": {
        "url": "https://api.brightdata.com/datasets/v3/trigger",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"input\": [\n    {\n      \"country\": \"{{ $json.country }}\",\n      \"location\": \"{{ $json.location }}\",\n      \"category\": \"{{ $json.category }}\"\n    }\n  ],\n  \"custom_output_fields\": [\n    \"name\",\n    \"overall_rating\",\n    \"reviews_count\",\n    \"categories\",\n    \"website\",\n    \"phone_number\",\n    \"address\",\n    \"url\"\n  ]\n}\n",
        "sendBody": true,
        "sendQuery": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "queryParameters": {
          "parameters": [
            {
              "name": "dataset_id",
              "value": "gd_lgugwl0519h1p14rwk"
            },
            {
              "name": "include_errors",
              "value": "true"
            },
            {
              "name": "type",
              "value": "discover_new"
            },
            {
              "name": "discover_by",
              "value": "search_filters"
            },
            {
              "name": "limit_per_input",
              "value": "10"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer BRIGHT_DATA_API_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "2afb35ee-9881-4bff-9267-eb754203e232",
      "name": "检查 Yelp 抓取进度",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        760,
        -3360
      ],
      "parameters": {
        "url": "=https://api.brightdata.com/datasets/v3/progress/{{ $json.snapshot_id }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer BRIGHT_DATA_API_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2,
      "alwaysOutputData": true
    },
    {
      "id": "892f2e2e-9171-4c87-99e3-468c4621ee28",
      "name": "等待(1 分钟)Yelp 完成",
      "type": "n8n-nodes-base.wait",
      "position": [
        960,
        -3360
      ],
      "webhookId": "10b45556-5e91-4387-abd0-f9078b220286",
      "parameters": {
        "unit": "minutes",
        "amount": 1
      },
      "typeVersion": 1.1
    },
    {
      "id": "a2deac3d-eb34-49bd-9c1b-f940ec59887b",
      "name": "验证 Yelp 就绪",
      "type": "n8n-nodes-base.if",
      "position": [
        1200,
        -3360
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "35ed620d-b5d5-4e97-bcc5-52b283d85616",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "ready"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3557f70e-29e6-4655-919a-997b9b905450",
      "name": "如果 Yelp 有记录",
      "type": "n8n-nodes-base.if",
      "position": [
        1420,
        -3380
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "80b55138-4007-47ce-9e4a-bf001c875047",
              "operator": {
                "type": "number",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.records }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "53b7ba95-719c-4161-a8c2-ccd45aaa9768",
      "name": "获取 Yelp 结果",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1660,
        -3400
      ],
      "parameters": {
        "url": "=https://api.brightdata.com/datasets/v3/snapshot/{{ $json.snapshot_id }}",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "format",
              "value": "json"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer BRIGHT_DATA_API_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "430f7f49-c0b8-4e0e-b217-d5b5831062e0",
      "name": "保存 Yelp 数据到表格",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1820,
        -3260
      ],
      "parameters": {
        "columns": {
          "value": {
            "URL": "={{ $json.url }}",
            "name": "={{ $json.name }}",
            "address": "={{ $json.address }}",
            "Phone No": "={{ $json.phone_number }}",
            "categories": "={{ $json.categories }}",
            "overall_rating": "={{ $json.name }}",
            "Company Website": "={{ $json.website }}"
          },
          "schema": [
            {
              "id": "overall_rating",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "overall_rating",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "URL",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "categories",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "categories",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone No",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Phone No",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "address",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company Website",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Company Website",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/GOOGLE_SHEET_ID_PLACEHOLDER/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1hJD3mDpa93IvPrnvo29FFfqQWEAjGHA_wGG5hfIlqlk",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/GOOGLE_SHEET_ID_PLACEHOLDER/edit?usp=drivesdk",
          "cachedResultName": "Lead Generator Finder"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "3GynTMfjoyPl1MTl",
          "name": "Google Sheets-Aksh"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "70d7b107-8722-4269-8aaa-40c1c2f01ad6",
      "name": "清理唯一网站",
      "type": "n8n-nodes-base.code",
      "position": [
        1760,
        -3540
      ],
      "parameters": {
        "jsCode": "// Set to collect unique non-empty websites\nconst websites = new Set();\n\nfor (const item of items) {\n  const website = item.json[\"Company Website\"];\n  if (website && website.toString().trim() !== \"\") {\n    websites.add(website.toString().trim());\n  }\n}\n\n// Return one item per website\nreturn Array.from(websites).map(site => {\n  return {\n    json: {\n      website: site\n    }\n  };\n});\n"
      },
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "1fa4c014-2c1b-4d9a-978f-cf16423fc88d",
      "name": "读取 Yelp 表格网站",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2020,
        -3540
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/GOOGLE_SHEET_ID_PLACEHOLDER/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1hJD3mDpa93IvPrnvo29FFfqQWEAjGHA_wGG5hfIlqlk",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/GOOGLE_SHEET_ID_PLACEHOLDER/edit?usp=drivesdk",
          "cachedResultName": "Lead Generator Finder"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "3GynTMfjoyPl1MTl",
          "name": "Google Sheets-Aksh"
        }
      },
      "typeVersion": 4.6,
      "alwaysOutputData": true
    },
    {
      "id": "092a5d61-79a4-4a73-8633-05d2a6482efc",
      "name": "创建 Trustpilot URL",
      "type": "n8n-nodes-base.code",
      "position": [
        2200,
        -3540
      ],
      "parameters": {
        "jsCode": "return items.map(item => {\n  const rawUrl = item.json[\"Company Website\"] || \"\";\n  const cleanDomain = rawUrl.replace(/^https?:\\/\\//, \"\").replace(/\\/$/, \"\");\n  const trustpilotUrl = `https://www.trustpilot.com/review/${cleanDomain}`;\n\n  return {\n    json: {\n      \"Trustpilot Website URL\": trustpilotUrl\n    }\n  };\n});\n"
      },
      "typeVersion": 2
    },
    {
      "id": "6116588d-cb2c-4bc4-af6c-1a0b400f9cc4",
      "name": "移除重复的 TP URL",
      "type": "n8n-nodes-base.code",
      "position": [
        2440,
        -3180
      ],
      "parameters": {
        "jsCode": "const seen = new Set();\nconst output = [];\n\nfor (const item of items) {\n  const url = item.json[\"Trustpilot Website URL\"];\n  \n  if (!seen.has(url)) {\n    seen.add(url);\n    output.push({ json: { \"Trustpilot Website URL\": url } });\n  }\n}\n\nreturn output;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "c0e0112a-d61a-4241-adaa-08844c77f3bc",
      "name": "循环 Trustpilot URL",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -420,
        -2740
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "1260b1be-baf0-4d4c-bde2-5a0479704730",
      "name": "触发 Trustpilot 抓取器",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -60,
        -2940
      ],
      "parameters": {
        "url": "https://api.brightdata.com/datasets/v3/trigger",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"input\": [\n    {\n      \"url\": \"{{ $json[\"Trustpilot Website URL\"] }}\",\n      \"date_posted\": \"\"\n    }\n  ],\n  \"custom_output_fields\": [\n    \"company_name\",\n    \"review_id\",\n    \"review_date\",\n    \"review_rating\",\n    \"review_title\",\n    \"review_content\",\n    \"is_verified_review\",\n    \"review_date_of_experience\",\n    \"reviewer_location\",\n    \"reviews_posted_overall\",\n    \"review_replies\",\n    \"review_useful_count\",\n    \"reviewer_name\",\n    \"company_logo\",\n    \"url\",\n    \"company_rating_name\",\n    \"company_overall_rating\",\n    \"is_verified_company\",\n    \"company_total_reviews\",\n    \"5_star\",\n    \"4_star\",\n    \"3_star\",\n    \"2_star\",\n    \"1_star\",\n    \"company_about\",\n    \"company_email\",\n    \"company_phone\",\n    \"company_location\",\n    \"company_country\",\n    \"breadcrumbs\",\n    \"company_category\",\n    \"company_id\",\n    \"company_website\",\n    \"company activity\",\n    \"company_other_categories\",\n    \"review_url\",\n    \"date_posted\"\n  ]\n} ",
        "sendBody": true,
        "sendQuery": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "queryParameters": {
          "parameters": [
            {
              "name": "dataset_id",
              "value": "gd_lm5zmhwd2sni130p"
            },
            {
              "name": "include_errors",
              "value": "true"
            },
            {
              "name": "limit_multiple_results",
              "value": "2"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer BRIGHT_DATA_API_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "7cae1204-b356-42e6-80cb-8333e676cb49",
      "name": "检查 Trustpilot 抓取进度",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        200,
        -2940
      ],
      "parameters": {
        "url": "=https://api.brightdata.com/datasets/v3/progress/{{ $json.snapshot_id }}",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "format",
              "value": "json"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer BRIGHT_DATA_API_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d915bb86-bc43-4a7a-afb4-e5264b24e3a1",
      "name": "验证 Trustpilot 抓取器就绪",
      "type": "n8n-nodes-base.if",
      "position": [
        400,
        -2940
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "35ed620d-b5d5-4e97-bcc5-52b283d85616",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "ready"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "74fd5339-ef01-4aa2-9646-6ef9e65c9c31",
      "name": "等待(1 分钟)Trustpilot 完成",
      "type": "n8n-nodes-base.wait",
      "position": [
        560,
        -2840
      ],
      "webhookId": "7047efad-de41-4608-b95c-d3e0203ef620",
      "parameters": {
        "unit": "minutes",
        "amount": 1
      },
      "typeVersion": 1.1
    },
    {
      "id": "e57b97a7-3904-453c-9fa9-a95e455a77c7",
      "name": "如果 Trustpilot 有记录",
      "type": "n8n-nodes-base.if",
      "position": [
        940,
        -2820
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "f01bd215-c406-493c-a6e4-2b8ec5686b44",
              "operator": {
                "type": "number",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.records }}",
              "rightValue": "={{ 0 }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "40ff595d-c011-4cf8-8353-a97ecf2ecdde",
      "name": "下载 Trustpilot 数据",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1180,
        -2840
      ],
      "parameters": {
        "url": "=https://api.brightdata.com/datasets/v3/snapshot/{{ $json.snapshot_id }}",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "format",
              "value": "json"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer BRIGHT_DATA_API_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "0b535959-7c31-44c9-8d2d-4f3428f4e8dc",
      "name": "保存 Trustpilot 数据到表格",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1460,
        -2840
      ],
      "parameters": {
        "columns": {
          "value": {
            "Email": "={{ $json.company_email }}",
            "Rating": "={{ $json.review_rating }}",
            "Address": "={{ $json.company_location }}",
            "Company Name": "={{ $json.company_name }}",
            "Phone Number": "={{ $json.company_phone }}",
            "Company About": "={{ $json.company_about }}"
          },
          "schema": [
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone Number",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Phone Number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Address",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Rating",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Rating",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company Name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Company Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company About",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Company About",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 972788573,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/GOOGLE_SHEET_ID_PLACEHOLDER/edit#gid=972788573",
          "cachedResultName": "Mail Scrap"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1xkNBckPDGf4YR74bJQN07tAr3qlEoA-70pQc63nBqZ8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/GOOGLE_SHEET_ID_PLACEHOLDER/edit?usp=drivesdk",
          "cachedResultName": "Job Finder sheet"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "3GynTMfjoyPl1MTl",
          "name": "Google Sheets-Aksh"
        }
      },
      "typeVersion": 4.6,
      "alwaysOutputData": true
    },
    {
      "id": "7e4768b9-0932-4b7c-bdf5-5348cbecb2eb",
      "name": "从 Trustpilot 表格读取电子邮件",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1680,
        -2840
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "=demo@example.com",
              "lookupColumn": "Email"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 972788573,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/GOOGLE_SHEET_ID_PLACEHOLDER/edit#gid=972788573",
          "cachedResultName": "Mail Scrap"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1xkNBckPDGf4YR74bJQN07tAr3qlEoA-70pQc63nBqZ8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/GOOGLE_SHEET_ID_PLACEHOLDER/edit?usp=drivesdk",
          "cachedResultName": "Job Finder sheet"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "3GynTMfjoyPl1MTl",
          "name": "Google Sheets-Aksh"
        }
      },
      "typeVersion": 4.6,
      "alwaysOutputData": true
    },
    {
      "id": "80e0f93f-5a25-40c5-9413-261781ddca4b",
      "name": "获取唯一电子邮件",
      "type": "n8n-nodes-base.code",
      "position": [
        1880,
        -2840
      ],
      "parameters": {
        "jsCode": "const seen = new Set();\nconst output = [];\n\nfor (const item of items) {\n  const email = item.json.Email;\n  if (!email || seen.has(email)) continue;\n\n  seen.add(email);\n\n  output.push({\n    json: {\n      email: email\n    }\n  });\n}\n\nreturn output;\n"
      },
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "d7301840-e464-4394-ae16-c479a1508bb7",
      "name": "AI 生成电子邮件内容",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2080,
        -2840
      ],
      "parameters": {
        "text": "=`Write a friendly and professional outreach message from a digital marketing agency to the business\n\nThe message should offer services to help them boost their sales and services, such as SEO, ads, and website optimization.\n\nReturn the result in JSON format with:\n{\n  \"email\": \"{{ $json.email }}\"\n}`\n",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "a1d9596c-c9cd-4111-8b78-8d101020dfa7",
      "name": "解析电子邮件 JSON",
      "type": "n8n-nodes-base.code",
      "position": [
        2480,
        -2840
      ],
      "parameters": {
        "jsCode": "// Fix for parsing AI email output\ntry {\n    const output = $input.first().json.output;\n    \n    // Remove the ```json\\n prefix and ```\\n suffix if present\n    let cleanOutput = output;\n    if (output.startsWith('```json\\n')) {\n        cleanOutput = output.replace(/^```json\\n/, '').replace(/\\n```$/, '');\n    }\n    \n    // Parse the JSON\n    const parsed = JSON.parse(cleanOutput);\n    \n    // Return the email details as separate fields\n    return {\n        email: parsed.email || '',\n        subject: parsed.subject || '',\n        content: parsed.message || parsed.content || ''\n    };\n    \n} catch (error) {\n    // If JSON parsing fails, try to extract info using regex from the raw output\n    const output = $input.first().json.output;\n    \n    const emailMatch = output.match(/\"email\":\\s*\"([^\"]*)\"/);\n    const subjectMatch = output.match(/\"subject\":\\s*\"([^\"]*)\"/);\n    const messageMatch = output.match(/\"message\":\\s*\"([^\"]*(?:\\\\.[^\"]*)*)\"/);\n    \n    return {\n        email: emailMatch ? emailMatch[1] : '',\n        subject: subjectMatch ? subjectMatch[1] : '',\n        content: messageMatch ? messageMatch[1].replace(/\\\\n/g, '\\n').replace(/\\\\\"/g, '\"') : ''\n    };\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "38e46cfe-4fda-4b3d-9921-19a9f73848c1",
      "name": "发送外展电子邮件",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2720,
        -2720
      ],
      "webhookId": "51b5a9b3-7d26-4ea9-b507-206129cf9646",
      "parameters": {
        "sendTo": "={{ $json.email }}",
        "message": "={{ $json.content }}",
        "options": {},
        "subject": "={{ $json.subject }}",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "gVmVsyjENjEeeaq9",
          "name": "Gmail - sender@example.com"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "ae6ec720-694f-43de-be99-fc9baee03622",
      "name": "Gemini - 位置 AI 模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -360,
        -3260
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-1.5-flash"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "QEE7fHoS8DGBZLp5",
          "name": "Google Gemini(PaLM) Api account 2"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4882a0ef-e8f3-4954-b7bc-5aaaf9566d11",
      "name": "Claude - 电子邮件 AI 模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        2020,
        -2680
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-20250514",
          "cachedResultName": "Claude 4 Sonnet"
        },
        "options": {}
      },
      "credentials": {
        "anthropicApi": {
          "id": "ipIAoB1BlqWHYhi2",
          "name": "Anthropic account 5"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "e7cfac25-d88e-4504-aaa6-1f74ac04b819",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        -3920
      ],
      "parameters": {
        "color": 4,
        "width": 340,
        "content": "复制此 Google 表格。"
      },
      "typeVersion": 1
    },
    {
      "id": "c2c6abba-589f-4e26-a5fc-a563ad3ee3ef",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -4200
      ],
      "parameters": {
        "color": 7,
        "width": 880,
        "height": 520,
        "content": "优化的工作流摘要:"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "a4b1073a-b560-481c-9208-535aace8da01",
  "connections": {
    "304e8b0e-6c0d-48aa-b67a-2f37dd5a2c49": {
      "main": [
        [
          {
            "node": "2afb35ee-9881-4bff-9267-eb754203e232",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a1d9596c-c9cd-4111-8b78-8d101020dfa7": {
      "main": [
        [
          {
            "node": "38e46cfe-4fda-4b3d-9921-19a9f73848c1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "80e0f93f-5a25-40c5-9413-261781ddca4b": {
      "main": [
        [
          {
            "node": "d7301840-e464-4394-ae16-c479a1508bb7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a2deac3d-eb34-49bd-9c1b-f940ec59887b": {
      "main": [
        [
          {
            "node": "3557f70e-29e6-4655-919a-997b9b905450",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "2afb35ee-9881-4bff-9267-eb754203e232",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "53b7ba95-719c-4161-a8c2-ccd45aaa9768": {
      "main": [
        [
          {
            "node": "430f7f49-c0b8-4e0e-b217-d5b5831062e0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3557f70e-29e6-4655-919a-997b9b905450": {
      "main": [
        [
          {
            "node": "53b7ba95-719c-4161-a8c2-ccd45aaa9768",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "a82eeee9-66df-45ce-8604-4685bab3a67f": {
      "main": [
        [
          {
            "node": "70d7b107-8722-4269-8aaa-40c1c2f01ad6",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "304e8b0e-6c0d-48aa-b67a-2f37dd5a2c49",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "38e46cfe-4fda-4b3d-9921-19a9f73848c1": {
      "main": [
        [
          {
            "node": "c0e0112a-d61a-4241-adaa-08844c77f3bc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7b6d4d3d-a76e-4b2f-8e75-d4a68da0b572": {
      "main": [
        [
          {
            "node": "a82eeee9-66df-45ce-8604-4685bab3a67f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "80bd12f9-5fd0-4255-9834-d80838dfcba2": {
      "main": [
        [
          {
            "node": "7b6d4d3d-a76e-4b2f-8e75-d4a68da0b572",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c0e0112a-d61a-4241-adaa-08844c77f3bc": {
      "main": [
        [],
        [
          {
            "node": "1260b1be-baf0-4d4c-bde2-5a0479704730",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "092a5d61-79a4-4a73-8633-05d2a6482efc": {
      "main": [
        [
          {
            "node": "6116588d-cb2c-4bc4-af6c-1a0b400f9cc4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "70d7b107-8722-4269-8aaa-40c1c2f01ad6": {
      "main": [
        [
          {
            "node": "1fa4c014-2c1b-4d9a-978f-cf16423fc88d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4882a0ef-e8f3-4954-b7bc-5aaaf9566d11": {
      "ai_languageModel": [
        [
          {
            "node": "d7301840-e464-4394-ae16-c479a1508bb7",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "430f7f49-c0b8-4e0e-b217-d5b5831062e0": {
      "main": [
        [
          {
            "node": "a82eeee9-66df-45ce-8604-4685bab3a67f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "40ff595d-c011-4cf8-8353-a97ecf2ecdde": {
      "main": [
        [
          {
            "node": "0b535959-7c31-44c9-8d2d-4f3428f4e8dc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1fa4c014-2c1b-4d9a-978f-cf16423fc88d": {
      "main": [
        [
          {
            "node": "092a5d61-79a4-4a73-8633-05d2a6482efc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6116588d-cb2c-4bc4-af6c-1a0b400f9cc4": {
      "main": [
        [
          {
            "node": "c0e0112a-d61a-4241-adaa-08844c77f3bc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d7301840-e464-4394-ae16-c479a1508bb7": {
      "main": [
        [
          {
            "node": "a1d9596c-c9cd-4111-8b78-8d101020dfa7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e57b97a7-3904-453c-9fa9-a95e455a77c7": {
      "main": [
        [
          {
            "node": "40ff595d-c011-4cf8-8353-a97ecf2ecdde",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "c0e0112a-d61a-4241-adaa-08844c77f3bc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2afb35ee-9881-4bff-9267-eb754203e232": {
      "main": [
        [
          {
            "node": "892f2e2e-9171-4c87-99e3-468c4621ee28",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ae6ec720-694f-43de-be99-fc9baee03622": {
      "ai_languageModel": [
        [
          {
            "node": "80bd12f9-5fd0-4255-9834-d80838dfcba2",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "1260b1be-baf0-4d4c-bde2-5a0479704730": {
      "main": [
        [
          {
            "node": "7cae1204-b356-42e6-80cb-8333e676cb49",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "892f2e2e-9171-4c87-99e3-468c4621ee28": {
      "main": [
        [
          {
            "node": "a2deac3d-eb34-49bd-9c1b-f940ec59887b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "607d9645-e0ef-47a3-985d-15b50ffc522a": {
      "main": [
        [
          {
            "node": "80bd12f9-5fd0-4255-9834-d80838dfcba2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0b535959-7c31-44c9-8d2d-4f3428f4e8dc": {
      "main": [
        [
          {
            "node": "7e4768b9-0932-4b7c-bdf5-5348cbecb2eb",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d915bb86-bc43-4a7a-afb4-e5264b24e3a1": {
      "main": [
        [
          {
            "node": "e57b97a7-3904-453c-9fa9-a95e455a77c7",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "74fd5339-ef01-4aa2-9646-6ef9e65c9c31",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7cae1204-b356-42e6-80cb-8333e676cb49": {
      "main": [
        [
          {
            "node": "d915bb86-bc43-4a7a-afb4-e5264b24e3a1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7e4768b9-0932-4b7c-bdf5-5348cbecb2eb": {
      "main": [
        [
          {
            "node": "80e0f93f-5a25-40c5-9413-261781ddca4b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "74fd5339-ef01-4aa2-9646-6ef9e65c9c31": {
      "main": [
        [
          {
            "node": "7cae1204-b356-42e6-80cb-8333e676cb49",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 销售, 人工智能

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流

分类

分类: 34