Sauvegarde des workflows n8n avec contrôle de version et suivi dans Notion

Avancé

Ceci est unDevOpsworkflow d'automatisation du domainecontenant 28 nœuds.Utilise principalement des nœuds comme If, N8n, Wait, Limit, Filter. Sauvegarde des workflows n8n avec contrôle de version et suivi dans Notion

Prérequis
  • Clé API Notion

Catégorie

Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "meta": {
    "instanceId": "e2b72466a589dd1250fc94a8e861457e040bf25b07f6b069958c036d3f2bfe77",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "0fe79c1a-bdb9-41d5-8306-dcff0e5eff64",
      "name": "Lors du clic sur 'Test workflow'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        384,
        144
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "d67fc8d4-42b0-4183-a64b-1ef550aaea71",
      "name": "GET - Workflows",
      "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 - Workflow",
      "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": "Boucler sur les éléments",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1120,
        832
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "b2f9180c-9ae4-4114-aba7-0e4803598b61",
      "name": "Note adhésive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        752
      ],
      "parameters": {
        "color": 6,
        "width": 220,
        "content": "### Source Select All"
      },
      "typeVersion": 1
    },
    {
      "id": "3acd266a-e555-4501-9ef2-6e1a4d7be5ee",
      "name": "Note adhésive2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1232,
        784
      ],
      "parameters": {
        "color": 3,
        "width": 540,
        "height": 300,
        "content": "### Destination Save Today\nworflowname becomes YYYY-MM-DD_workflowname"
      },
      "typeVersion": 1
    },
    {
      "id": "ed59a2e4-c489-4359-bbf4-89dfc88424d9",
      "name": "GET - Destination Workflows",
      "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": "Split Out Workflows",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        912,
        832
      ],
      "parameters": {
        "include": "allOtherFields",
        "options": {},
        "fieldToSplitOut": "id"
      },
      "typeVersion": 1
    },
    {
      "id": "4e302ca7-31d4-47d9-a5f0-df4997b9dd5b",
      "name": "Split Out Workflows1",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1152,
        512
      ],
      "parameters": {
        "include": "allOtherFields",
        "options": {},
        "fieldToSplitOut": "id"
      },
      "typeVersion": 1
    },
    {
      "id": "6bcc9cc7-cb70-41aa-81d9-8a76d9fd0c88",
      "name": "Note adhésive3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        -80
      ],
      "parameters": {
        "color": 7,
        "width": 576,
        "height": 1312,
        "content": "# Copy n8n workflows between n8n instances\nInspired by [Alex Kim's workflow](https://n8n.io/workflows/3048-clone-n8n-workflows-between-instances-using-n8n-api/), this version adds the ability to keep multiple versions of the same workflow on the destination instance. Each copied workflow’s name is prefixed with the date (`YYYY_MM_DD_`), enabling simple version tracking. Process details and workflow counts are recorded centrally in Notion.\n\n## How it works\n\n- Workflows from the **source n8n instance** are copied to the **destination** using the n8n API node.\n- On the destination, each workflow name is prefixed with the current date (e.g., `2025_08_03_PDF Summarizer`), so you can keep multiple daily versions.\n- The workflow tracks and saves:\n    - The date of execution.\n    - Number of workflows processed.\n    - Both details are recorded in Notion.\n\n### Rolling retention policy example:\n\n- **Day 1:** Workflows are saved with `2025_08_03_` prefix.\n- **Day 2:** New set saved with `2025_08_04_`.\n- **Day 3:** Day 1’s set is deleted, new set saved as `2025_08_05_`.\n- To keep more days, adjust the “Subtract From Date” node.\n\n## How to use\n\n1. **Create a Notion database** with one page and three fields:\n    - `sequence`: Should contain `\"prefix\"`.\n    - `Value`: Today's date as `YYYY_MM_DD_`.\n    - `Comment`: Number of saved workflows.\n\n2. **Configure the Notion node**:\n    - Enter your Notion credentials.\n    - Link to the created database/page.\n\n3. **Update the \"Subtract From Date\" node**:\n    - Set how many days’ versions you want to keep (default: 2 days).\n    - Set the limit to 1 in the \"Limit\" node for testing.\n4. **Input credentials** for both source and destination n8n instances.\n\n## Requirements\n\n- **Notion** for tracking execution date and workflow count.\n- **n8n API Keys** for both source and destination instances.\n- **n8n version** this workflow was tested on 1.103.2 (Ubuntu)\n- Ensure you have the necessary **API permissions** (read, create, delete workflows) for both n8n instances.\n\n## Need Help?\n\nContact me on LinkedIn or ask in the [Forum](https://community.n8n.io/)!\n\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d1374fb8-78ac-480e-a30b-90e723cd05c2",
      "name": "Attendre",
      "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": "Limiter",
      "type": "n8n-nodes-base.limit",
      "disabled": true,
      "position": [
        688,
        832
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "4190da9c-a51b-45f2-92fd-4bcb8e8ff4f3",
      "name": "Filtrer",
      "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": "today",
      "type": "n8n-nodes-base.dateTime",
      "position": [
        608,
        144
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "c6e31672-e3d2-4f31-8af4-b10099f131f6",
      "name": "yesterday",
      "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": "yesterday_prefix",
      "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": "today_prefix",
      "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": "Note adhésive4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1328,
        368
      ],
      "parameters": {
        "color": 3,
        "width": 460,
        "content": "### Destination Delete the day before yesterday\nWorkflows starting with YYYY-MM-DD_"
      },
      "typeVersion": 1
    },
    {
      "id": "b5ea5dad-7ff0-41d7-a718-9623d190e508",
      "name": "Note adhésive5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        864,
        368
      ],
      "parameters": {
        "color": 3,
        "width": 220,
        "content": "### Destination Select All"
      },
      "typeVersion": 1
    },
    {
      "id": "2209cca8-310f-4313-bf3e-3218ffc3bb0a",
      "name": "Note adhésive6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        368,
        368
      ],
      "parameters": {
        "color": 7,
        "width": 220,
        "content": "### Substract From Date\nSubstract 2 (duration) for the day before yesterday so you have 2 days of online backup"
      },
      "typeVersion": 1
    },
    {
      "id": "8c0eabb2-a286-4931-a821-3602581dc367",
      "name": "Note adhésive7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        368
      ],
      "parameters": {
        "color": 7,
        "width": 220,
        "content": "### YYYY-MM-DD_\nSetup the custom format with yyyy-MM-dd_\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7b99a424-b2dd-463b-898d-8bd5e111f139",
      "name": "Note adhésive8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        752
      ],
      "parameters": {
        "color": 3,
        "width": 220,
        "content": "### Try with 1 first"
      },
      "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": "If",
      "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": "backup_already_done",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1488,
        48
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "1f3a05e2-56ff-4745-aba6-6c29737ac635",
      "name": "Note adhésive9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        768,
        0
      ],
      "parameters": {
        "color": 7,
        "width": 220,
        "height": 320,
        "content": "### YYYY-MM-DD_\nThis is the prefix added to workflow name"
      },
      "typeVersion": 1
    },
    {
      "id": "bb0611c5-1de3-4306-a17e-27dfc670e052",
      "name": "n8n_destination",
      "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": {
    "b00a1e8f-c08c-40af-ac3d-717d9e38d28a": {
      "main": [
        [
          {
            "node": "052b251c-4c30-46e0-bc90-4007e5d193f2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "c6e31672-e3d2-4f31-8af4-b10099f131f6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit": {
      "main": [
        [
          {
            "node": "655bb1aa-306e-4f18-8bde-0706684f5d5a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "bbc9d2a5-f6fd-4800-99e3-f448856e39bf": {
      "main": [
        [
          {
            "node": "ab21f9b5-21b4-432a-9fe3-eb28039c49a1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "bb0611c5-1de3-4306-a17e-27dfc670e052",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "138a534c-a92b-40d9-b345-a6da7f3a6e05": {
      "main": [
        [
          {
            "node": "b00a1e8f-c08c-40af-ac3d-717d9e38d28a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c6e31672-e3d2-4f31-8af4-b10099f131f6": {
      "main": [
        [
          {
            "node": "9720d3b9-244d-4a44-9ebe-f4f80e14c7dd",
            "type": "main",
            "index": 0
          },
          {
            "node": "d67fc8d4-42b0-4183-a64b-1ef550aaea71",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ab21f9b5-21b4-432a-9fe3-eb28039c49a1": {
      "main": [
        [
          {
            "node": "138a534c-a92b-40d9-b345-a6da7f3a6e05",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d67fc8d4-42b0-4183-a64b-1ef550aaea71": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "885d90ef-3972-4c7e-b8df-ee1ab29fae52",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "3c90ef38-0341-4493-80f1-d85f112dbe9f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "bb0611c5-1de3-4306-a17e-27dfc670e052": {
      "main": [
        []
      ]
    },
    "9720d3b9-244d-4a44-9ebe-f4f80e14c7dd": {
      "main": [
        [
          {
            "node": "ed59a2e4-c489-4359-bbf4-89dfc88424d9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3c90ef38-0341-4493-80f1-d85f112dbe9f": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "655bb1aa-306e-4f18-8bde-0706684f5d5a": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4e302ca7-31d4-47d9-a5f0-df4997b9dd5b": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ed59a2e4-c489-4359-bbf4-89dfc88424d9": {
      "main": [
        [
          {
            "node": "4e302ca7-31d4-47d9-a5f0-df4997b9dd5b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0fe79c1a-bdb9-41d5-8306-dcff0e5eff64": {
      "main": [
        [
          {
            "node": "bbc9d2a5-f6fd-4800-99e3-f448856e39bf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Avancé - DevOps

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Avancé
Nombre de nœuds28
Catégorie1
Types de nœuds12
Description de la difficulté

Adapté aux utilisateurs avancés, avec des workflows complexes contenant 16+ nœuds

Auteur
Stéphane Heckel

Stéphane Heckel

@stephaneheckel

Data Sommelier | Sales Architect | Advisor | GTM

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34