{
  "name": "Auto-backup n8n workflows to OneDrive with cleanup & email notifications",
  "nodes": [
    {
      "id": "96aee703-bbf4-4de0-b6fb-7cf8428d5027",
      "name": "Retrieve workflows",
      "type": "n8n-nodes-base.n8n",
      "position": [
        -4592,
        96
      ]
    },
    {
      "id": "84b64870-e3c4-4762-9931-c5ec929c904e",
      "name": "Get backupfolders",
      "type": "n8n-nodes-base.microsoftOneDrive",
      "position": [
        -3248,
        96
      ]
    },
    {
      "id": "cf46cd5f-f000-40ec-a6c8-110984437c6c",
      "name": "Delete old backup folder",
      "type": "n8n-nodes-base.microsoftOneDrive",
      "position": [
        -1344,
        224
      ]
    },
    {
      "id": "c79f2638-dd31-4c07-ad61-b25efc2919bd",
      "name": "Prepare HTML Email",
      "type": "n8n-nodes-base.code",
      "position": [
        -480,
        112
      ]
    },
    {
      "id": "d846405f-6dde-40a1-b96f-e23225b59eb6",
      "name": "Schedule Trigger Daily",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -5520,
        96
      ]
    },
    {
      "id": "7e961954-d2ed-4a9d-8725-d444a1868c9f",
      "name": "Send HTML Success Email",
      "type": "n8n-nodes-base.microsoftOutlook",
      "position": [
        -80,
        112
      ]
    },
    {
      "id": "e7575c54-1134-45bc-a4ed-fe88d5d27634",
      "name": "Search a folder",
      "type": "n8n-nodes-base.microsoftOneDrive",
      "position": [
        -5216,
        -272
      ]
    },
    {
      "id": "d9b6048b-49bb-4e6b-97e9-8fb0bd2b122a",
      "name": "Switch Old Folders",
      "type": "n8n-nodes-base.switch",
      "position": [
        -2352,
        96
      ]
    },
    {
      "id": "df14e3ce-8a86-4c1d-a7a3-405f40f90d6b",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -1776,
        240
      ]
    },
    {
      "id": "af00819c-d885-4021-b693-06b9fb102112",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        -1008,
        112
      ]
    },
    {
      "id": "83e234c1-9eb7-48dc-8956-a818fa338a8f",
      "name": "Create new backup folder",
      "type": "n8n-nodes-base.microsoftOneDrive",
      "position": [
        -5056,
        96
      ]
    },
    {
      "id": "b1fda1d4-c8b6-4882-95a2-048400064677",
      "name": "Convert to JSON file",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        -4160,
        96
      ]
    },
    {
      "id": "ea490d15-f4d0-485e-8686-deb9044012b6",
      "name": "Upload JSON to folder",
      "type": "n8n-nodes-base.microsoftOneDrive",
      "position": [
        -3712,
        96
      ]
    },
    {
      "id": "21d3de22-1836-49cd-99b7-1fafb710294e",
      "name": "Filter backup folder",
      "type": "n8n-nodes-base.code",
      "position": [
        -2848,
        96
      ]
    },
    {
      "id": "ba663fbc-67f2-47e3-a237-122aa555f7d8",
      "name": "Sticky Note - Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -6320,
        128
      ],
      "parameters": {
        "width": 600,
        "height": 940,
        "content": "## 🗂️ Automated Workflow Backup Manager\n\n### Goal:\nThis workflow automates the process of backing up your workflows in n8n by creating a new backup folder in OneDrive. It first retrieves existing work"
      }
    },
    {
      "id": "0a3c08c4-6a18-4755-be8d-fc45103959f0",
      "name": "Sticky Note - Send HTML Success Email",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        304
      ],
      "parameters": {
        "width": 380,
        "height": 860,
        "content": "## 📧 Send HTML Success Email \n\n### 🎯 Purpose\nSend an HTML formatted success email to a specified recipient, allowing for rich formatting and design in the email content.\n\n### 🔄 Inputs / Outputs\n- **In"
      }
    },
    {
      "id": "46ee0eac-d1e0-4948-ad60-f729abe72f3c",
      "name": "Sticky Note - Prepare HTML Email",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        304
      ],
      "parameters": {
        "width": 380,
        "height": 860,
        "content": "## 📧 Prepare HTML Email\n\n### 🎯 Purpose\nCreate a formatted HTML email to summarize and document the results of a successful backup process, including essential statistics and insights about workflows.\n"
      }
    },
    {
      "id": "baec94aa-e4c1-4341-92aa-e787c084966e",
      "name": "Sticky Note - Merge",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1040,
        304
      ],
      "parameters": {
        "width": 380,
        "height": 540,
        "content": "## 🔗 Merge \n\n### 🎯 Purpose\nCombine multiple streams of data into a single output, allowing for flexible data manipulation and processing within workflows.\n\n### 🔄 Inputs / Outputs\n- **Inputs:** \n  - Mu"
      }
    },
    {
      "id": "7c8e9e6c-aa5e-4ecb-8669-f86051cce7ab",
      "name": "Sticky Note - Delete old backup folder",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1504,
        448
      ],
      "parameters": {
        "width": 380,
        "height": 668,
        "content": "## 🗑️ Delete Old Backup Folder \n\n### 🎯 Purpose\nRemove outdated backup folders from Microsoft OneDrive to maintain organization and free up space.\n\n### 🔄 Inputs / Outputs\n- **Inputs:** \n  - Folder ID o"
      }
    },
    {
      "id": "c56f7762-dcfe-4078-ba90-2d14e9a05b31",
      "name": "Sticky Note - Loop Over Items",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1920,
        448
      ],
      "parameters": {
        "width": 380,
        "height": 620,
        "content": "## 📁 Loop Over Items \n\n### 🎯 Purpose\nRemove old folder 1 by 1\n\n### 🔄 Inputs / Outputs\n- **Inputs:** \n  - A list of items to be processed.\n- **Outputs:** \n  - A series of batches, each containing a sub"
      }
    },
    {
      "id": "e4ccfaed-5fce-4b58-8757-f5883787b979",
      "name": "Sticky Note - Switch Old Folders",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2464,
        272
      ],
      "parameters": {
        "width": 380,
        "height": 732,
        "content": "## 🔄 Switch Old Folders \n\n### 🎯 Purpose\nThis node determines the presence of old folders and routes the workflow based on that condition.\n\n### 🔄 Inputs / Outputs\n- **Inputs:** \n  - Boolean input `hasO"
      }
    },
    {
      "id": "8801d8ea-a8c3-4e5d-bc7b-4c5ecd0a9822",
      "name": "Sticky Note - Filter backup folder",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2976,
        272
      ],
      "parameters": {
        "width": 380,
        "height": 876,
        "content": "## 📁 Filter Backup Folder \n\n### 🎯 Purpose\nThis node filters and identifies backup folders that are older than 31 days, allowing for effective management and cleanup of dated backups.\n- Change the \"Day"
      }
    },
    {
      "id": "8b871fe0-f8f4-48c1-9954-4ddb0a835293",
      "name": "Sticky Note - Get backupfolders",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3392,
        272
      ],
      "parameters": {
        "width": 380,
        "height": 748,
        "content": "## 📁 Get backup folders \n\n## Folder ID need the be insert \n\n### 🎯 Purpose\nRetrieve a list of backuped folders from your main backup folder to remove old backups folders.\n\n### 🔄 Inputs / Outputs\n- **In"
      }
    },
    {
      "id": "05e566d8-2cf1-4d6a-ae96-8800a5ba3d43",
      "name": "Sticky Note - Upload JSON to folder",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3824,
        272
      ],
      "parameters": {
        "width": 380,
        "height": 876,
        "content": "## 📁 Upload JSON to Folder \n\n### 🎯 Purpose\nUpload the JSON file(s) to newly create backup folder.\n\n### 🔄 Inputs / Outputs\n- **Inputs:** \n  - JSON file data to be uploaded.\n  - Parent folder ID where t"
      }
    },
    {
      "id": "77768b3c-e607-4896-ba99-5f6ae71d40bc",
      "name": "Sticky Note - Convert to JSON file",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4288,
        272
      ],
      "parameters": {
        "width": 380,
        "height": 876,
        "content": "## 📄 Convert to JSON file \n\n### 🎯 Purpose\nConvert the workflows into a JSON file.\n\n### 🔄 Inputs / Outputs\n- **Inputs:** \n  - Data to be formatted as JSON.\n- **Outputs:** \n  - A JSON file generated bas"
      }
    },
    {
      "id": "a60decc9-42fc-465d-a89f-f552e6a84814",
      "name": "Sticky Note - Retrieve workflows",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4736,
        272
      ],
      "parameters": {
        "width": 380,
        "height": 876,
        "content": "## 📁 Retrieve Workflows \n\n### 🎯 Purpose\nFetch existing workflows from n8n, enabling users to review and document their configurations easily.\n\n### 🔄 Inputs / Outputs\n- **Inputs:** \n  - No specific inp"
      }
    },
    {
      "id": "52972885-4bad-4a28-b02c-fd454d97a97f",
      "name": "Sticky Note - Search a folder",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -5424,
        -944
      ],
      "parameters": {
        "width": 540,
        "height": 860,
        "content": "## 🔍 Search a Folder \n\n### 🎯 Purpose\nUse to find the Folder ID from your Backup folder, This folder will be used to create new daily folders \n\n### 🔄 Inputs / Outputs\n- **Inputs:** \n  - **Query:** Stri"
      }
    },
    {
      "id": "cc5e9202-f9f3-4cac-a849-9d5f3febbf20",
      "name": "Sticky Note - Create new backup folder",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -5184,
        272
      ],
      "parameters": {
        "width": 380,
        "height": 924,
        "content": "## 📁 Create New Backup Folder\n\n## Folder ID need the be insert \n\n### 🎯 Purpose\nCreate a new folder in Microsoft OneDrive specifically for backing up workflow documentation.\n\n### 🔄 Inputs / Outputs\n- *"
      }
    },
    {
      "id": "ea1105b6-5b0e-4ee6-b1d0-a8f210cce50b",
      "name": "Sticky Note - Schedule Trigger Daily",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -5632,
        272
      ],
      "parameters": {
        "width": 380,
        "height": 876,
        "content": "## 📅 Schedule Trigger Daily \n\n### 🎯 Purpose\nTriggers the workflow daily at a specified time to ensure scheduled actions are automatically executed.\n\n### 🔄 Inputs / Outputs\n- **Inputs:** \n  - None (Thi"
      }
    }
  ],
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Prepare HTML Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ],
        [
          {
            "node": "Delete old backup folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get backupfolders": {
      "main": [
        [
          {
            "node": "Filter backup folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare HTML Email": {
      "main": [
        [
          {
            "node": "Send HTML Success Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve workflows": {
      "main": [
        [
          {
            "node": "Convert to JSON file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch Old Folders": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to JSON file": {
      "main": [
        [
          {
            "node": "Upload JSON to folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter backup folder": {
      "main": [
        [
          {
            "node": "Switch Old Folders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload JSON to folder": {
      "main": [
        [
          {
            "node": "Get backupfolders",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger Daily": {
      "main": [
        [
          {
            "node": "Create new backup folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create new backup folder": {
      "main": [
        [
          {
            "node": "Retrieve workflows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete old backup folder": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}