{
  "name": "Backup n8n workflows to Bitbucket",
  "nodes": [
    {
      "id": "b3363b9d-ea6e-47b7-99f9-f48a21805886",
      "name": "Calculate Wait Time",
      "type": "n8n-nodes-base.code",
      "position": [
        1400,
        -260
      ]
    },
    {
      "id": "3cbc2287-b36f-4839-87b7-be4a7eadcf79",
      "name": "Run Daily at 2 AM",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -120,
        -20
      ]
    },
    {
      "id": "09b396aa-61e8-4631-8aae-7126fbd609e6",
      "name": "Get All Workflows",
      "type": "n8n-nodes-base.n8n",
      "position": [
        320,
        -20
      ]
    },
    {
      "id": "c46b50cd-432f-4714-ac68-b6f92663b592",
      "name": "Loop Workflows",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        540,
        -20
      ]
    },
    {
      "id": "2a27e85d-51c0-4f45-a7d6-6422fc8a439b",
      "name": "Get Existing Worfklow from Bitbucket",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        780,
        -20
      ]
    },
    {
      "id": "eeb52f03-dd60-46ae-ad86-1cabf7f6c20f",
      "name": "New or Changed?",
      "type": "n8n-nodes-base.if",
      "position": [
        980,
        -20
      ]
    },
    {
      "id": "04400827-d331-4ee2-8a67-1238ea2dc969",
      "name": "Upload Workflow to Bitbucket",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1200,
        -260
      ]
    },
    {
      "id": "5f198366-3bcf-4a96-ae60-da7cc9403a6f",
      "name": "Wait to Avoid Rate Limiting",
      "type": "n8n-nodes-base.wait",
      "position": [
        1620,
        -20
      ]
    },
    {
      "id": "adc37b33-c5af-4a44-ba87-9806efe25603",
      "name": "Set Bitbucket Workspace & Repository",
      "type": "n8n-nodes-base.set",
      "position": [
        100,
        -20
      ]
    }
  ],
  "connections": {
    "Loop Workflows": {
      "main": [
        [],
        [
          {
            "node": "Get Existing Worfklow from Bitbucket",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New or Changed?": {
      "main": [
        [
          {
            "node": "Upload Workflow to Bitbucket",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait to Avoid Rate Limiting",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get All Workflows": {
      "main": [
        [
          {
            "node": "Loop Workflows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Daily at 2 AM": {
      "main": [
        [
          {
            "node": "Set Bitbucket Workspace & Repository",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Wait Time": {
      "main": [
        [
          {
            "node": "Wait to Avoid Rate Limiting",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait to Avoid Rate Limiting": {
      "main": [
        [
          {
            "node": "Loop Workflows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Workflow to Bitbucket": {
      "main": [
        [
          {
            "node": "Calculate Wait Time",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Existing Worfklow from Bitbucket": {
      "main": [
        [
          {
            "node": "New or Changed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Bitbucket Workspace & Repository": {
      "main": [
        [
          {
            "node": "Get All Workflows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}