8
n8n 中文网amn8n.com

带版本控制和 Notion 跟踪的 n8n 工作流备份

高级

这是一个DevOps领域的自动化工作流,包含 28 个节点。主要使用 If, N8n, Wait, Limit, Filter 等节点。 带版本控制和 Notion 跟踪的 n8n 工作流备份

前置要求
  • Notion API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "e2b72466a589dd1250fc94a8e861457e040bf25b07f6b069958c036d3f2bfe77",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "0fe79c1a-bdb9-41d5-8306-dcff0e5eff64",
      "name": "当点击\"测试工作流\"时",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        384,
        144
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d67fc8d4-42b0-4183-a64b-1ef550aaea71",
      "name": "GET - 工作流",
      "type": "n8n-nodes-base.n8n",
      "position": [
        464,
        832
      ],
      "parameters": {
        "filters": {},
        "requestOptions": {}
      },
      "credentials": {
        "n8nApi": {
          "id": "DnCSC68bV3k9pk06",
          "name": "n8n account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3c90ef38-0341-4493-80f1-d85f112dbe9f",
      "name": "CREATE - 工作流",
      "type": "n8n-nodes-base.n8n",
      "notes": "{\n  \"name\": \"{{ $json.name }}\",\n  \"nodes\": {{ JSON.stringify($json[\"nodes\"]) }},\n  \"connections\": {{ JSON.stringify($json[\"connections\"] || {}) }}\n}",
      "position": [
        1344,
        864
      ],
      "parameters": {
        "operation": "create",
        "requestOptions": {},
        "workflowObject": "={\n  \"name\": \"{{ $('today_prefix').item.json.formattedDate + $json.name }}\",\n  \"nodes\": {{ JSON.stringify($json[\"nodes\"]) }},\n  \"connections\": {{ JSON.stringify($json[\"connections\"] || {}) }}\n}"
      },
      "credentials": {
        "n8nApi": {
          "id": "lz1TUJbuJ3ADZKs5",
          "name": "render_n8n"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f521fd95-a581-4e7d-8c03-f5846ec2b859",
      "name": "遍历项目",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1120,
        832
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "b2f9180c-9ae4-4114-aba7-0e4803598b61",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        752
      ],
      "parameters": {
        "color": 6,
        "width": 220,
        "content": "### 源 选择全部"
      },
      "typeVersion": 1
    },
    {
      "id": "3acd266a-e555-4501-9ef2-6e1a4d7be5ee",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1232,
        784
      ],
      "parameters": {
        "color": 3,
        "width": 540,
        "height": 300,
        "content": "### 目标 保存今日"
      },
      "typeVersion": 1
    },
    {
      "id": "ed59a2e4-c489-4359-bbf4-89dfc88424d9",
      "name": "GET - 目标工作流",
      "type": "n8n-nodes-base.n8n",
      "position": [
        912,
        512
      ],
      "parameters": {
        "limit": 200,
        "filters": {},
        "returnAll": false,
        "requestOptions": {
          "batching": {
            "batch": {}
          }
        }
      },
      "credentials": {
        "n8nApi": {
          "id": "lz1TUJbuJ3ADZKs5",
          "name": "render_n8n"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "655bb1aa-306e-4f18-8bde-0706684f5d5a",
      "name": "拆分工作流",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        912,
        832
      ],
      "parameters": {
        "include": "allOtherFields",
        "options": {},
        "fieldToSplitOut": "id"
      },
      "typeVersion": 1
    },
    {
      "id": "4e302ca7-31d4-47d9-a5f0-df4997b9dd5b",
      "name": "拆分工作流1",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1152,
        512
      ],
      "parameters": {
        "include": "allOtherFields",
        "options": {},
        "fieldToSplitOut": "id"
      },
      "typeVersion": 1
    },
    {
      "id": "6bcc9cc7-cb70-41aa-81d9-8a76d9fd0c88",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        -80
      ],
      "parameters": {
        "color": 7,
        "width": 576,
        "height": 1312,
        "content": "# 在 n8n 实例之间复制 n8n 工作流"
      },
      "typeVersion": 1
    },
    {
      "id": "d1374fb8-78ac-480e-a30b-90e723cd05c2",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        1568,
        928
      ],
      "webhookId": "4ae2efb3-4231-4577-81f5-8f825cb81484",
      "parameters": {
        "amount": 1
      },
      "typeVersion": 1.1
    },
    {
      "id": "04b6f8a9-1e5f-4ef4-bc50-7899732387e5",
      "name": "限制",
      "type": "n8n-nodes-base.limit",
      "disabled": true,
      "position": [
        688,
        832
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "4190da9c-a51b-45f2-92fd-4bcb8e8ff4f3",
      "name": "过滤器",
      "type": "n8n-nodes-base.filter",
      "notes": "{{ (() => $json.name.slice(0, 7))() }}",
      "position": [
        1360,
        512
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "7bdc83bd-e9b3-4eaa-8154-4056fca3b390",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.name.slice(0, 11) }}",
              "rightValue": "={{ $('yesterday_prefix').item.json.formattedDate }}"
            }
          ]
        }
      },
      "typeVersion": 2.2,
      "alwaysOutputData": false
    },
    {
      "id": "bbc9d2a5-f6fd-4800-99e3-f448856e39bf",
      "name": "今天",
      "type": "n8n-nodes-base.dateTime",
      "position": [
        608,
        144
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "c6e31672-e3d2-4f31-8af4-b10099f131f6",
      "name": "昨天",
      "type": "n8n-nodes-base.dateTime",
      "position": [
        432,
        512
      ],
      "parameters": {
        "options": {},
        "duration": 2,
        "magnitude": "={{ $('today').item.json.currentDate }}",
        "operation": "subtractFromDate"
      },
      "typeVersion": 2
    },
    {
      "id": "9720d3b9-244d-4a44-9ebe-f4f80e14c7dd",
      "name": "昨天_前缀",
      "type": "n8n-nodes-base.dateTime",
      "position": [
        688,
        512
      ],
      "parameters": {
        "date": "={{ $json.newDate }}",
        "format": "custom",
        "options": {},
        "operation": "formatDate",
        "customFormat": "yyyy-MM-dd_"
      },
      "typeVersion": 2
    },
    {
      "id": "ab21f9b5-21b4-432a-9fe3-eb28039c49a1",
      "name": "今天_前缀",
      "type": "n8n-nodes-base.dateTime",
      "position": [
        832,
        144
      ],
      "parameters": {
        "date": "={{ $json.currentDate }}",
        "format": "custom",
        "options": {},
        "operation": "formatDate",
        "customFormat": "yyyy-MM-dd_"
      },
      "typeVersion": 2
    },
    {
      "id": "eeec891a-cad2-449c-8f4d-81d887a4efbe",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1328,
        368
      ],
      "parameters": {
        "color": 3,
        "width": 460,
        "content": "### 目标 删除前天"
      },
      "typeVersion": 1
    },
    {
      "id": "b5ea5dad-7ff0-41d7-a718-9623d190e508",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        864,
        368
      ],
      "parameters": {
        "color": 3,
        "width": 220,
        "content": "### 目标 选择全部"
      },
      "typeVersion": 1
    },
    {
      "id": "2209cca8-310f-4313-bf3e-3218ffc3bb0a",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        368,
        368
      ],
      "parameters": {
        "color": 7,
        "width": 220,
        "content": "### 从日期减去"
      },
      "typeVersion": 1
    },
    {
      "id": "8c0eabb2-a286-4931-a821-3602581dc367",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        368
      ],
      "parameters": {
        "color": 7,
        "width": 220,
        "content": "### YYYY-MM-DD_"
      },
      "typeVersion": 1
    },
    {
      "id": "7b99a424-b2dd-463b-898d-8bd5e111f139",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        752
      ],
      "parameters": {
        "color": 3,
        "width": 220,
        "content": "### 首先尝试 1"
      },
      "typeVersion": 1
    },
    {
      "id": "885d90ef-3972-4c7e-b8df-ee1ab29fae52",
      "name": "Notion",
      "type": "n8n-nodes-base.notion",
      "position": [
        1584,
        672
      ],
      "parameters": {
        "pageId": {
          "__rl": true,
          "mode": "id",
          "value": "1f9d79a8-067c-802a-8098-db9052f7a1db"
        },
        "options": {},
        "resource": "databasePage",
        "operation": "update",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Value|rich_text",
              "textContent": "={{ $('today_prefix').item.json.formattedDate }}"
            },
            {
              "key": "Comment|rich_text",
              "textContent": "={{ $items().length.toString() }}"
            }
          ]
        }
      },
      "credentials": {
        "notionApi": {
          "id": "okdwSk0xpZvGnYXW",
          "name": "Notion account"
        }
      },
      "executeOnce": true,
      "typeVersion": 2.2
    },
    {
      "id": "138a534c-a92b-40d9-b345-a6da7f3a6e05",
      "name": "Notion1",
      "type": "n8n-nodes-base.notion",
      "position": [
        1040,
        144
      ],
      "parameters": {
        "pageId": {
          "__rl": true,
          "mode": "id",
          "value": "1f9d79a8-067c-802a-8098-db9052f7a1db"
        },
        "resource": "databasePage",
        "operation": "get"
      },
      "credentials": {
        "notionApi": {
          "id": "okdwSk0xpZvGnYXW",
          "name": "Notion account"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "b00a1e8f-c08c-40af-ac3d-717d9e38d28a",
      "name": "如果",
      "type": "n8n-nodes-base.if",
      "position": [
        1264,
        144
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "35c3f4b7-55a7-4d3f-aab9-0dca9f9ed795",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.property_value }}",
              "rightValue": "={{ $('today_prefix').item.json.formattedDate }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "052b251c-4c30-46e0-bc90-4007e5d193f2",
      "name": "备份_已完成",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1488,
        48
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "1f3a05e2-56ff-4745-aba6-6c29737ac635",
      "name": "便签9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        768,
        0
      ],
      "parameters": {
        "color": 7,
        "width": 220,
        "height": 320,
        "content": "### YYYY-MM-DD_"
      },
      "typeVersion": 1
    },
    {
      "id": "bb0611c5-1de3-4306-a17e-27dfc670e052",
      "name": "n8n_目标",
      "type": "n8n-nodes-base.n8n",
      "position": [
        1648,
        512
      ],
      "parameters": {
        "operation": "delete",
        "workflowId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('GET - Destination Workflows').item.json.id }}"
        },
        "requestOptions": {}
      },
      "credentials": {
        "n8nApi": {
          "id": "lz1TUJbuJ3ADZKs5",
          "name": "render_n8n"
        }
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "backup_already_done",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "yesterday",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit": {
      "main": [
        [
          {
            "node": "Split Out Workflows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "today": {
      "main": [
        [
          {
            "node": "today_prefix",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "n8n_destination",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notion1": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "yesterday": {
      "main": [
        [
          {
            "node": "yesterday_prefix",
            "type": "main",
            "index": 0
          },
          {
            "node": "GET - Workflows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "today_prefix": {
      "main": [
        [
          {
            "node": "Notion1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET - Workflows": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Notion",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "CREATE - Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "n8n_destination": {
      "main": [
        []
      ]
    },
    "yesterday_prefix": {
      "main": [
        [
          {
            "node": "GET - Destination Workflows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CREATE - Workflow": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Workflows": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Workflows1": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET - Destination Workflows": {
      "main": [
        [
          {
            "node": "Split Out Workflows1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "today",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 开发运维

需要付费吗?

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

工作流信息
难度等级
高级
节点数量28
分类1
节点类型12
难度说明

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

作者
Stéphane Heckel

Stéphane Heckel

@stephaneheckel

Data Sommelier | Sales Architect | Advisor | GTM

外部链接
在 n8n.io 查看

分享此工作流