{
  "name": "Automatic Notion database backup to Google Drive with Telegram notifications",
  "nodes": [
    {
      "id": "8d1050f1-d77f-4074-8592-e338511c0465",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        208,
        -400
      ],
      "parameters": {
        "width": 463,
        "height": 955,
        "content": "## Notion Backup to Google Drive\n\n**Automatically backup all your Notion databases to Google Drive with version control and automatic cleanup.**\n\n### How it works\n\n1. **Trigger**: Runs manually or on "
      }
    },
    {
      "id": "eb45df90-2c6d-4863-8b31-0af3bec64117",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        736,
        288
      ],
      "parameters": {
        "width": 440,
        "height": 256,
        "content": "## 1. Initialize\n\nTriggers the backup process and loads configuration settings"
      }
    },
    {
      "id": "66c6c6ea-7fe8-49d4-a40b-0f855bf6668d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1248,
        288
      ],
      "parameters": {
        "width": 496,
        "height": 256,
        "content": "## 2. Prepare Backup\n\nCreates timestamped folder and retrieves all Notion databases"
      }
    },
    {
      "id": "e0ec8ea0-8130-40dd-ac86-36c2c77a1d94",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1792,
        256
      ],
      "parameters": {
        "width": 1120,
        "height": 448,
        "content": "## 3. Process Databases\n\nLoops through each database, exports all pages, and uploads to Google Drive"
      }
    },
    {
      "id": "5843c38d-eaf3-410d-87f2-7a671a97ce99",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2960,
        272
      ],
      "parameters": {
        "width": 528,
        "height": 256,
        "content": "## 4. Finalize & Metadata\n\nGenerates backup summary with statistics and success/failure details"
      }
    },
    {
      "id": "10c67ac0-47bc-49c6-9a2f-b3cf58a0dec9",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3536,
        112
      ],
      "parameters": {
        "width": 1136,
        "height": 416,
        "content": "## 5. Cleanup Old Backups\n\nAutomatically deletes backups older than retention period (if enabled)"
      }
    },
    {
      "id": "d95e0e72-8fac-4703-928a-f4c61c962ff3",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4816,
        288
      ],
      "parameters": {
        "width": 576,
        "height": 288,
        "content": "## 6. Send Notification\n\nFormats and sends Telegram notification with backup results"
      }
    },
    {
      "id": "e105d43a-8c22-4aee-9022-d0bff1cfb8dd",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        736,
        16
      ],
      "parameters": {
        "width": 256,
        "height": 240,
        "content": "⚠️ **CRITICAL SETUP**\n\nBefore first run, update the **Configuration Settings** node with:\n- Your Google Drive parent folder ID\n- Your Telegram bot chat ID\n\nWithout these, the workflow will fail!"
      }
    },
    {
      "id": "df9f37f5-d06d-44d5-8574-2ce1822791af",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        800,
        384
      ]
    },
    {
      "id": "6bd07d17-fa58-44ee-ac35-b4c733686434",
      "name": "Configuration Settings",
      "type": "n8n-nodes-base.set",
      "position": [
        1024,
        384
      ]
    },
    {
      "id": "fd6bafaa-3a25-4b54-8bff-c088f2e5aa8b",
      "name": "Create Backup Folder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1328,
        384
      ]
    },
    {
      "id": "81915f5d-ba74-484f-b15e-dea36385e349",
      "name": "Get All Databases",
      "type": "n8n-nodes-base.notion",
      "position": [
        1584,
        384
      ]
    },
    {
      "id": "1c114eb9-55e2-49cd-9266-993e7eb79f2d",
      "name": "Initialize Tracking",
      "type": "n8n-nodes-base.code",
      "position": [
        1840,
        384
      ]
    },
    {
      "id": "e92528b1-5f8d-4f4c-a796-823a22c4d32d",
      "name": "Loop Databases",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        2048,
        384
      ]
    },
    {
      "id": "f41e87bd-aecd-41dd-a015-162e0ba6a0c0",
      "name": "Get Database Pages",
      "type": "n8n-nodes-base.notion",
      "position": [
        2272,
        480
      ]
    },
    {
      "id": "fd168167-7255-4d14-8903-432f6e16219b",
      "name": "Create Backup File",
      "type": "n8n-nodes-base.code",
      "position": [
        2496,
        480
      ]
    },
    {
      "id": "c33cb193-4439-48d7-90cf-c894db4c4e95",
      "name": "Upload Backup File",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2704,
        480
      ]
    },
    {
      "id": "a70580ca-1883-4c3c-9276-8ca581754457",
      "name": "Generate Metadata",
      "type": "n8n-nodes-base.code",
      "position": [
        3072,
        368
      ]
    },
    {
      "id": "aefb78d9-6495-44c9-af95-56b9cf95a538",
      "name": "Upload Metadata",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        3296,
        368
      ]
    },
    {
      "id": "026072e9-0525-4510-8c15-bbd9e2303d0e",
      "name": "Should Cleanup?",
      "type": "n8n-nodes-base.if",
      "position": [
        3600,
        368
      ]
    },
    {
      "id": "fed62555-581b-4070-ac4a-fb691ee88673",
      "name": "List Old Backups",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        3824,
        256
      ]
    },
    {
      "id": "814bf4bb-c1cb-4abc-b7f5-80c205836aad",
      "name": "Filter Old Backups",
      "type": "n8n-nodes-base.code",
      "position": [
        4032,
        256
      ]
    },
    {
      "id": "208eecf9-6cff-42db-a8b4-d19817ae1bbb",
      "name": "Delete Old Backup",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        4512,
        176
      ]
    },
    {
      "id": "57526f8a-9ee1-4d12-a9c4-a3b636f18e50",
      "name": "Format Notification",
      "type": "n8n-nodes-base.code",
      "position": [
        4944,
        384
      ]
    },
    {
      "id": "78461e9b-f611-4aa2-ae2c-300055b28d6f",
      "name": "Send Telegram Notification",
      "type": "n8n-nodes-base.telegram",
      "position": [
        5168,
        384
      ]
    },
    {
      "id": "636274ad-9ffb-4113-a13d-a62a5be7c6d9",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        4224,
        256
      ]
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Delete Old Backup",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Format Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Databases": {
      "main": [
        [
          {
            "node": "Generate Metadata",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Database Pages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Configuration Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Should Cleanup?": {
      "main": [
        [
          {
            "node": "List Old Backups",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Format Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Metadata": {
      "main": [
        [
          {
            "node": "Should Cleanup?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Old Backups": {
      "main": [
        [
          {
            "node": "Filter Old Backups",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete Old Backup": {
      "main": [
        [
          {
            "node": "Format Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Metadata": {
      "main": [
        [
          {
            "node": "Upload Metadata",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get All Databases": {
      "main": [
        [
          {
            "node": "Initialize Tracking",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Backup File": {
      "main": [
        [
          {
            "node": "Upload Backup File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Old Backups": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Database Pages": {
      "main": [
        [
          {
            "node": "Create Backup File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Backup File": {
      "main": [
        [
          {
            "node": "Loop Databases",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Notification": {
      "main": [
        [
          {
            "node": "Send Telegram Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Initialize Tracking": {
      "main": [
        [
          {
            "node": "Loop Databases",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Backup Folder": {
      "main": [
        [
          {
            "node": "Get All Databases",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Configuration Settings": {
      "main": [
        [
          {
            "node": "Create Backup Folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}