7. 调度工作流#
¥ Scheduling the Workflow
在本工作流程步骤中,你将学习如何使用“计划触发器”节点安排工作流程,使其按设定的时间/间隔自动运行。完成此步骤后,你的工作流应如下所示:
¥In this step of the workflow, you will learn how to schedule your workflow so that it runs automatically at a set time/interval using the Schedule Trigger node. After this step, your workflow should look like this:
Workflow preview placeholder.
你目前构建的工作流仅在你单击“执行工作流”时执行。但 Nathan 需要它每周一早上自动运行。你可以使用 计划触发器 来完成此操作,它允许你安排工作流按固定日期、时间或间隔定期运行。
¥The workflow you've built so far executes only when you click on Execute Workflow. But Nathan needs it to run automatically every Monday morning. You can do this with the Schedule Trigger, which allows you to schedule workflows to run periodically at fixed dates, times, or intervals.
为此,我们将删除最初使用的“手动触发”节点,并将其替换为“计划触发”节点。
¥To achieve this, we'll remove the Manual Trigger node we started with and replace it with a Schedule Trigger node instead.
移除手动触发节点#
¥Remove the Manual Trigger node
首先,移除手动触发节点:
¥First, let's remove the Manual Trigger node:
- 选择连接到 HTTP 请求节点的“手动触发”节点。
¥Select the Manual Trigger node connected to your HTTP Request node. 2. 选择垃圾桶图标进行删除。
¥Select the trash can icon to delete.
此操作将移除“手动触发”节点,你将看到 "添加第一步" 选项。
¥This removes the Manual Trigger node and you'll see an "Add first step" option.
添加 Schedule Trigger 节点#
¥Add the Schedule Trigger node
- 打开节点面板并搜索“计划触发器”。
¥Open the nodes panel and search for Schedule Trigger. 2. 在搜索结果中出现时点击。
¥Select it when it appears in the search results.
在“计划触发器”节点窗口中,配置以下参数:
¥In the Schedule Trigger node window, configure these parameters:
- 触发间隔:选择“周”。
¥Trigger Interval: Select Weeks.
- 周间隔触发器:输入
1。
¥Weeks Between Triggers: Enter 1.
- 工作日触发:选择“星期一”(如果默认添加了“星期日”,请将其删除)。
¥Trigger on weekdays: Select Monday (and remove Sunday if added by default).
- 触发小时:选择上午 9 点。
¥Trigger at Hour: Select 9am.
- 触发分钟:输入
0。
¥Trigger at Minute: Enter 0.
你的计划触发器节点应如下所示:
¥Your Schedule Trigger node should look like this:

Keep in mind
为确保使用“计划触发器”节点进行准确调度,请务必为你的 n8n 实例 或 工作流设置 设置正确的时区。如果已设置,计划触发器节点将使用工作流的时区。如果不是,它将回退到 n8n 实例的时区。
¥To ensure accurate scheduling with the Schedule Trigger node, be sure to set the correct timezone for your n8n instance or the workflow's settings. The Schedule Trigger node will use the workflow's timezone if it's set; it will fall back to the n8n instance's timezone if it's not.
连接计划触发器节点#
¥Connect the Schedule Trigger node
返回画布,并将“计划触发器”节点上的箭头拖动到“HTTP 请求”节点,从而将“计划触发器”节点连接到“HTTP 请求”节点。
¥Return to the canvas and connect your Schedule Trigger node to the HTTP Request node by dragging the arrow from it to the HTTP Request node.
你的完整工作流应如下所示:
¥Your full workflow should look like this:
Workflow preview placeholder.
下一步是什么?#
¥What's next?
你 👩🔧:工作流到此结束!我已经添加并配置了所有必要的节点。现在,每次点击“执行工作流”按钮,n8n 都会执行所有节点:获取、筛选、计算和传输销售数据。
¥You 👩🔧: That was it for the workflow! I've added and configured all necessary nodes. Now every time you click on Execute workflow, n8n will execute all the nodes: getting, filtering, calculating, and transferring the sales data.
Nathan 🙋:这正是我需要的!我的工作流将在每周一早上自动运行,对吗?
¥Nathan 🙋: This is just what I needed! My workflow will run automatically every Monday morning, correct?
你 👩🔧:别急。为此,你需要激活你的工作流。我将在下一步中完成此操作,并向你展示如何解读执行日志。
¥You 👩🔧: Not so fast. To do that, you need to activate your workflow. I'll do this in the next step and show you how to interpret the execution log.