8
n8n 中文网amn8n.com

我的工作流11

中级

这是一个Market Research领域的自动化工作流,包含 11 个节点。主要使用 If, Set, Code, Wait, SplitOut 等节点。 通过RapidAPI批量导出亚马逊产品评论到Google Sheets

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "UXqw9glm6hQ45Yxz",
  "meta": {
    "instanceId": "36fee986cc83112881fb12ec7cc2d0221d7bddd71c11715c196899b114e8b0d2"
  },
  "name": "我的工作流 11",
  "tags": [],
  "nodes": [
    {
      "id": "85865a9c-c8db-48fc-be37-e44b9488ca83",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1392,
        640
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "7bf88274-96e0-47fe-830b-81b894fce53a",
      "name": "等待1",
      "type": "n8n-nodes-base.wait",
      "position": [
        1616,
        400
      ],
      "webhookId": "eeca318b-8f89-47c5-aaa0-ab4e6c88ab19",
      "parameters": {
        "amount": 3.7
      },
      "typeVersion": 1.1
    },
    {
      "id": "b98f4bf4-1a89-4e3e-bab1-b27730797d43",
      "name": "等待2",
      "type": "n8n-nodes-base.wait",
      "position": [
        2288,
        496
      ],
      "webhookId": "bca3f33a-5dc6-42c7-b05b-8430f194b32d",
      "parameters": {
        "amount": 60
      },
      "typeVersion": 1.1
    },
    {
      "id": "875c965f-fcbb-476f-9d53-3ff0a7a2dcdb",
      "name": "拆分评论",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        2288,
        304
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "data.reviews"
      },
      "typeVersion": 1
    },
    {
      "id": "482ca5b2-a96a-49b3-bf8b-656b1973dcfc",
      "name": "如果状态为\"OK\"且包含评论",
      "type": "n8n-nodes-base.if",
      "position": [
        2064,
        400
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "264bc7f0-0b3a-412c-b7fd-de676e20442b",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{$json.status == 'OK'}}",
              "rightValue": "="
            },
            {
              "id": "5827107b-d356-4672-9adf-505c86c09989",
              "operator": {
                "type": "array",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.data.reviews }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "ca6e3a19-8678-4fcd-9af3-bd730b827735",
      "name": "存储评论",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2512,
        464
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "url",
          "value": "={{ $('On form submission').item.json[\"Tab URL to insert reviews\"] }}"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1XsPm7V9cf9jufJ6flUXTVO2Kzaj_KOyl1_h7AZTomCM",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1XsPm7V9cf9jufJ6flUXTVO2Kzaj_KOyl1_h7AZTomCM/edit?usp=drivesdk",
          "cachedResultName": "Amazon Reviews Database"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "wOT0EGRAXG51Ihtb",
          "name": "Google Sheets account (Augra)"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "f92603d0-4224-4cab-9740-903edd0f0189",
      "name": "HTTP 请求",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        1840,
        400
      ],
      "parameters": {
        "url": "https://real-time-amazon-data.p.rapidapi.com/product-reviews",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "country",
              "value": "={{ $json.country }}"
            },
            {
              "name": "asin",
              "value": "={{ $json.asin }}"
            },
            {
              "name": "page",
              "value": "={{ $json.page }}"
            },
            {
              "name": "sort_by",
              "value": "={{ $json.sort_by }}"
            },
            {
              "name": "star_rating",
              "value": "={{ $json.star_rating }}"
            },
            {
              "name": "verified_purchases_only",
              "value": "true"
            },
            {
              "name": "images_or_videos_only",
              "value": "false"
            },
            {
              "name": "current_format_only",
              "value": "false"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "real-time-amazon-data.p.rapidapi.com"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "pbRNzyVKUKmlfaEd",
          "name": "(Nateskin) Real-Time Amazon Data"
        }
      },
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "b14a05fb-024d-4209-a779-9621e5f61172",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        720,
        640
      ],
      "webhookId": "3d70d5ff-d975-4b50-8a3e-315d6a4b6110",
      "parameters": {
        "options": {},
        "formTitle": "Amazon Product Reviews Scraper",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Brand name",
              "placeholder": "MANSCAPED",
              "requiredField": true
            },
            {
              "fieldLabel": "Product / Model Name",
              "placeholder": "The Lawn Mower® 3.0 Plus ",
              "requiredField": true
            },
            {
              "fieldLabel": "Amazon Product URL",
              "placeholder": "https://www.amazon.com/MANSCAPED%C2%AE-Lawn-Mower%C2%AE-Groin-Trimmer/dp/B0CQB9Y9LR?th=1",
              "requiredField": true
            },
            {
              "fieldLabel": "Tab URL to insert reviews",
              "placeholder": "https://docs.google.com/spreadsheets/d/1XsPm7V9cf9jufJ6flUXTVO2Kzaj_KOyl1_h7AZTomCM/edit?gid=1804331607#gid=1804331607",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Which brand's feedback would you like to research on?"
      },
      "typeVersion": 2.2
    },
    {
      "id": "1d5e0f0e-6bfc-44ed-98b9-41f9f942e283",
      "name": "设置常量",
      "type": "n8n-nodes-base.set",
      "position": [
        944,
        640
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "76a26d62-f4ef-4e23-9b38-6d48a857b6a4",
              "name": "asin",
              "type": "string",
              "value": "={{ $json[\"Amazon Product URL\"].match(/\\/dp\\/([A-Z0-9]{10})/)[1] }}"
            },
            {
              "id": "3eaff8f4-2c95-4571-b55f-724c2a65dd5c",
              "name": "country",
              "type": "string",
              "value": "US"
            },
            {
              "id": "1f7c745d-cbcd-4cc0-9135-82d8b1579108",
              "name": "brand_name",
              "type": "string",
              "value": "={{ $json['Brand name'] }}"
            },
            {
              "id": "9a106cd5-b43a-4015-8237-ecb7ce4f9e3d",
              "name": "product_name",
              "type": "string",
              "value": "={{ $json['Product / Model Name'] }}"
            },
            {
              "id": "50fbc48b-6485-44a1-b486-fad58c2783d1",
              "name": "last_scraped",
              "type": "string",
              "value": "={{ $json.submittedAt }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7ff1aa7b-a2f2-49a0-932f-8a828199b249",
      "name": "构建参数集",
      "type": "n8n-nodes-base.code",
      "onError": "continueErrorOutput",
      "position": [
        1168,
        640
      ],
      "parameters": {
        "jsCode": "const asin          = $input.first().json.asin;\nconst country       = $input.first().json.country;\n\nconst items = [];\n\n// 1. Core harvest  (50 calls)\n['1_STARS','2_STARS','3_STARS','4_STARS','5_STARS'].forEach(rating => {\n  for (let page=1; page<=10; page++) {\n    items.push({ asin, country, star_rating: rating,\n                 sort_by: 'MOST_RECENT', page });\n  }\n});\n\n// 3. Spotlight extremes  (20 calls)\n['1_STARS','5_STARS'].forEach(rating => {\n  for (let page=1; page<=10; page++) {\n    items.push({ asin, country, star_rating: rating,\n                 sort_by: 'TOP_REVIEWS', page });\n  }\n});\n\nreturn items.map(i => ({json: i}));\n"
      },
      "typeVersion": 2
    },
    {
      "id": "222653cb-0c94-4b9e-885b-ef3003790fa9",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 576,
        "height": 1472,
        "content": "## 🧾 Amazon 产品评论爬取器 - 用户手册"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "3b3852dc-5ca6-4ac2-81c1-0a128538416e",
  "connections": {
    "Wait1": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait2": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "If status \"OK\" and contains reviews",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Constants": {
      "main": [
        [
          {
            "node": "Build Parameter Sets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store reviews": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Reviews": {
      "main": [
        [
          {
            "node": "Store reviews",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Set Constants",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Parameter Sets": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If status \"OK\" and contains reviews": {
      "main": [
        [
          {
            "node": "Split Out Reviews",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 市场调研

需要付费吗?

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

工作流信息
难度等级
中级
节点数量11
分类1
节点类型10
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Hunyao

Hunyao

@hun-yao

Hun Yao is a founder-engineer obsessed with building scalable automation that actually moves the needle - with a focus in the E-commerce space. A self-taught product builder with roots in marketing and AI, he uses n8n as his playground to ship MVPs fast - turning modular workflows into elegant, revenue-generating systems.

外部链接
在 n8n.io 查看

分享此工作流