8
n8n 中文网amn8n.com

使用 Bright Data 和 Google Sheets 监控亚马逊产品价格

中级

这是一个AI, Marketing领域的自动化工作流,包含 15 个节点。主要使用 Wait, Switch, Aggregate, HttpRequest, GoogleSheets 等节点,结合人工智能技术实现智能自动化。 使用 Bright Data 和 Google Sheets 监控亚马逊产品价格

前置要求
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "4e6be3a68285934388a854ac0ffdc5e5500688d5cdb88d0ec2d734e85f097355",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "0e56a2f3-4977-498b-9434-e10b717779b9",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        160,
        -1400
      ],
      "webhookId": "cea23372-8fb1-44e5-baa5-a58aa42b6db0",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "88ac7caa-6408-4b4b-96ef-b5b575da9d52",
      "name": "由 Github 模型提供支持",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -800,
        -840
      ],
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "170b1458-07a1-4295-af4b-c87022eef71c",
      "name": "通过快照 ID 检查状态",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        380,
        -1400
      ],
      "parameters": {
        "url": "=https://api.brightdata.com/datasets/v3/progress/{{ $json.snapshot_id }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "MR4HBU5dH9phpxNO",
          "name": "Bright Data API Key"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "9c020893-da19-48b1-8816-594bed76ae16",
      "name": "获取数据",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1180,
        -1400
      ],
      "parameters": {
        "url": "=https://api.brightdata.com/datasets/v3/snapshot/{{ $json.snapshot_id }}",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "format",
              "value": "json"
            }
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "MR4HBU5dH9phpxNO",
          "name": "Bright Data API Key"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "02f3e1e6-55af-4472-999b-9a656ba8c76f",
      "name": "从 URL 发起请求",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        440,
        -700
      ],
      "parameters": {
        "url": "https://api.brightdata.com/datasets/v3/trigger",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ $json.data.map(i => {\nreturn {url:i['Product URL'],\nzipcode: i['ZIP code']\n}\n}).toJsonString() }}",
        "sendBody": true,
        "sendQuery": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "dataset_id",
              "value": "gd_l7q7dkf244hwjntr0"
            },
            {
              "name": "include_errors",
              "value": "true"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {}
          ]
        }
      },
      "credentials": {
        "brightdataApi": {
          "id": "DQaiy0yJ0lNutzIl",
          "name": "BrightData account"
        },
        "httpBearerAuth": {
          "id": "MR4HBU5dH9phpxNO",
          "name": "Bright Data API Key"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "ecf9d3e8-5435-4426-a82b-b5dd6ff85e86",
      "name": "从 Google 表格读取数据",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -420,
        -840
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1-cX3l_oxylIH2J8rzC-LN0XmFoOOXjJGW0bUe-4bsAw/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1-cX3l_oxylIH2J8rzC-LN0XmFoOOXjJGW0bUe-4bsAw",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1-cX3l_oxylIH2J8rzC-LN0XmFoOOXjJGW0bUe-4bsAw/edit?usp=drivesdk",
          "cachedResultName": "Sample Amazon Products Monitoring"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "TB3Rn9lCQhQ5vKyg",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "c079c769-406e-43d0-9f41-11db53da340f",
      "name": "按每批 10 个处理 URL",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        20,
        -720
      ],
      "parameters": {
        "options": {},
        "batchSize": 10
      },
      "typeVersion": 3
    },
    {
      "id": "89930387-958b-48c3-8583-8f2aac59718b",
      "name": "合并批次",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        240,
        -720
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "8ad0c86a-5107-4ccc-b2d6-e4dda7c98b4f",
      "name": "按 ASIN 更新记录",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1520,
        -1400
      ],
      "parameters": {
        "columns": {
          "value": {
            "ASIN": "={{ $json.asin }}",
            "Price": "={{ $json.final_price }}"
          },
          "schema": [
            {
              "id": "Product URL",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Product URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Price",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Product Title",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Product Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ZIP code",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "ZIP code",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ASIN",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "ASIN",
              "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": [
            "ASIN"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1-cX3l_oxylIH2J8rzC-LN0XmFoOOXjJGW0bUe-4bsAw/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1-cX3l_oxylIH2J8rzC-LN0XmFoOOXjJGW0bUe-4bsAw",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1-cX3l_oxylIH2J8rzC-LN0XmFoOOXjJGW0bUe-4bsAw/edit?usp=drivesdk",
          "cachedResultName": "Sample Amazon Products Monitoring"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "TB3Rn9lCQhQ5vKyg",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "636aa558-8973-4493-8788-f566edf5021b",
      "name": "检查快照状态",
      "type": "n8n-nodes-base.switch",
      "position": [
        620,
        -1400
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a2198ad8-e1ae-411d-8c6b-38e74b727560",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "ready"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "b8fa19aa-f90c-4da5-a039-9962f2a34776",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "running"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "920f766f-2815-46c9-bd24-30d6f4490c58",
      "name": "请求间隔 1 秒",
      "type": "n8n-nodes-base.wait",
      "position": [
        660,
        -660
      ],
      "webhookId": "ec33605d-d09e-4309-9c8f-10c5128677a2",
      "parameters": {
        "amount": 1
      },
      "typeVersion": 1.1
    },
    {
      "id": "1d79897c-2139-4579-b86e-d9b0bea9e0bc",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -840,
        -1080
      ],
      "parameters": {
        "color": 4,
        "width": 700,
        "height": 460,
        "content": "## 计划与从 Google 表格读取"
      },
      "typeVersion": 1
    },
    {
      "id": "9e8866c2-8ae1-467f-a6fb-ce0d1a9e1ac5",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -860
      ],
      "parameters": {
        "color": 5,
        "width": 940,
        "height": 460,
        "content": "## 将数据分批处理到 Bright Data"
      },
      "typeVersion": 1
    },
    {
      "id": "b894627b-e326-40a8-8656-db4e1c18a8d2",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        -1540
      ],
      "parameters": {
        "width": 740,
        "height": 460,
        "content": "## 使用快照 ID 检查从 Bright Data 请求的数据"
      },
      "typeVersion": 1
    },
    {
      "id": "5439d333-922f-4a6f-a391-6963f57be0be",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1060,
        -1540
      ],
      "parameters": {
        "color": 3,
        "width": 720,
        "height": 460,
        "content": "## 从快照获取数据并更新到 Google 表格"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Check Status by Snapshot ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get the data": {
      "main": [
        [
          {
            "node": "Update the records by ASIN",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Read data from Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine the batch": {
      "main": [
        [
          {
            "node": "Initiate request from URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Initiate request from URLs": {
      "main": [
        [
          {
            "node": "Space the request by 1 second",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Status by Snapshot ID": {
      "main": [
        [
          {
            "node": "Check the status of snapshot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read data from Google Sheet": {
      "main": [
        [
          {
            "node": "Process URLs by batch of 10s",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check the status of snapshot": {
      "main": [
        [
          {
            "node": "Get the data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process URLs by batch of 10s": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Combine the batch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Space the request by 1 second": {
      "main": [
        [
          {
            "node": "Process URLs by batch of 10s",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

中级 - 人工智能, 营销

需要付费吗?

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

工作流信息
难度等级
中级
节点数量15
分类2
节点类型8
难度说明

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

作者
外部链接
在 n8n.io 查看

分享此工作流