8
n8n 中文网amn8n.com

17 跟踪库存水平

高级

这是一个Engineering, AI Summarization领域的自动化工作流,包含 17 个节点。主要使用 If, Set, Gmail, McpClientTool, Agent 等节点。 自动化亚马逊库存水平追踪,使用Bright Data MCP和OpenAI

前置要求
  • Google 账号和 Gmail API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "UtVgRkTTYi8Xt5vH",
  "meta": {
    "instanceId": "60046904b104f0f72b2629a9d88fe9f676be4035769f1f08dad1dd38a76b9480",
    "templateCredsSetupCompleted": true
  },
  "name": "17 跟踪库存水平",
  "tags": [],
  "nodes": [
    {
      "id": "baadc7a6-3cf9-4e2f-9e40-6b6afb75396b",
      "name": "每 X 小时检查库存",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "93771587-54b5-4b37-87c0-7497b4ed69fa",
      "name": "定义产品 URL",
      "type": "n8n-nodes-base.set",
      "position": [
        200,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a6354275-2ea3-4641-915f-194e4da11022",
              "name": "Product url",
              "type": "string",
              "value": "https://www.amazon.com/UGREEN-Delivery-Multiport-Adapter-Thinkpad/dp/B0BR3M8XHK/ref=sxin_14_recs_zoco_stores_brand_identity_bs?content-id=amzn1.sym.7d2e00dd-9358-4f89-aca0-04685eb73811%3Aamzn1.sym.7d2e00dd-9358-4f89-aca0-04685eb73811&crid=2CB2GLCEIKPKS&cv_ct_cx=ugreen&keywords=ugreen&pd_rd_i=B0BR3M8XHK&pd_rd_r=15617e04-710c-4101-b1d1-d8a58739f635&pd_rd_w=IUheb&pd_rd_wg=1rYBe&pf_rd_p=7d2e00dd-9358-4f89-aca0-04685eb73811&pf_rd_r=GKRJJFTMCPGTHRJZ980Z&qid=1751608771&sbo=RZvfv%2F%2FHxDF%2BO5021pAnSA%3D%3D&sprefix=ugre%2Caps%2C1277&sr=1-2-5f457e4f-4cf5-45bd-948b-58563dcb013a"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b6c4f0b1-f7c7-4994-aa0d-e52e75d271e4",
      "name": "抓取产品数据(通过 Agent)",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        480,
        0
      ],
      "parameters": {
        "text": "=below is the amazon product and you will scrape the page and tell whether it is still in stock or out of stock:\n{{ $json['Product url'] }}",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2
    },
    {
      "id": "95466f92-911a-499f-b9e9-a69c22186c42",
      "name": "OpenAI(聊天)",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        440,
        260
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "8sEyPDkC5p4w4Jha",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "09ae962a-3047-48cf-b035-5255670177ee",
      "name": "Bright Data MCP(抓取器)",
      "type": "n8n-nodes-mcp.mcpClientTool",
      "position": [
        640,
        260
      ],
      "parameters": {
        "toolName": "web_data_amazon_product",
        "operation": "executeTool",
        "toolParameters": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Tool_Parameters', ``, 'json') }}"
      },
      "credentials": {
        "mcpClientApi": {
          "id": "eqq94k789oJCd6jU",
          "name": "MCP Client (STDIO) account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1025b2ae-deb9-43d9-be05-fdf627cf8f8e",
      "name": "产品有库存吗?",
      "type": "n8n-nodes-base.if",
      "position": [
        960,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "2584d28b-adf3-4b1b-8056-2a582874eca3",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.output.availability }}",
              "rightValue": "In Stock"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "bb5378f1-9c8a-4040-8428-dfdeb151bf43",
      "name": "邮件通知供应商(缺货警报)",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1180,
        100
      ],
      "webhookId": "4394f442-c20b-4ed8-a90e-d77332ef9dac",
      "parameters": {
        "sendTo": "shahkar.genai@gmail.com",
        "message": "The product is out of stock so I need 50 more products",
        "options": {},
        "subject": "=Product \"{{ $json.output.product.title }}\" is out of stock"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "AQDSl75AdzK3vmqJ",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "534cc35a-eab6-4ce8-acf9-5ae0df7fb3f9",
      "name": "不执行操作(有库存)",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1180,
        -100
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "4cf70d5b-a40f-495c-ad9b-7f075660f346",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        -820
      ],
      "parameters": {
        "color": 2,
        "width": 380,
        "height": 1000,
        "content": "### 🟩 **第一部分:输入设置与触发器**"
      },
      "typeVersion": 1
    },
    {
      "id": "24f1d984-6116-4e02-bdc4-de19f9b312eb",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        440,
        -1220
      ],
      "parameters": {
        "color": 3,
        "width": 320,
        "height": 1400,
        "content": "### 🤖 **第二部分:从 Amazon 抓取产品数据**"
      },
      "typeVersion": 1
    },
    {
      "id": "1f7e99a4-6490-4fbb-98ba-f1cb1f53aab0",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        940,
        -680
      ],
      "parameters": {
        "color": 5,
        "width": 380,
        "height": 960,
        "content": "### 📬 **第三部分:决策与通知**"
      },
      "typeVersion": 1
    },
    {
      "id": "85dd0b3a-cd34-49b3-a1b4-86e5f3e66fb4",
      "name": "便利贴5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1440,
        -680
      ],
      "parameters": {
        "color": 7,
        "width": 380,
        "height": 240,
        "content": "## 如果您通过此链接加入 Bright Data,我将获得少量佣金 — 感谢您支持更多免费内容!"
      },
      "typeVersion": 1
    },
    {
      "id": "d3e559d3-c8d7-4b57-bc57-bdfdd3f1f652",
      "name": "便签 9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1720,
        -820
      ],
      "parameters": {
        "color": 4,
        "width": 1300,
        "height": 320,
        "content": "======================================="
      },
      "typeVersion": 1
    },
    {
      "id": "735f2bcf-2d2d-4eb9-8f39-6f2a9f8ef758",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1720,
        -480
      ],
      "parameters": {
        "color": 4,
        "width": 1289,
        "height": 2618,
        "content": "## 🔄 跟踪 Amazon 产品库存并通知供应商工作流"
      },
      "typeVersion": 1
    },
    {
      "id": "34c9ebf4-f2d0-4a6e-a785-1c21c5ac0126",
      "name": "自动修复输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserAutofixing",
      "position": [
        780,
        340
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "0cf6db36-d495-4939-9bc7-a69e01d15cbe",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        760,
        560
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "8sEyPDkC5p4w4Jha",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "dbcaa1e9-9e62-4619-b42d-4e52948ece2c",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        920,
        560
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"availability\": \"In Stock\",\n  \"product\": {\n    \"title\": \"UGREEN Revodok 105 USB C Hub 5 in 1 Multiport Adapter\",\n    \"price\": {\n      \"current\": 9.98,\n      \"original\": 15.99,\n      \"currency\": \"USD\"\n    },\n    \"seller\": \"UGREEN GROUP LIMITED\",\n    \"rating\": {\n      \"score\": 4.6,\n      \"total_reviews\": 18381\n    },\n    \"url\": \"https://www.amazon.com/UGREEN-Delivery-Multiport-Adapter-Thinkpad/dp/B0BR3M8XHK?th=1&psc=1&language=en_US&currency=USD\"\n  }\n}\n"
      },
      "typeVersion": 1.2
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "83db36de-9559-46a9-9f05-82d017c81632",
  "connections": {
    "OpenAI (Chat)": {
      "ai_languageModel": [
        [
          {
            "node": "Scrape Product Data (via Agent)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Auto-fixing Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Product In Stock?": {
      "main": [
        [
          {
            "node": "Do Nothing (Stock Available)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Email Supplier (Out of Stock Alert)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Define Product URL": {
      "main": [
        [
          {
            "node": "Scrape Product Data (via Agent)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Auto-fixing Output Parser",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Auto-fixing Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Scrape Product Data (via Agent)",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Bright Data MCP (Scraper)": {
      "ai_tool": [
        [
          {
            "node": "Scrape Product Data (via Agent)",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Check Stock Every X Hours": {
      "main": [
        [
          {
            "node": "Define Product URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Product Data (via Agent)": {
      "main": [
        [
          {
            "node": "Product In Stock?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 工程, AI 摘要总结

需要付费吗?

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

工作流信息
难度等级
高级
节点数量17
分类2
节点类型11
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Yaron Been

Yaron Been

@yaron-nofluff

Building AI Agents and Automations | Growth Marketer | Entrepreneur | Book Author & Podcast Host If you need any help with Automations, feel free to reach out via linkedin: https://www.linkedin.com/in/yaronbeen/ And check out my Youtube channel: https://www.youtube.com/@YaronBeen/videos

外部链接
在 n8n.io 查看

分享此工作流