n8n-workflow-automation
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesen8n workflow automation with retries, logging, and review queues
具备重试、日志记录和审核队列的n8n工作流自动化
PURPOSE
用途
Designs and outputs n8n workflow JSON with robust triggers, idempotency, error handling, logging, retries, and human-in-the-loop review queues.
设计并输出具备可靠触发器、幂等性、错误处理、日志记录、重试机制和人工介入审核队列的n8n工作流JSON。
WHEN TO USE
适用场景
- TRIGGERS:
- Build an n8n workflow that runs every Monday and emails the compliance summary.
- Add error handling and retries to this workflow, plus a review queue for failures.
- Create a webhook workflow that logs every run and writes a status row to a tracker.
- Make this n8n flow idempotent so it does not duplicate records when it reruns.
- Instrument this workflow with audit logs and a human approval step.
- DO NOT USE WHEN…
- You need code-only automation without n8n (use a scripting/CI skill).
- You need to bypass security controls or hide audit trails.
- You need to purchase or recommend prohibited items/services.
- 触发场景:
- 构建一个每周一运行并发送合规摘要邮件的n8n工作流。
- 为该工作流添加错误处理和重试机制,以及针对失败任务的审核队列。
- 创建一个记录每次运行情况并向追踪表写入状态行的webhook工作流。
- 确保该n8n工作流具备幂等性,避免重新运行时重复生成记录。
- 为该工作流配置审计日志和人工审批步骤。
- 不适用场景:
- 你需要无需n8n的纯代码自动化(请使用脚本/CI技能)。
- 你需要绕过安全控制或隐藏审计轨迹。
- 你需要采购或推荐受限物品/服务。
INPUTS
输入项
- REQUIRED:
- Workflow intent: trigger type + schedule/timezone + success criteria.
- Targets: where to write results (email/Drive/Sheet/DB) and required fields.
- OPTIONAL:
- Existing n8n workflow JSON to modify.
- Sample payloads / example records.
- Definition of dedup keys (what makes a record unique).
- EXAMPLES:
- Cron: Monday 08:00 Europe/London; send summary email + Drive upload
- Webhook: receive JSON; route to folders
- 必填项:
- 工作流意图:触发器类型 + 调度规则/时区 + 成功判定标准。
- 目标端:结果输出位置(邮件/Drive/表格/数据库)及必填字段。
- 可选项:
- 待修改的现有n8n工作流JSON。
- 示例负载/记录样本。
- 去重键定义(用于标识记录唯一性的字段)。
- 示例:
- Cron:每周一08:00(欧洲/伦敦时区);发送摘要邮件并上传至Drive
- Webhook:接收JSON数据;路由至对应文件夹
OUTPUTS
输出项
- Default (read-only): a workflow design spec (nodes, data contracts, failure modes).
- If explicitly requested: (n8n importable JSON) +
workflow.json(from template). Success = workflow is idempotent, logs every run, retries safely, and routes failures to a review queue.runbook.md
- 默认(只读):工作流设计规范(节点、数据契约、故障模式)。
- 若明确要求:(可导入n8n的JSON文件) +
workflow.json(基于模板生成)。 成功标准 = 工作流具备幂等性、记录每次运行、安全重试,并将失败任务路由至审核队列。runbook.md
WORKFLOW
工作流步骤
- Clarify trigger:
- Cron/webhook/manual; schedule/timezone; concurrency expectations.
- Define data contract:
- input schema, required fields, and validation rules.
- Design idempotency:
- choose dedup key(s) and storage (DB/Sheet) to prevent duplicates on retries.
- Add observability:
- generate , log start/end, store status row and error details.
run_id
- generate
- Implement error handling:
- per-node error branches, retry with backoff, and final failure notification.
- Add human-in-the-loop (HITL) review queue:
- write failed items to a queue (Sheet/DB) and require approval to reprocess.
- “No silent failure” gates:
- if counts/thresholds fail, stop workflow and alert.
- Output:
- If asked for JSON: produce importable n8n workflow JSON + runbook.
- STOP AND ASK THE USER if:
- destination systems are unknown,
- no dedup key exists,
- credential strategy (env vars) is not specified,
- the workflow needs privileged access not yet approved.
- 明确触发器:
- Cron/webhook/手动触发;调度规则/时区;并发预期。
- 定义数据契约:
- 输入 schema、必填字段及验证规则。
- 设计幂等性:
- 选择去重键及存储介质(数据库/表格),防止重试时生成重复记录。
- 添加可观测性:
- 生成、记录运行起止时间、存储状态行及错误详情。
run_id
- 生成
- 实现错误处理:
- 为每个节点配置错误分支、带退避策略的重试机制,以及最终故障通知。
- 添加人工介入(HITL)审核队列:
- 将失败任务写入队列(表格/数据库),并要求审批后才可重新处理。
- “无静默失败”校验:
- 若计数/阈值不达标,终止工作流并发送告警。
- 输出结果:
- 若要求JSON文件:生成可导入n8n的工作流JSON + 运行手册。
- 以下情况需停止并询问用户:
- 目标系统不明确,
- 无去重键定义,
- 未指定凭证策略(环境变量),
- 工作流需要未获批的特权访问权限。
OUTPUT FORMAT
输出格式
If outputting n8n workflow JSON, conform to:
json
{
"name": "<workflow name>",
"nodes": [ { "name": "Trigger", "type": "n8n-nodes-base.cron", "parameters": {}, "position": [0,0] } ],
"connections": {},
"settings": {},
"active": false
}Also output using .
runbook.mdassets/runbook-template.md若输出n8n工作流JSON,需遵循以下格式:
json
{
"name": "<workflow name>",
"nodes": [ { "name": "Trigger", "type": "n8n-nodes-base.cron", "parameters": {}, "position": [0,0] } ],
"connections": {},
"settings": {},
"active": false
}同时需基于输出。
assets/runbook-template.mdrunbook.mdSAFETY & EDGE CASES
安全与边缘情况
- Read-only by default; only emit workflow JSON when explicitly requested.
- Do not include secrets in JSON; reference env vars/credential names only.
- Include audit logging + failure notifications; avoid workflows that can silently drop data.
- Prefer least privilege: call only required APIs and minimize scopes.
- 默认只读;仅在明确要求时输出工作流JSON。
- 请勿在JSON中包含密钥;仅引用环境变量/凭证名称。
- 包含审计日志与故障通知;避免可能静默丢失数据的工作流。
- 遵循最小权限原则:仅调用必要API并最小化权限范围。
EXAMPLES
示例
-
Input: “Cron every Monday, email compliance summary, retry failures.”
Output: Node map +with Cron → Fetch → Aggregate → Email, plus error branches to review queue.workflow.json -
Input: “Webhook that logs runs and writes status row.”
Output: Webhook → Validate → Process → Append status row; on error → log + notify + queue.
-
输入:“每周一执行Cron任务,发送合规摘要邮件,并重试失败任务。”
输出:节点映射 +,包含Cron → 数据获取 → 聚合 → 邮件发送节点,以及指向审核队列的错误分支。workflow.json -
输入:“记录运行情况并写入状态行的Webhook。”
输出:Webhook → 验证 → 处理 → 追加状态行;错误时 → 记录日志 + 发送通知 → 加入队列。