竞品价格查询和报告生成器
高级
这是一个AI, Marketing领域的自动化工作流,包含 19 个节点。主要使用 If, Set, Code, Wait, Markdown 等节点,结合人工智能技术实现智能自动化。 基于Bright Data的竞品价格查询和报告生成器
前置要求
- •Google Sheets API 凭证
- •Google Gemini API Key
使用的节点 (19)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"meta": {
"instanceId": "71eb5622cf8abac565805540c0900dbae437dddbda45bf1b87bf3bfeea26393c",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "588abc91-e839-4f69-b5b1-dcd33b6bcd48",
"name": "当点击“测试工作流”时",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-460,
-80
],
"parameters": {},
"typeVersion": 1
},
{
"id": "2481cb1d-6309-4e32-970c-3b68c556758f",
"name": "Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"position": [
-180,
-80
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Jf8qNEg-KTh__aZ8L5YS5iMmBZLEEKCYipIszWARCmw/edit#gid=0",
"cachedResultName": "input"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1Jf8qNEg-KTh__aZ8L5YS5iMmBZLEEKCYipIszWARCmw",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Jf8qNEg-KTh__aZ8L5YS5iMmBZLEEKCYipIszWARCmw/edit?usp=drivesdk",
"cachedResultName": "Items"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "xEyma1PCHrpnF0ZW",
"name": "Google Sheets account"
}
},
"typeVersion": 4.5
},
{
"id": "e165f017-7abf-4a5c-82d4-97013b25b582",
"name": "等待30秒 - 轮询 Bright Data",
"type": "n8n-nodes-base.wait",
"position": [
480,
-440
],
"webhookId": "8005a2b3-2195-479e-badb-d90e4240e699",
"parameters": {
"amount": 30
},
"executeOnce": false,
"typeVersion": 1.1
},
{
"id": "8cbd727d-9104-4d40-8ec2-0a4718c0e4e0",
"name": "快照进度",
"type": "n8n-nodes-brightdata.brightData",
"position": [
700,
-440
],
"parameters": {
"resource": "marketplaceDataset",
"operation": "getSnapshotMetadata",
"snapshot_id": "={{ $json.snapshot_id }}"
},
"credentials": {
"brightdataApi": {
"id": "M05NojNBUiV9U7KO",
"name": "BrightData account"
}
},
"typeVersion": 1
},
{
"id": "0ce012a2-6827-4128-9642-c22f97f5a89d",
"name": "快照内容",
"type": "n8n-nodes-brightdata.brightData",
"position": [
360,
40
],
"parameters": {
"resource": "marketplaceDataset",
"operation": "getSnapshotContent",
"snapshot_id": "={{ $('Snapshot Request').item.json.snapshot_id }}"
},
"credentials": {
"brightdataApi": {
"id": "M05NojNBUiV9U7KO",
"name": "BrightData account"
}
},
"typeVersion": 1
},
{
"id": "3b4c2dc2-9191-411d-b9eb-1c9038b3e82c",
"name": "快照请求",
"type": "n8n-nodes-brightdata.brightData",
"position": [
260,
-440
],
"parameters": {
"resource": "marketplaceDataset",
"operation": "filterDataset",
"dataset_id": {
"__rl": true,
"mode": "list",
"value": "gd_ltppk50q18kdw67omz",
"cachedResultName": "Google Shopping"
},
"filter_type": "filters_group",
"filters_group": "={\"operator\":\"and\",\"filters\":[{\"name\":\"title\",\"operator\":\"includes\",\"value\":\"{{$json.title}}\"},\n{\"name\":\"item_price\",\"operator\":\"is_not_null\"}]}"
},
"credentials": {
"brightdataApi": {
"id": "M05NojNBUiV9U7KO",
"name": "BrightData account"
}
},
"typeVersion": 1
},
{
"id": "1421cc56-469e-4a7a-8a73-c3f8aff795c1",
"name": "条件判断 - 检查快照状态",
"type": "n8n-nodes-base.if",
"position": [
920,
-440
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "7932282b-71bb-4bbb-ab73-4978e554de7e",
"operator": {
"type": "string",
"operation": "notEquals"
},
"leftValue": "={{ $json.status }}",
"rightValue": "running"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "f774e258-3da9-4ad9-8843-04814ac64ec0",
"name": "检查快照是否就绪",
"type": "n8n-nodes-base.if",
"position": [
800,
40
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "645d85d3-c5cc-4e51-a989-075c0a851449",
"operator": {
"type": "boolean",
"operation": "false",
"singleValue": true
},
"leftValue": "={{ $json.isArray}}",
"rightValue": "false"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "e434c805-06f3-4497-b21c-897ff7aab9d4",
"name": "遍历项目",
"type": "n8n-nodes-base.splitInBatches",
"position": [
100,
-80
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "30e1f4f1-9cee-493f-9b52-0998ebd2c2da",
"name": "条件判断 - 检查错误状态",
"type": "n8n-nodes-base.if",
"position": [
1140,
-380
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "7932282b-71bb-4bbb-ab73-4978e554de7e",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.status }}",
"rightValue": "failed"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "ff36ddb4-c22a-4bf7-9776-a12ffbad0280",
"name": "代码 - 检查快照是否已构建",
"type": "n8n-nodes-base.code",
"position": [
580,
40
],
"parameters": {
"jsCode": "const value = $json.items;\nconst isArray = Array.isArray(value);\n\nreturn [\n {\n json: {\n isArray: isArray,\n original: value\n }\n }\n];"
},
"typeVersion": 2
},
{
"id": "036893c2-57f7-4e69-a617-9c8f256d33cf",
"name": "代码 - 提取必要数据",
"type": "n8n-nodes-base.code",
"position": [
1020,
40
],
"parameters": {
"jsCode": "const input = items[0].json.original;\nconst posts = Array.isArray(input) ? input : [];\n\n// Фильтруем те, где item_price присутствует\nconst filteredPosts = posts.filter(post =>\n post && post.item_price !== null && post.item_price !== undefined\n);\n\n// Оставляем только нужные поля\nconst extracted = filteredPosts.map(post => {\n return {\n price: post.item_price,\n seller_name: post.seller_name || null,\n title: post.title || null,\n url: post.url || null,\n };\n});\n\nreturn [\n {\n json: {\n items: extracted\n }\n }\n];\n"
},
"typeVersion": 2
},
{
"id": "dfa86828-7bcf-423f-ad24-8b1a39d92d50",
"name": "邮件报告",
"type": "n8n-nodes-base.emailSend",
"position": [
2020,
240
],
"webhookId": "1e6e9588-2bc6-4f05-8531-2d7ca8348d0c",
"parameters": {
"html": "={{ $json.html }}",
"options": {},
"subject": "=Your N8N report about {{ $('Loop Over Items').item.json.title }}",
"toEmail": "jotunheim166@gmail.com",
"fromEmail": "n8n-mail@example.com"
},
"credentials": {
"smtp": {
"id": "2TLeEvocq163Riy6",
"name": "SMTP account"
}
},
"typeVersion": 2.1
},
{
"id": "1194906b-74d1-4cee-9429-7d9168ee97a5",
"name": "错误消息(如需可替换为 webhook/其他通知器)",
"type": "n8n-nodes-base.set",
"position": [
1380,
-300
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "c1137a35-0854-4af2-b22d-6d7817f2a2f2",
"name": "message",
"type": "string",
"value": "=Bright Data snapshot error for item \"{{ $('Loop Over Items').item.json.title }}\": \n{{ $('Snapshot Progress').item.json.warning }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "a9f8c6fb-b8c4-45bf-a452-20544dd2b72f",
"name": "Google Gemini聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
1260,
260
],
"parameters": {
"options": {},
"modelName": "models/gemini-2.0-flash"
},
"credentials": {
"googlePalmApi": {
"id": "vZJIC5jaE984SWu3",
"name": "Google Gemini(PaLM) Api account"
}
},
"typeVersion": 1
},
{
"id": "9f3f912d-9d9a-4269-86a2-e6edbe26c793",
"name": "比较价格并生成报告",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
1240,
40
],
"parameters": {
"text": "={{$json}}",
"messages": {
"messageValues": [
{
"message": "=Analyze these listings from Google Shopping and identify the top 20 sources (stores or websites) offering the lowest prices. Provide a ranked list including the seller name, product price, and link to the listing if available. Ensure all product names match or are highly relevent to {{ $('Loop Over Items').item }}. Don't start your answer with 'Okay'. Return all the text as Markdown."
}
]
},
"promptType": "define"
},
"typeVersion": 1.6
},
{
"id": "8b564b07-5f07-4d45-b3c2-203e56d23617",
"name": "Markdown",
"type": "n8n-nodes-base.markdown",
"position": [
1620,
40
],
"parameters": {
"mode": "markdownToHtml",
"options": {},
"markdown": "={{ $json.text }}",
"destinationKey": "html"
},
"typeVersion": 1
},
{
"id": "67e40e23-e514-435f-8795-81e8112b2234",
"name": "代码 - 构建 HTML",
"type": "n8n-nodes-base.code",
"position": [
1840,
40
],
"parameters": {
"jsCode": "const rawHtml = $json.html;\n\nreturn [{\n json: {\n html: `\n <html>\n <head>\n <style>\n body { font-family: Arial, sans-serif; line-height: 1.5; font-size: 15px; }\n h1, h2, h3 { color: #333; }\n a { color: #1a73e8; text-decoration: none; }\n ul { padding-left: 20px; }\n li { margin-bottom: 6px; }\n </style>\n </head>\n <body>\n ${rawHtml}\n </body>\n </html>\n `\n }\n}];"
},
"typeVersion": 2
},
{
"id": "613822ea-6e5c-4aba-a4c5-84a1a696a446",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-240,
80
],
"parameters": {
"height": 240,
"content": "⚠️ 注意"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Markdown": {
"main": [
[
{
"node": "Code - Build HTML",
"type": "main",
"index": 0
}
]
]
},
"Email Report": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Google Sheets": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "Snapshot Request",
"type": "main",
"index": 0
}
]
]
},
"Snapshot Content": {
"main": [
[
{
"node": "Code - Check If Snapshot is built",
"type": "main",
"index": 0
}
]
]
},
"Snapshot Request": {
"main": [
[
{
"node": "Wait 30s - Polling Bright Data",
"type": "main",
"index": 0
}
]
]
},
"Code - Build HTML": {
"main": [
[
{
"node": "Email Report",
"type": "main",
"index": 0
}
]
]
},
"Snapshot Progress": {
"main": [
[
{
"node": "If - Checking status of Snapshot",
"type": "main",
"index": 0
}
]
]
},
"Check if snapshot ready": {
"main": [
[
{
"node": "Snapshot Content",
"type": "main",
"index": 0
}
],
[
{
"node": "Code - Extract Necessary Data",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "Compare Prices and Generate Report",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Code - Extract Necessary Data": {
"main": [
[
{
"node": "Compare Prices and Generate Report",
"type": "main",
"index": 0
}
]
]
},
"Wait 30s - Polling Bright Data": {
"main": [
[
{
"node": "Snapshot Progress",
"type": "main",
"index": 0
}
]
]
},
"If - Checking status for errors": {
"main": [
[
{
"node": "Error message (replace with webhook/other notifier if needed)",
"type": "main",
"index": 0
}
],
[
{
"node": "Snapshot Content",
"type": "main",
"index": 0
}
]
]
},
"If - Checking status of Snapshot": {
"main": [
[
{
"node": "If - Checking status for errors",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait 30s - Polling Bright Data",
"type": "main",
"index": 0
}
]
]
},
"Code - Check If Snapshot is built": {
"main": [
[
{
"node": "Check if snapshot ready",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Test workflow’": {
"main": [
[
{
"node": "Google Sheets",
"type": "main",
"index": 0
}
]
]
},
"Compare Prices and Generate Report": {
"main": [
[
{
"node": "Markdown",
"type": "main",
"index": 0
}
]
]
},
"Error message (replace with webhook/other notifier if needed)": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 人工智能, 营销
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
Bright Data关键词邮件新闻简报与AI摘要
Bright Data关键词邮件新闻简报与AI摘要
If
Code
Wait
+7
13 节点Gleb D
人工智能
按名称查找Twitter个人资料,抓取帖子并使用AI分析内容,保存到Google Sheets
使用Bright Data和Gemini按名称查找、抓取并分析Twitter帖子
If
Set
Code
+9
22 节点Gleb D
人工智能
(Duc)深度研究市场模板
集成PerplexityAI研究和OpenAI内容的多层级WordPress博客生成器
If
Set
Xml
+28
132 节点Daniel Ng
人工智能
使用Bright Data、Gemini AI和Google Sheets按关键词分析Crunchbase初创公司
使用Bright Data、Gemini AI和Google Sheets按关键词分析Crunchbase初创公司
If
Code
Wait
+7
13 节点Gleb D
人工智能
Indeed公司数据抓取与Airtable、Bright Data和Google Gemini的汇总
使用Airtable、Bright Data和Google Gemini进行Indeed数据抓取与汇总
If
Set
Wait
+11
19 节点Ranjan Dailata
人力资源
WordPress博客自动化专业版(SEO主题)v2
WordPress自动博客专业版 - SEO主题内容自动化机器
If
Set
Xml
+21
63 节点Daniel Ng
人工智能