{
  "name": "Backup & restore n8n workflows with Telegram, Google Drive and form upload",
  "nodes": [
    {
      "id": "5b97598a-3366-4294-b76d-273c00ef1fdd",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        6000,
        1040
      ]
    },
    {
      "id": "33b8396b-2889-4daf-8ffb-bc11a4324448",
      "name": "Schedule Backup Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        5984,
        560
      ]
    },
    {
      "id": "81c12768-16bd-4103-a1eb-24af472c457a",
      "name": "Note: Schedule Trigger",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5904,
        352
      ],
      "parameters": {
        "width": 376,
        "height": 176,
        "content": "## ⏰ Schedule Backup Trigger\n\n**Purpose:** Initiates automated workflow export every 3 days.\n\n**Note:** Adjust interval in node settings for custom frequency (e.g., daily)."
      }
    },
    {
      "id": "290dfccd-f8a1-467d-a65f-9f5774e2d8ee",
      "name": "Fetch All Workflows",
      "type": "n8n-nodes-base.n8n",
      "position": [
        6208,
        560
      ]
    },
    {
      "id": "58f2ba7e-aa94-43fe-a103-9ef22e1d2f2a",
      "name": "Note: Fetch Workflows",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5952,
        720
      ],
      "parameters": {
        "width": 488,
        "height": 144,
        "content": "## 🔍 Fetch All Workflows\n\n**Purpose:** Retrieves complete list of n8n workflows via API.\n\n**Note:** Requires n8n API credential; outputs JSON array for aggregation."
      }
    },
    {
      "id": "9d9356c3-9683-47a9-9a21-7ba579cbb280",
      "name": "Aggregate Workflows",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        6416,
        560
      ]
    },
    {
      "id": "03200b93-3f13-47f8-a0ff-700e17e2fe6b",
      "name": "Note: Aggregate Data",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6352,
        368
      ],
      "parameters": {
        "width": 360,
        "height": 176,
        "content": "## 📊 Aggregate Workflows\n\n**Purpose:** Combines fetched workflows into single JSON array.\n\n**Note:** Uses 'aggregateAllItemData' to prepare for file conversion."
      }
    },
    {
      "id": "862faac9-bfd8-4b11-a467-2eeb0d54292d",
      "name": "Convert to Backup File",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        6640,
        560
      ]
    },
    {
      "id": "ade96952-54bc-444c-9bdd-57fd4a798169",
      "name": "Note: Convert File",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6528,
        720
      ],
      "parameters": {
        "width": 472,
        "height": 144,
        "content": "## 📄 Convert to Backup File\n\n**Purpose:** Transforms JSON array to downloadable text file.\n\n**Note:** Sources 'data' property; sets filename to 'All-n8n-workflows.txt'."
      }
    },
    {
      "id": "f2b52a80-00ad-4316-aa6f-4bef50626826",
      "name": "Send Backup to Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        6848,
        560
      ]
    },
    {
      "id": "b33de46e-16c6-4939-b9dd-ad181bb6d1b2",
      "name": "Note: Send to Telegram",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        7136,
        560
      ],
      "parameters": {
        "width": 344,
        "height": 176,
        "content": "## 📤 Send Backup to Telegram\n\n**Purpose:** Delivers backup file to specified chat.\n\n**Note:** Replace '{{your_chat_id}}' with your Telegram chat ID; requires bot credential."
      }
    },
    {
      "id": "72b820a1-4af5-45c2-bb43-e061d8d44177",
      "name": "Download Backup from Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        6240,
        1040
      ]
    },
    {
      "id": "75ebfa45-7372-41a6-868e-73c7ea4df4bc",
      "name": "Note: Download from Drive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6352,
        896
      ],
      "parameters": {
        "width": 280,
        "height": 208,
        "content": "## 📥 Download Backup from Drive\n\n**Purpose:** Fetches backup text file from Google Drive.\n\n**Note:** Set '{{your_file_id}}' from Drive URL; requires OAuth credential."
      }
    },
    {
      "id": "437b283a-1f3e-4297-be0d-60d9aa5a1e3b",
      "name": "Form Restore Trigger",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        6224,
        1264
      ]
    },
    {
      "id": "dfe569ab-8a3d-4665-9217-0239fb82cad2",
      "name": "Note: Form Trigger",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5952,
        1424
      ],
      "parameters": {
        "width": 280,
        "height": 192,
        "content": "## 📝 Form Restore Trigger\n\n**Purpose:** Enables direct file upload for restore.\n\n**Note:** Use n8n form to submit local backup; connects to extraction."
      }
    },
    {
      "id": "319499bc-5aab-4608-a53f-14681ff37879",
      "name": "Extract Backup Text",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        6400,
        1184
      ]
    },
    {
      "id": "8c8b6f65-2265-4d5e-ae5d-64e060c18a17",
      "name": "Note: Extract Text",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6304,
        1424
      ],
      "parameters": {
        "width": 392,
        "height": 192,
        "content": "## 📖 Extract Backup Text\n\n**Purpose:** Reads text content from downloaded or uploaded file.\n\n**Note:** Outputs raw JSON string to 'data' property for parsing."
      }
    },
    {
      "id": "c364c0f4-956c-4893-8cfa-2c3f49b87d53",
      "name": "Parse Backup JSON",
      "type": "n8n-nodes-base.code",
      "position": [
        6576,
        1184
      ]
    },
    {
      "id": "05297227-aff4-4c99-a45d-c73f7c4c15fa",
      "name": "Note: Parse JSON",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6752,
        1424
      ],
      "parameters": {
        "width": 456,
        "height": 176,
        "content": "## 🔄 Parse Backup JSON\n\n**Purpose:** Cleans and splits JSON into individual workflow items.\n\n**Note:** Removes IDs, unsupported settings; outputs one item per workflow with metadata."
      }
    },
    {
      "id": "8b7750d5-5edb-4e1c-8abf-6124bc5de56a",
      "name": "Process Each Workflow",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        6752,
        1024
      ]
    },
    {
      "id": "2c33e527-7e91-4f55-be2e-92d6b2cbbeec",
      "name": "Note: Workflow Loop",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        7104,
        864
      ],
      "parameters": {
        "width": 360,
        "height": 192,
        "content": "## 🔄 Process Each Workflow\n\n**Purpose:** Loops over parsed items for sequential API calls.\n\n**Note:** Uses SplitInBatches to handle one workflow at a time; returns to loop after processing."
      }
    },
    {
      "id": "74eaf063-91e3-4bfd-a52e-4284fe317a89",
      "name": "Check Workflow Existence",
      "type": "n8n-nodes-base.n8n",
      "position": [
        6944,
        1088
      ]
    },
    {
      "id": "a7d3a105-06bb-47de-90ce-f0c63ac6f99b",
      "name": "If Workflow Exists",
      "type": "n8n-nodes-base.if",
      "position": [
        7104,
        1088
      ]
    },
    {
      "id": "ff3a4413-c015-4b89-a5b8-02b4329669a0",
      "name": "Create New Workflow",
      "type": "n8n-nodes-base.n8n",
      "position": [
        7504,
        1200
      ]
    },
    {
      "id": "12136a58-7361-4693-ae20-09f29c5c2357",
      "name": "Update Existing Workflow",
      "type": "n8n-nodes-base.n8n",
      "position": [
        7280,
        1216
      ]
    },
    {
      "id": "f9de86be-f71a-449d-8968-1353d04dd32c",
      "name": "Wait for Completion",
      "type": "n8n-nodes-base.wait",
      "position": [
        7696,
        1216
      ]
    },
    {
      "id": "9a316313-8f57-4376-90d4-1c5d68f03a7a",
      "name": "Note: Wait Delay",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        7680,
        1008
      ],
      "parameters": {
        "width": 328,
        "height": 176,
        "content": "## ⏳ Wait for Completion\n\n**Purpose:** Pauses between API calls to avoid rate limits.\n\n**Note:** Default 1s delay; increase to 5-10s for large batches."
      }
    },
    {
      "id": "9c3e12fb-9375-4c5c-b19e-e67c7a717599",
      "name": "Overview Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5280,
        368
      ],
      "parameters": {
        "width": 600,
        "height": 1256,
        "content": "# Automated n8n Workflow Backup & Multi-Path Restore\n\n## 📋 What This Template Does\nThis template automates backing up all n8n workflows to a Telegram-delivered text file every 3 days and restores them"
      }
    }
  ],
  "connections": {
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Download Backup from Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Backup JSON": {
      "main": [
        [
          {
            "node": "Process Each Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Workflow Exists": {
      "main": [
        [
          {
            "node": "Create New Workflow",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Existing Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Workflows": {
      "main": [
        [
          {
            "node": "Convert to Backup File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create New Workflow": {
      "main": [
        [
          {
            "node": "Wait for Completion",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Process Each Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Backup Text": {
      "main": [
        [
          {
            "node": "Parse Backup JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch All Workflows": {
      "main": [
        [
          {
            "node": "Aggregate Workflows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Completion": {
      "main": [
        [
          {
            "node": "Process Each Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Form Restore Trigger": {
      "main": [
        [
          {
            "node": "Extract Backup Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Each Workflow": {
      "main": [
        [],
        [
          {
            "node": "Check Workflow Existence",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to Backup File": {
      "main": [
        [
          {
            "node": "Send Backup to Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Backup Trigger": {
      "main": [
        [
          {
            "node": "Fetch All Workflows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Workflow Existence": {
      "main": [
        [
          {
            "node": "If Workflow Exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Existing Workflow": {
      "main": [
        [
          {
            "node": "Process Each Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Backup from Drive": {
      "main": [
        [
          {
            "node": "Extract Backup Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}