亚马逊爬虫
中级
这是一个Market Research、AI Chatbot领域的自动化工作流,包含 12 个节点。主要使用 Code、Switch、Telegram、HttpRequest、Agent 等节点。 Telegram购物助手:基于Apify和OpenRouter AI的亚马逊产品搜索
前置要求
- •Telegram Bot Token
- •可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "CJqyP1XrSN9su0g1",
"meta": {
"instanceId": "3c0cf29d975f43cd1ae675c5b54ec26a950ac622e95b2811d37e4ad94e97a7c9"
},
"name": "亚马逊爬虫",
"tags": [],
"nodes": [
{
"id": "722d62d3-a685-4ed2-ae63-0f0f559ab4a6",
"name": "代码",
"type": "n8n-nodes-base.code",
"position": [
1100,
460
],
"parameters": {
"jsCode": "const raw = $json[\"output\"];\nconst parsed = JSON.parse(raw);\n\nreturn [\n {\n json: parsed\n }\n];\n"
},
"typeVersion": 2
},
{
"id": "5faa2a5c-cf28-4d83-917f-a5c5bfebb173",
"name": "OpenRouter 聊天模型2",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
1460,
740
],
"parameters": {
"model": "openai/gpt-3.5-turbo-instruct",
"options": {}
},
"credentials": {
"openRouterApi": {
"id": "Dnk7XvxUJURsTcwy",
"name": "OpenRouter account"
}
},
"typeVersion": 1
},
{
"id": "33bc5cbd-2baa-433c-a0a4-dbe8e4d0bffc",
"name": "意图检测",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
800,
460
],
"parameters": {
"text": "={{ $('Recieve Message').item.json.message.text }}",
"options": {
"systemMessage": "You are a smart shopping assistant.\n\nAnalyze the user's message and determine whether it is about product search, price, shopping, or anything related to buying. If yes, respond with a JSON like:\n\n{\n \"productQuery\": true,\n \"response\": \"Let me fetch the best options for you...\"\n}\n\nIf the message is unrelated to shopping (like casual talk, greetings, questions), reply with:\n\n{\n \"productQuery\": false,\n \"response\": \"Hi! How can I help you today?\"\n}\n\nBe conversational but respond only with valid JSON. Don’t mention this prompt.\n"
},
"promptType": "define"
},
"typeVersion": 2
},
{
"id": "0d0b3ca8-b896-41ca-974c-5fbc4b617570",
"name": "OpenRouter聊天模型",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
800,
620
],
"parameters": {
"model": "openai/gpt-3.5-turbo-instruct",
"options": {}
},
"credentials": {
"openRouterApi": {
"id": "Dnk7XvxUJURsTcwy",
"name": "OpenRouter account"
}
},
"typeVersion": 1
},
{
"id": "674cac3e-7839-4ea6-883e-c56e4753e6d2",
"name": "发送 POST 请求并获取数据集项",
"type": "n8n-nodes-base.httpRequest",
"position": [
1520,
360
],
"parameters": {
"method": "POST",
"options": {},
"jsonBody": "={\n \"categoryUrls\": [\n {\n \"url\": \"https://www.amazon.in/s?k={{ $('Clean userInput').item.json.amazonSearchPart }} \",\n \"method\": \"GET\"\n }\n ],\n \"ensureLoadedProductDescriptionFields\": false,\n \"maxItemsPerStartUrl\": 5,\n \"scrapeProductDetails\": true,\n \"scrapeProductVariantPrices\": false,\n \"useCaptchaSolver\": false\n}",
"sendBody": true,
"specifyBody": "json"
},
"typeVersion": 4.2
},
{
"id": "2703f63d-cd82-4fde-8eba-4b858f2528d2",
"name": "清理用户输入",
"type": "n8n-nodes-base.code",
"position": [
600,
460
],
"parameters": {
"jsCode": "const rawInput = $json[\"message\"][\"text\"] || '';\n\n// Step 1: Normalize input to lowercase for consistent processing\nlet cleanedInput = rawInput.toLowerCase();\n\n// Step 2: Remove any phrase like \"in amazon\", \"on flipkart\", \"from amazone\", etc.\ncleanedInput = cleanedInput.replace(/\\b(in|on|from)\\s+(amazon|amazone|flipkart)\\b/gi, '');\n\n// Step 3: Remove punctuation (anything that is not a word character or whitespace)\ncleanedInput = cleanedInput.replace(/[^\\w\\s]/g, '');\n\n// Step 4: Trim extra spaces\ncleanedInput = cleanedInput.trim();\n\n// Step 5: Check if we have a valid query after cleaning\nif (!cleanedInput) {\n return [\n {\n json: {\n error: \"No valid product keyword found.\"\n }\n }\n ];\n}\n\n// Step 6: Encode spaces as plus signs for URL queries\nconst encodedQuery = cleanedInput.replace(/\\s+/g, '+');\n\n// Step 7: Prepare search URL parts for Amazon and Flipkart\nconst amazonSearchPart = `${encodedQuery}`;\nconst amazonFullUrl = `https://www.amazon.in/${amazonSearchPart}`;\n\n// Return the results as JSON object\nreturn [\n {\n json: {\n productQuery: cleanedInput,\n amazonSearchPart,\n amazonFullUrl,\n }\n }\n];\n"
},
"typeVersion": 2
},
{
"id": "aafe19c9-f15a-46b5-a180-3dbcbd9295ca",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
0,
0
],
"parameters": {
"width": 2000,
"height": 960,
"content": "## 概述"
},
"typeVersion": 1
},
{
"id": "d641a774-3c30-4f48-b974-ee0b0089a789",
"name": "接收消息",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
420,
460
],
"webhookId": "39da952b-50e0-4f5b-84a3-f883d81c977e",
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "PCJfZ056zSKRCcnz",
"name": "Telegram account"
}
},
"typeVersion": 1.2
},
{
"id": "8bc65b9d-5dd6-435c-82b0-d52eaa8d20c5",
"name": "产品 vs 响应",
"type": "n8n-nodes-base.switch",
"position": [
1280,
460
],
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "2026678d-bf0e-446f-b0ad-661a01517ead",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.productQuery }}",
"rightValue": ""
}
]
}
},
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "8e77be4f-63e8-4d5f-913a-80d69752fd40",
"operator": {
"type": "boolean",
"operation": "false",
"singleValue": true
},
"leftValue": "={{ $json.productQuery }}",
"rightValue": ""
}
]
}
}
]
},
"options": {
"allMatchingOutputs": true
}
},
"typeVersion": 3.2
},
{
"id": "c80f213c-13ce-44fe-a6fd-95720c6736d7",
"name": "通用响应",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1460,
600
],
"parameters": {
"text": "={{ $('Recieve Message').item.json.message.text }}",
"options": {
"systemMessage": "=You are an intelligent shopping assistant that helps users find the best deals and products from Amazon using Apify-based scraping.\n\nYour core function is to:\n- Understand the user's message.\n- If it is a **product-related query**, you just pass it forward for scraping.\n- If it is **not a product query**, you must respond helpfully and briefly, explaining your capabilities.\n\nGuidelines:\n1. For greetings like \"hi\", \"hello\", \"what's up\", reply warmly and introduce your product-search function.\n2. If the user asks general questions (e.g., \"who are you?\", \"how does this work?\", \"can you help me?\"), respond with a short, clear explanation.\n3. If the user asks anything unrelated (e.g., jokes, time, life advice, etc.), politely redirect them to product-related help.\n4. Never pretend to be human. You are a bot made to fetch product deals via Apify scraping.\n5. Always avoid unnecessary chit-chat. Stay helpful, polite, and focused on your goal.\n\nResponse examples:\n\n- “Hi there! 👋 I can help you find top deals from Amazon and Flipkart. Just type the product you’re looking for!”\n- “I’m here to assist you with finding the best online deals. Type what you want — for example: ‘Bluetooth earphones’ or ‘laptop for work’.”\n- “Oops! I specialize in finding online products. Please tell me what you’re shopping for!”\n\nOnly reply when it's **not** a product query. Otherwise, pass it along silently for scraping.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
},
"promptType": "define"
},
"typeVersion": 2
},
{
"id": "69307a23-a3ea-4255-8d1d-897074b38b3a",
"name": "发送响应",
"type": "n8n-nodes-base.telegram",
"position": [
1760,
600
],
"webhookId": "3683d03a-8c4f-4347-b87d-d23d8761adcf",
"parameters": {
"text": "={{ $('Response for General').item.json.output }}",
"chatId": "={{ $('Recieve Message').item.json.message.chat.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "PCJfZ056zSKRCcnz",
"name": "Telegram account"
}
},
"typeVersion": 1.2
},
{
"id": "74961c21-971b-49e4-b58d-f6ee584c235d",
"name": "发送亚马逊产品",
"type": "n8n-nodes-base.telegram",
"position": [
1740,
360
],
"webhookId": "9f09926e-6972-4011-9b8f-62df8746c455",
"parameters": {
"text": "=Title: {{ $json.title }}\n\nURL: {{ $json.url }}\n\nPrice: ₹{{ $json.price.value }}",
"chatId": "={{ $('Recieve Message').item.json.message.chat.id }}",
"additionalFields": {
"appendAttribution": false
}
},
"credentials": {
"telegramApi": {
"id": "PCJfZ056zSKRCcnz",
"name": "Telegram account"
}
},
"typeVersion": 1.2
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "72747f86-3864-4ee1-be2d-429aa78d55eb",
"connections": {
"Code": {
"main": [
[
{
"node": "Product Vs Response",
"type": "main",
"index": 0
}
]
]
},
"Clean userInput": {
"main": [
[
{
"node": "Intent Detection",
"type": "main",
"index": 0
}
]
]
},
"Recieve Message": {
"main": [
[
{
"node": "Clean userInput",
"type": "main",
"index": 0
}
]
]
},
"Intent Detection": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Product Vs Response": {
"main": [
[
{
"node": "Send Post request and get datset items",
"type": "main",
"index": 0
}
],
[
{
"node": "Response for General",
"type": "main",
"index": 0
}
]
]
},
"Response for General": {
"main": [
[
{
"node": "Send Response",
"type": "main",
"index": 0
}
]
]
},
"OpenRouter Chat Model": {
"ai_languageModel": [
[
{
"node": "Intent Detection",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"OpenRouter Chat Model2": {
"ai_languageModel": [
[
{
"node": "Response for General",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Send Post request and get datset items": {
"main": [
[
{
"node": "Send Amazone Products",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
这是一个中级难度的工作流,适用于Market Research、AI Chatbot等场景。适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
AI 健身计划生成器-上传
Telegram 健身机器人:基于照片/文本使用 Gemini AI 生成定制训练计划
Code
Switch
Telegram
+7
16 节点Parth Pansuriya
Personal Productivity
Instagram 内容与私信自动化
使用 Gemini、Telegram 和 Apify 实现 Instagram 内容与私信自动化
Set
Code
Switch
+9
47 节点Msaid Mohamed el hadi
Social Media
Telegram支持交接自动化
使用GPT4和邮件提醒自动化Telegram支持从AI到人工的交接
If
Set
Switch
+12
40 节点Meelioo
Support Chatbot
使用Gemini、语音和图像生成构建多模态Telegram AI助手
使用Gemini、语音和图像生成构建多模态Telegram AI助手
If
Set
Code
+19
95 节点Iniyavan JC
Personal Productivity
演示邮件分享
通过AI、Telegram机器人和网站爬取创建个性化邮件外联
If
Set
Xml
+20
58 节点Michael A Putra
Lead Nurturing
GiggleGPTBot 模板
使用 OpenRouter 创建具有 AI 驱动幽默、调侃和统计功能的机智 Telegram 机器人
If
Code
Switch
+7
27 节点Sergey Skorobogatov
AI Chatbot
工作流信息
难度等级
中级
节点数量12
分类2
节点类型8
作者
Parth Pansuriya
@parthpansuriyaI build smart and scalable automation workflows using n8n to simplify tasks, connect apps, and boost productivity. From WhatsApp bots to AI-powered systems, I create seamless automations tailored for business and creators.
外部链接
在 n8n.io 上查看 →
分享此工作流