在工作流自动化中,有时候你不需要立即执行下一步操作,而是需要等待某个时间段过去、等待外部信号到达,或者让用户做出决策。这就是 Wait 节点 的用武之地。
Wait 节点是 n8n 中最强大的控制流工具之一,它能让你的工作流在适当的时刻执行,而不是盲目地一路狂奔。从 API 速率限制到人工审批流程,再到定时跟进邮件——Wait 节点无处不在。
Wait 节点是一个暂停节点。当工作流执行到这个节点时,它会:
这种机制使得 n8n 可以高效地处理长时间运行的工作流,而不会占用过多的服务器资源。
最直观的暂停方式——等待固定的时间段。
配置参数:
常见场景:
小贴士: 对于少于 65 秒的等待时间,n8n 不会将执行数据卸载到数据库,而是直接在内存中等待。
不是等待一段时间,而是指定一个具体的日期和时间,到了那个时刻才继续。
配置参数:
常见场景:
这是最灵活的模式——等待来自外部系统的信号。
工作流会生成一个唯一的 Webhook URL(存储在 $execution.resumeUrl 变量中),当这个 URL 被调用时,工作流才会恢复。
高级参数:
| 参数 | 说明 |
|---|---|
| Authentication | 选择认证方式(Basic Auth、Header Auth、JWT、None) |
| HTTP Method | 选择 HTTP 方法(GET、POST、PUT 等) |
| Response Code | 返回的响应状态码(200、201、400 等) |
| Response Data | 返回的数据格式(All Entries、First Entry JSON 等) |
| IP(s) Whitelist | 限制哪些 IP 地址可以调用这个 Webhook |
| Limit Wait Time | 设置最大等待时限,超时后自动恢复 |
常见场景:
等待用户提交一个表单,表单数据会成为工作流的下一步输入。
表单配置:
| 配置项 | 说明 |
|---|---|
| Form Title | 表单顶部显示的标题 |
| Form Description | 表单下方的描述文本 |
| Form Fields | 表单包含的字段列表 |
字段类型支持:
常见场景:
构建一个邮件跟进系统:
拖拽一个 Webhook 节点作为触发器,这代表用户注册事件。
配置示例:
添加一个 Send Email 节点:
{{ $json.email }}欢迎加入我们!拖拽 Wait 节点:
After Time Interval3Days再添加一个 Send Email 节点:
{{ $json.email }}不要错过!您的专属优惠仅剩 24 小时触发器(表单提交)
↓
业务逻辑处理
↓
生成审批表单(Wait 节点)
↓
根据审批结果分支处理
├→ 批准 → 发送确认邮件 → 更新数据库
└→拒绝 → 发送拒绝邮件 → 记录日志Wait 节点配置:
On Form Submitted许多 API 有请求限制(如每分钟 60 个请求)。使用 Wait 节点可以优雅地控制请求速率。
Get Contacts(获取 100 个联系人)
↓
Loop Through Contacts
├→ Send API Request(每个请求)
├→ Wait 1 Second
└→ 重复直到完成这样可以将 100 个请求平铺到 100 秒,避免触发 API 限制。
提交单据
↓
Level 1 审批(Wait + 表单)
↓
Level 2 审批(Wait + 表单)
↓
Level 3 审批(Wait + 表单)
↓
执行操作每个 Wait 节点都会生成一个独立的表单 URL,可以并行或顺序发给不同的审批人。
A: 不会。n8n 会将执行数据自动保存到数据库中。当工作流恢复时,所有数据都会完整加载回来,你可以继续使用 {{ $json }} 引用原始数据。
A: 调用 Webhook URL 时,可以在 URL 参数或请求体中包含数据:
GET: https://...resumeWebhookUrl?status=approved&comment=looks_good
POST: {
"status": "approved",
"comment": "Looks good!",
"timestamp": "2025-01-15T10:30:00Z"
}后续节点可以通过 {{ $json.status }} 和 {{ $json.comment }} 访问这些数据。
A: 这通常是时区问题。n8n 始终使用服务器时区,而不是工作流的时区设置。如果工作流配置了时区,改变时区设置不会影响已有的 Wait 节点等待时间。
A: 完全可以!每个 Wait 节点都有独立的恢复 URL($execution.resumeUrl)和恢复逻辑。当它们被调用时会按顺序恢复。
以下是一个完整的人工审批工作流,你可以直接导入 n8n 使用:
{
"name": "7天邮件跟进 + 人工审批工作流",
"nodes": [
{
"name": "Webhook触发器",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [250, 250],
"webhookId": "webhook_123",
"httpMethod": "POST",
"path": "user-signup",
"authentication": "none"
},
{
"name": "发送欢迎邮件",
"type": "n8n-nodes-base.sendEmail",
"typeVersion": 1,
"position": [450, 250],
"credentials": {
"gmail": "Gmail Account"
},
"parameters": {
"toEmail": "={{ $json.email }}",
"subject": "欢迎加入!",
"textPlain": "感谢注册。我们将在7天后给你发送特别优惠!"
}
},
{
"name": "等待7天",
"type": "n8n-nodes-base.wait",
"typeVersion": 1,
"position": [650, 250],
"parameters": {
"resume": "after",
"amount": 7,
"unit": "days"
}
},
{
"name": "发送跟进邮件",
"type": "n8n-nodes-base.sendEmail",
"typeVersion": 1,
"position": [850, 250],
"credentials": {
"gmail": "Gmail Account"
},
"parameters": {
"toEmail": "={{ $json.email }}",
"subject": "您的专属优惠仅剩48小时!",
"textPlain": "我们为您准备了特别的优惠。立即查看详情吧!"
}
},
{
"name": "等待审批表单",
"type": "n8n-nodes-base.wait",
"typeVersion": 1,
"position": [1050, 250],
"parameters": {
"resume": "form",
"formTitle": "审批此用户的高级权限",
"formDescription": "请审核该用户的信息并做出决定",
"formFields": [
{
"fieldLabel": "审批决定",
"fieldType": "dropdown",
"required": true,
"fieldOptions": [
{
"name": "批准",
"value": "approved"
},
{
"name": "拒绝",
"value": "rejected"
}
]
},
{
"fieldLabel": "备注",
"fieldType": "textarea",
"required": false
}
],
"respondWhen": "formSubmitted"
}
},
{
"name": "根据审批结果分支",
"type": "n8n-nodes-base.switch",
"typeVersion": 1,
"position": [1250, 250],
"parameters": {
"cases": [
{
"condition": "string",
"value1": "={{ $json.decision }}",
"value2": "approved",
"operator": "equal",
"output": 1
},
{
"condition": "string",
"value1": "={{ $json.decision }}",
"value2": "rejected",
"operator": "equal",
"output": 2
}
]
}
},
{
"name": "发送批准邮件",
"type": "n8n-nodes-base.sendEmail",
"typeVersion": 1,
"position": [1450, 150],
"credentials": {
"gmail": "Gmail Account"
},
"parameters": {
"toEmail": "={{ $json.email }}",
"subject": "恭喜!您已被批准升级为高级会员",
"textPlain": "您现在可以享受所有高级功能了。欢迎加入!"
}
},
{
"name": "发送拒绝邮件",
"type": "n8n-nodes-base.sendEmail",
"typeVersion": 1,
"position": [1450, 350],
"credentials": {
"gmail": "Gmail Account"
},
"parameters": {
"toEmail": "={{ $json.email }}",
"subject": "感谢您的关注",
"textPlain": "非常感谢您的兴趣。如有疑问,请联系我们的支持团队。"
}
}
],
"connections": {
"Webhook触发器": {
"main": [
[
{
"node": "发送欢迎邮件",
"type": "main",
"index": 0
}
]
]
},
"发送欢迎邮件": {
"main": [
[
{
"node": "等待7天",
"type": "main",
"index": 0
}
]
]
},
"等待7天": {
"main": [
[
{
"node": "发送跟进邮件",
"type": "main",
"index": 0
}
]
]
},
"发送跟进邮件": {
"main": [
[
{
"node": "等待审批表单",
"type": "main",
"index": 0
}
]
]
},
"等待审批表单": {
"main": [
[
{
"node": "根据审批结果分支",
"type": "main",
"index": 0
}
]
]
},
"根据审批结果分支": {
"main": [
[
{
"node": "发送批准邮件",
"type": "main",
"index": 0
}
],
[
{
"node": "发送拒绝邮件",
"type": "main",
"index": 0
}
]
]
}
}
}场景:Webhook 恢复等待最多 24 小时
配置:
- Limit Wait Time: 启用
- Limit Type: After Time Interval
- Amount: 1
- Unit: days场景:只允许特定服务调用恢复 Webhook
配置:
- IP(s) Whitelist: 203.0.113.45, 198.51.100.89场景:同一工作流有多个 Webhook 恢复点
配置:
- Wait Node 1 Webhook Suffix: -approval
- Wait Node 2 Webhook Suffix: -payment✅ Wait 节点的四种模式 —— 时间间隔、指定时间、Webhook、表单提交
✅ 数据保存 —— 暂停期间执行数据会安全地保存到数据库
✅ 灵活的恢复 —— 可以基于时间、外部信号或用户输入恢复
✅ 广泛应用 —— API 速率控制、人工审批、定时任务、多级流程
✅ 性能友好 —— 长时间等待不会占用服务器资源
[1] 官方文档: https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.wait/
[2] n8n系列教程: https://www.undsky.com/blog/?category=n8n%E6%95%99%E7%A8%8B#