免费监控竞争对手价格
高级
这是一个AI、Marketing领域的自动化工作流,包含 24 个节点。主要使用 If、Code、Html、Wait、Telegram 等节点,结合人工智能技术实现智能自动化。 使用网络爬虫、Google Sheets 和 Telegram 免费监控竞争对手价格
前置要求
- •Telegram Bot Token
- •可能需要目标 API 的认证凭证
- •Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "QAneGL7LmmVuAy1G",
"meta": {
"instanceId": "028ba340313b331f33c6b8294672985ed6da7581a7cf3e60fb843f4e8b653dae",
"templateCredsSetupCompleted": true
},
"name": "免费监控竞争对手价格",
"tags": [
{
"id": "3ytagip6FSiGNhyx",
"name": "video",
"createdAt": "2025-05-31T12:22:41.809Z",
"updatedAt": "2025-05-31T12:22:41.809Z"
},
{
"id": "AAeX8YOWlYNI5sCL",
"name": "production",
"createdAt": "2025-05-31T12:22:39.329Z",
"updatedAt": "2025-05-31T12:22:39.329Z"
},
{
"id": "xoQDVZ3WQVEfZeAf",
"name": "final",
"createdAt": "2025-05-31T12:22:36.344Z",
"updatedAt": "2025-05-31T12:22:36.344Z"
}
],
"nodes": [
{
"id": "780a213c-0e81-4d95-910e-a467f316ebf6",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2460,
160
],
"parameters": {
"width": 420,
"height": 100,
"content": "**每天服务器时间早上8:00触发,启动价格检查周期。然后读取\"主\"Google Sheets标签页,提取每行的product_url + last_price进行处理**"
},
"typeVersion": 1
},
{
"id": "9b9932ec-8cfd-4096-965b-592b13a1fb8e",
"name": "每日8点触发器",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-2420,
290
],
"parameters": {
"rule": {
"interval": [
{
"triggerAtHour": 8
}
]
}
},
"typeVersion": 1.2
},
{
"id": "6427045b-8b73-42f0-9dcc-768cbfac9c4a",
"name": "从表格获取产品列表",
"type": "n8n-nodes-base.googleSheets",
"position": [
-2200,
290
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/18ZAjxmwanf6MS7JfrEX6ett6J-tOQi58B257hE6sOS4/edit#gid=0",
"cachedResultName": "product_data"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "18ZAjxmwanf6MS7JfrEX6ett6J-tOQi58B257hE6sOS4",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/18ZAjxmwanf6MS7JfrEX6ett6J-tOQi58B257hE6sOS4/edit?usp=drivesdk",
"cachedResultName": "competitor_price_drop_automation"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "qxXfj438qZiGMViE",
"name": "Tony@datahut sheet"
}
},
"typeVersion": 4.5
},
{
"id": "0b4a1398-bb29-4f42-9475-eb08ab4dabfc",
"name": "以每次1个的批次处理每个产品",
"type": "n8n-nodes-base.splitInBatches",
"position": [
-1980,
290
],
"parameters": {
"options": {
"reset": false
}
},
"typeVersion": 3
},
{
"id": "ccf9f9ca-b380-457e-9fc2-c6ffe1636984",
"name": "请求间暂停",
"type": "n8n-nodes-base.wait",
"position": [
-1760,
40
],
"webhookId": "335e69ac-d8ce-4704-a9c6-5a087f2859f8",
"parameters": {
"amount": 20
},
"typeVersion": 1.1
},
{
"id": "aa49653b-cf9f-449b-953d-a9a19ac74187",
"name": "加载产品页面HTML",
"type": "n8n-nodes-base.httpRequest",
"position": [
-1540,
40
],
"parameters": {
"url": "={{ $json.product_url }}",
"options": {},
"jsonHeaders": "{\n \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:119.0) Gecko/20100101 Firefox/119.0\",\n \"Accept\": \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\",\n \"Accept-Language\": \"en-IN,en;q=0.9\",\n \"Accept-Encoding\": \"gzip, deflate, br\"\n}",
"sendHeaders": true,
"specifyHeaders": "json"
},
"typeVersion": 4.2
},
{
"id": "5dbc3d45-96d6-4b71-8d3f-2513f960e265",
"name": "从HTML提取当前价格",
"type": "n8n-nodes-base.html",
"position": [
-1320,
40
],
"parameters": {
"options": {},
"operation": "extractHtmlContent",
"extractionValues": {
"values": [
{
"key": "current_price",
"cssSelector": ".price__regular > span.price-item--regular"
}
]
}
},
"typeVersion": 1.2
},
{
"id": "76ad9683-bae1-4f95-af09-44598d9448d1",
"name": "标准化价格值",
"type": "n8n-nodes-base.code",
"position": [
-1100,
40
],
"parameters": {
"jsCode": "// HTML Extract result\nconst scraped = items[0].json;\n\n// Original data from Wait node\nconst original = $items(\"Pause Between Requests\")[0].json;\n\n// Clean and parse price\nconst priceNum = parseFloat((scraped.current_price || \"\").replace(/[^0-9.]+/g, \"\"));\n\n// Original price from Google Sheet\nconst lastPrice = parseFloat(original.price);\n\nreturn [{\n json: {\n product_url: original.product_url,\n row_number: original.row_number,\n last_price: lastPrice,\n current_price: priceNum\n }\n}];\n\n"
},
"typeVersion": 2
},
{
"id": "5feae925-0642-40d1-89be-c220a5a1c8a2",
"name": "计算价格变化",
"type": "n8n-nodes-base.code",
"position": [
-880,
40
],
"parameters": {
"jsCode": "// Get the incoming item\nconst item = items[0].json;\n\n// Compute whether the price changed\nconst priceChanged = item.last_price !== item.current_price;\n\n// Calculate percentage difference (will be NaN if last_price is null/0)\nlet priceDiffPct = null;\nif (item.last_price && item.last_price !== 0) {\n priceDiffPct = (\n ((item.current_price - item.last_price) / item.last_price) *\n 100\n ).toFixed(2);\n}\n\n// Return everything, including product_url and last_price\nreturn [\n {\n json: {\n product_url: item.product_url,\n last_price: item.last_price,\n current_price: item.current_price,\n price_changed: priceChanged,\n price_diff_pct: priceDiffPct !== null ? parseFloat(priceDiffPct) : null,\n timestamp: new Date().toISOString(),\n },\n },\n];\n\n\n\n"
},
"typeVersion": 2
},
{
"id": "5dea2082-d5c5-4c13-8c71-ab7ac498632d",
"name": "清理解析字段",
"type": "n8n-nodes-base.code",
"position": [
-660,
40
],
"parameters": {
"jsCode": "// Function node: 'items' is an array of incoming items\nif (!items.length) {\n return [];\n}\n\nconst input = items[0].json;\nconst cleaned = {};\n\nfor (const key in input) {\n const cleanKey = key.replace(/\\t/g, '').trim();\n cleaned[cleanKey] = input[key];\n}\n\nreturn [\n {\n json: {\n product_url: cleaned.product_url,\n last_price: cleaned.last_price,\n current_price: cleaned.current_price,\n price_changed: cleaned.price_changed,\n price_diff_pct: cleaned.price_diff_pct,\n timestamp: cleaned.timestamp,\n },\n },\n];\n\n\n"
},
"typeVersion": 2
},
{
"id": "21c27cb9-c6bc-4cc3-9ad1-3d37fc6fbc3d",
"name": "价格是否变化?",
"type": "n8n-nodes-base.if",
"position": [
-440,
40
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "or",
"conditions": [
{
"id": "5e285834-82ef-4c77-b96b-97661760f996",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.price_changed}}",
"rightValue": "true"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "50274daa-48c7-4c58-aaf5-264013582f97",
"name": "构建Telegram警报消息",
"type": "n8n-nodes-base.code",
"position": [
-220,
140
],
"parameters": {
"jsCode": "const itemsFormatted = [];\n\nfor (const item of items) {\n const data = item.json;\n\n // Determine alert type\n const isDrop = data.price_diff_pct < 0;\n const alertType = isDrop ? \"📉 *Price Drop Alert*\" : \"📈 *Price Hike Alert*\";\n\n // Format timestamp to IST\n const date = new Date(data.timestamp);\n const istOffset = 5.5 * 60 * 60 * 1000;\n const istDate = new Date(date.getTime() + istOffset);\n const formattedDate = istDate.toLocaleString(\"en-IN\", {\n day: \"2-digit\",\n month: \"short\",\n year: \"numeric\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n hour12: true\n });\n\n // Build message\n const message = `${alertType}\n\n🛍️ *Product:* (${data.product_url})\n💸 *Last Price:* $${data.last_price}\n💰 *Current Price:* $${data.current_price}\n📊 *Change:* ${data.price_diff_pct > 0 ? \"+\" : \"\"}${data.price_diff_pct}%\n🕒 *Time:* ${formattedDate}`;\n\n itemsFormatted.push({ json: { message } });\n}\n\nreturn itemsFormatted;\n\n\n"
},
"typeVersion": 2
},
{
"id": "f62b1f32-fe79-43c3-ad17-0ff31fcdc489",
"name": "记录价格历史到表格",
"type": "n8n-nodes-base.googleSheets",
"position": [
-220,
-60
],
"parameters": {
"columns": {
"value": {
"last_price": "={{ $json.last_price }}",
"timestamp\t": "={{ new Date($json.timestamp).toLocaleString('en-IN', {\n timeZone: 'Asia/Kolkata',\n day: '2-digit',\n month: 'short',\n year: 'numeric',\n hour: '2-digit',\n minute: '2-digit',\n hour12: true\n}) }}\n",
"product_url": "={{ $json.product_url }}",
"current_price": "={{ $json.current_price }}",
"price_diff_pct": "={{ $json.price_diff_pct}}",
"price_changed ": "={{ $json.price_changed }}"
},
"schema": [
{
"id": "timestamp\t",
"type": "string",
"display": true,
"required": false,
"displayName": "timestamp\t",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "product_url",
"type": "string",
"display": true,
"required": false,
"displayName": "product_url",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "current_price",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "current_price",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "last_price",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "last_price",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "price_changed ",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "price_changed ",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "price_diff_pct",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "price_diff_pct",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {
"useAppend": true
},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 2110110902,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/18ZAjxmwanf6MS7JfrEX6ett6J-tOQi58B257hE6sOS4/edit#gid=2110110902",
"cachedResultName": "price_tracking"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "18ZAjxmwanf6MS7JfrEX6ett6J-tOQi58B257hE6sOS4",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/18ZAjxmwanf6MS7JfrEX6ett6J-tOQi58B257hE6sOS4/edit?usp=drivesdk",
"cachedResultName": "competitor_price_drop_automation"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "qxXfj438qZiGMViE",
"name": "Tony@datahut sheet"
}
},
"typeVersion": 4.5
},
{
"id": "d5555b69-d7ee-4ab0-a851-5288de0d39cf",
"name": "更新表格前暂停",
"type": "n8n-nodes-base.wait",
"position": [
0,
-60
],
"webhookId": "f8ba192a-211d-4b40-be9c-9994343eb162",
"parameters": {
"unit": "minutes",
"amount": 1
},
"typeVersion": 1.1
},
{
"id": "ade41bb7-fbe3-4e08-a7fa-6c85291dc9fa",
"name": "在主表格中更新最后价格",
"type": "n8n-nodes-base.googleSheets",
"position": [
220,
-60
],
"parameters": {
"columns": {
"value": {
"price": "={{ $json.current_price }}",
"product_url": "={{ $json.product_url }}"
},
"schema": [
{
"id": "product_url",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "product_url",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "price",
"type": "string",
"display": true,
"required": false,
"displayName": "price",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "string",
"display": true,
"removed": true,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"product_url"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/18ZAjxmwanf6MS7JfrEX6ett6J-tOQi58B257hE6sOS4/edit#gid=0",
"cachedResultName": "product_data"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "18ZAjxmwanf6MS7JfrEX6ett6J-tOQi58B257hE6sOS4",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/18ZAjxmwanf6MS7JfrEX6ett6J-tOQi58B257hE6sOS4/edit?usp=drivesdk",
"cachedResultName": "competitor_price_drop_automation"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "qxXfj438qZiGMViE",
"name": "Tony@datahut sheet"
}
},
"typeVersion": 4.5
},
{
"id": "9ebdbe49-fda1-42f5-99d9-a5e1e3ab800f",
"name": "通过Telegram发送价格警报",
"type": "n8n-nodes-base.telegram",
"position": [
0,
215
],
"webhookId": "39287ce3-3a7e-4c7e-b8ee-b11ebb83bfb8",
"parameters": {
"text": "={{$json[\"message\"]}}",
"chatId": "7739958732",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "aoNA5zsMeU9KNpGg",
"name": "Telegram Tab Jio"
}
},
"typeVersion": 1.2
},
{
"id": "dcb4eff8-9d44-4016-a89a-787be943d0e9",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2040,
440
],
"parameters": {
"height": 100,
"content": "**以分组方式迭代所有产品(例如每次1个),以免用并行请求压垮目标网站**"
},
"typeVersion": 1
},
{
"id": "1a306c68-e652-4d63-b11e-96366c4a59ed",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1560,
-60
],
"parameters": {
"width": 360,
"height": 80,
"content": "**为每个product_url触发HTTP GET请求,然后使用CSS选择器从返回的HTML中提取实时价格文本**"
},
"typeVersion": 1
},
{
"id": "81f8701a-219f-43a3-aceb-78f2298273cc",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1120,
180
],
"parameters": {
"width": 380,
"height": 100,
"content": "**去除货币符号/逗号将字符串转换为数字;比较last_price与current_price以计算百分比变化,如果不同则设置price_changed=true**"
},
"typeVersion": 1
},
{
"id": "7fd2108e-5fcb-4ba6-938b-6c940f8a305f",
"name": "便签5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-740,
-100
],
"parameters": {
"width": 220,
"height": 120,
"content": "**移除杂散空格或格式错误的键(例如杂散制表符),以便下游节点能一致读取字段**"
},
"typeVersion": 1
},
{
"id": "7a525b63-e871-46b9-b0b0-4e25a6c7f2bb",
"name": "便签 6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-540,
180
],
"parameters": {
"height": 100,
"content": "**只有price_changed=true的产品会继续进入警报和记录流程;未变化的项目在此退出**"
},
"typeVersion": 1
},
{
"id": "a6352172-9fa3-47b7-8bf0-c948fbe03701",
"name": "便签7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-180,
420
],
"parameters": {
"width": 380,
"height": 80,
"content": "**格式化人类可读的消息(产品名称/URL、新旧价格、百分比变化、时间戳)并将其推送到配置的Telegram聊天**"
},
"typeVersion": 1
},
{
"id": "90b702f6-6e75-452d-9315-3f70c4157aab",
"name": "## 为什么选择 4o 模型?👆",
"type": "n8n-nodes-base.stickyNote",
"position": [
-200,
-160
],
"parameters": {
"width": 520,
"height": 80,
"content": "**向Price_History追加一行,包含时间戳、百分比变化、新旧价格;然后在主表格中用current_price覆盖last_price前等待1分钟**"
},
"typeVersion": 1
},
{
"id": "3e3a4498-248d-408e-903b-916a035db039",
"name": "便签 9",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1300,
-520
],
"parameters": {
"width": 580,
"content": "## 此自动化的详细说明"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "2c1bce5e-8208-42c3-8fe8-308b5855695c",
"connections": {
"Is Price Changed?": {
"main": [
[
{
"node": "Build Telegram Alert Message",
"type": "main",
"index": 0
},
{
"node": "Log Price History to Sheet",
"type": "main",
"index": 0
}
]
]
},
"Daily 8 AM Trigger": {
"main": [
[
{
"node": "Fetch Product List from Sheet",
"type": "main",
"index": 0
}
]
]
},
"Compute Price Change": {
"main": [
[
{
"node": "Clean Up Parsed Fields",
"type": "main",
"index": 0
}
]
]
},
"Clean Up Parsed Fields": {
"main": [
[
{
"node": "Is Price Changed?",
"type": "main",
"index": 0
}
]
]
},
"Load Product Page HTML": {
"main": [
[
{
"node": "Extract Current Price from HTML",
"type": "main",
"index": 0
},
{
"node": "Process Each Product in Batches of 1",
"type": "main",
"index": 0
}
]
]
},
"Normalize Price Values": {
"main": [
[
{
"node": "Compute Price Change",
"type": "main",
"index": 0
}
]
]
},
"Pause Between Requests": {
"main": [
[
{
"node": "Load Product Page HTML",
"type": "main",
"index": 0
}
]
]
},
"Log Price History to Sheet": {
"main": [
[
{
"node": "Pause Before Updating Sheet",
"type": "main",
"index": 0
}
]
]
},
"Pause Before Updating Sheet": {
"main": [
[
{
"node": "Update Last Price in Master Sheet",
"type": "main",
"index": 0
}
]
]
},
"Build Telegram Alert Message": {
"main": [
[
{
"node": "Send Price Alert via Telegram",
"type": "main",
"index": 0
}
]
]
},
"Fetch Product List from Sheet": {
"main": [
[
{
"node": "Process Each Product in Batches of 1",
"type": "main",
"index": 0
}
]
]
},
"Send Price Alert via Telegram": {
"main": [
[
{
"node": "Process Each Product in Batches of 1",
"type": "main",
"index": 0
}
]
]
},
"Extract Current Price from HTML": {
"main": [
[
{
"node": "Normalize Price Values",
"type": "main",
"index": 0
}
]
]
},
"Process Each Product in Batches of 1": {
"main": [
[],
[
{
"node": "Pause Between Requests",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
这是一个高级难度的工作流,适用于AI、Marketing等场景。适合高级用户,包含 16+ 个节点的复杂工作流
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
使用GPT-4o、WordPress和LinkedIn发布自动化RSS内容到博客文章
使用GPT-4o、WordPress和LinkedIn发布自动化RSS内容到博客文章
If
Set
Code
+21
40 节点Immanuel
AI
Linkedin 自动化 - Archit Jain
使用 GPT-4 和 Google Sheets 从 Twitter AI 帖子自动创建 LinkedIn 内容
Code
Wait
Limit
+15
35 节点Archit Jain
AI
(Duc)深度研究市场模板
集成PerplexityAI研究和OpenAI内容的多层级WordPress博客生成器
If
Set
Xml
+28
132 节点Daniel Ng
AI
🏤 欧盟事件抓取与 Google Sheets
🏤 使用 Google Sheets 抓取欧盟事件
If
Set
Code
+8
20 节点Samir Saci
AI
🗞️ AI驱动的可持续性营销简报(使用Gmail、GPT-4o)
🗞️ AI驱动的可持续性营销简报(使用Gmail、GPT-4o)
If
Set
Code
+12
21 节点Samir Saci
AI
AI自动化TikTok/Youtube短视频/Reels生成器
基于AI的短视频生成器,集成OpenAI、Flux、Kling和ElevenLabs
If
Set
Code
+9
41 节点Cameron Wills
AI
工作流信息
难度等级
高级
节点数量24
分类2
节点类型10
作者
Tony Paul
@tonydatahutTony Paul is the founder of Datahut, a web-scraping and data-automation company he started over a decade ago. With 14+ years of hands-on experience working with ecommerce companies helping them automate data collection, pricing , advertisement and more. Use the templates for free and if you need help to scale up - contact using the link below
外部链接
在 n8n.io 上查看 →
分享此工作流