リード generationワークフロー:YelpおよびTrustpilotのクローリングにBrightDataを使用し、OpenAIで分析を実施
上級
これはSales, AI分野の自動化ワークフローで、32個のノードを含みます。主にIf, Code, Wait, Gmail, FormTriggerなどのノードを使用、AI技術を活用したスマート自動化を実現。 Yelp と Trustpilot からスクレイビング + AI 駆動のメールアウトレーチでリードを生成します
前提条件
- •Googleアカウント + Gmail API認証情報
- •ターゲットAPIの認証情報が必要な場合あり
- •Google Sheets API認証情報
- •Anthropic API Key
- •Google Gemini API Key
使用ノード (32)
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
"id": "bCzsdWA9ELzYNPUy",
"meta": {
"instanceId": "bc8ca75c203589705ae2e446cad7181d6f2a7cc1766f958ef9f34810e53b8cb2",
"templateCredsSetupCompleted": true
},
"name": "Lead Workflow: Yelp & Trustpilot Scraping + OpenAI Analysis via BrightData",
"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": "Yelp完了待機(1分)",
"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": "Make 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": "Trustpilot完了待機(1分)",
"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": "Make a Copy of This Google Sheet.\n\n(https://docs.google.com/spreadsheets/d/1hX0MD_BLVWuEaXwOjKtwrWsjsBzc32ZtFVjP7wVGQYI/edit?usp=drive_link)"
},
"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": "Optimized Workflow Summary:\nThis automation identifies high-quality leads from Yelp and Trustpilot based on a user-submitted location and business category. It uses AI to break down the area into sub-locations, scrapes business details via BrightData, checks credibility through Trustpilot reviews, and stores the best matches in Google Sheets. Finally, AI generates personalized outreach emails, which are automatically sent via Gmail — enabling fully automated lead generation and email marketing with zero manual effort."
},
"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など)は別途料金が発生する場合があります。
関連ワークフロー
Google My Business リード抽出
Bright Dataを使用してGoogle My Businessからサービス別または場所別のリードを抽出
If
Code
Wait
+
If
Code
Wait
23 ノードDvir Sharon
営業
n8nノードの探索(可視化リファレンスライブラリ内)
n8nノードを可視化リファレンスライブラリで探索
If
Ftp
Set
+
If
Ftp
Set
113 ノードI versus AI
その他
ドメインアウトリーチ:自動のなリード抽出とターゲティング
ドメインアウトリーチ:リードの自動抽出とターゲティング
If
Code
Wait
+
If
Code
Wait
31 ノードBadr
営業
LinkedIn自動接続とセールス向けパーソナライズドメッセージ
LinkedIn:自動接続と販売パーソナライズドメッセージ
If
Set
Wait
+
If
Set
Wait
32 ノードVansh Arora
営業
キーワードを使って X や他のソーシャルメディアプラットフォームに最新のニュースを投稿する
キーワードと Bright Data を使って AI によるコンテンツ生成と共に最新のニュースを X に自動投稿する
If
Code
Wait
+
If
Code
Wait
16 ノードDvir Sharon
デザイン
ブログパブリッシャー – 完全AI駆動のコンテンツ調査、作成、最適化、公開の自動化
Gemini、Ideogram AI、WordPress でブログ作成と公開を自動化
If
Set
Code
+
If
Set
Code
35 ノードIncrementors
コンテンツ作成