{
  "name": "Automate droplet snapshots on DigitalOcean",
  "nodes": [
    {
      "id": "b6582c37-00c3-467c-95cb-fc6eb7ccd27d",
      "name": "Filter",
      "type": "n8n-nodes-base.filter",
      "position": [
        1080,
        420
      ]
    },
    {
      "id": "54b0f895-7e56-40eb-bc6c-f657457d004a",
      "name": "List Snapshots for a Droplet",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        840,
        420
      ]
    },
    {
      "id": "7c47438f-db04-41f7-aed6-a460d0a6889b",
      "name": "List All Droplets",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        600,
        420
      ]
    },
    {
      "id": "e751f6a4-0fdc-4be5-84f0-fecba100da09",
      "name": "Delete a Snapshot",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1320,
        420
      ]
    },
    {
      "id": "d4cc4a72-f909-4c10-bada-e5c731e46c5e",
      "name": "Droplet Actions snapshot (n8n.optimus01.co.za)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1560,
        420
      ]
    },
    {
      "id": "4f3be74a-add7-4a2c-99df-d5d47f17efee",
      "name": "Runs every 48hrs",
      "type": "n8n-nodes-base.cron",
      "position": [
        360,
        420
      ]
    },
    {
      "id": "518a7b8c-adf6-448e-9f4a-5acc0f31523d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        300,
        180
      ],
      "parameters": {
        "width": 232.0445295774649,
        "height": 411.1655661971828,
        "content": "## Trigger workflow every 48 hours\n\nThis node triggers the workflow to run every 48 hours. You can adjust the frequency if needed to suit your snapshot management requirements."
      }
    },
    {
      "id": "70fe9177-e770-4f19-8fbc-3782167dda55",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        540,
        180
      ],
      "parameters": {
        "width": 232.0445295774649,
        "height": 411.1655661971829,
        "content": "## Get all droplets from DigitalOcean\nFetches a list of all the droplets in your DigitalOcean account. This is the first step in managing snapshots for each droplet.\n"
      }
    },
    {
      "id": "04d74698-0198-45c8-8a79-183fd5f19820",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        780,
        180
      ],
      "parameters": {
        "width": 232.0445295774649,
        "height": 412.3020619718309,
        "content": "## Retrieve snapshots for a droplet\nRetrieves all the snapshots associated with a specific droplet. This ensures that we know how many snapshots currently exist for each droplet.\n"
      }
    },
    {
      "id": "4a971e9a-dfdf-4932-8280-3991a83c2a72",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1020,
        180
      ],
      "parameters": {
        "width": 232.0445295774649,
        "height": 411.1655661971828,
        "content": "## Check if there are more than 4 snapshots\nChecks if the number of snapshots for a droplet is equal to or greater than 4. If true, it proceeds to delete the oldest snapshot.\n"
      }
    },
    {
      "id": "bb9a553a-a8fc-4b72-b0e0-704ebaf8b806",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1260,
        180
      ],
      "parameters": {
        "width": 232.0445295774649,
        "height": 411.1655661971829,
        "content": "## Delete the oldest snapshot\nDeletes the oldest snapshot from the droplet if the number of snapshots exceeds the limit (4 in this case), based on the filter's condition.\n"
      }
    },
    {
      "id": "1811812f-db56-494a-8ffa-d64cc6f5037c",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1500,
        180
      ],
      "parameters": {
        "width": 232.0445295774649,
        "height": 411.1655661971829,
        "content": "## Create a new snapshot\nCreates a new snapshot for the droplet after cleaning up the old snapshots. Ensures that backups are always up to date."
      }
    },
    {
      "id": "cb2bd85e-578b-4888-9625-ffed7249082c",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -545,
        200
      ],
      "parameters": {
        "width": 366.75796434038665,
        "height": 381.1643518785302,
        "content": "### What this workflow does\n1. **`Runs every 48 hours`**: The workflow is triggered by a cron node that runs every 48 hours, ensuring timely snapshot management.\n2. **`List all droplets`**: The workfl"
      }
    },
    {
      "id": "7fbb406b-9343-4d3c-9876-80cb3b7bd51e",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -165,
        240
      ],
      "parameters": {
        "width": 396.6384066163515,
        "height": 282.5799404564392,
        "content": "### Get More Templates Like This 👇\n[![Video Thumbnail](https://onlinethinking.io/wp-content/uploads/2024/10/Lets-Automate-It-Community.png)](http://onlinethinking.io/community)\n"
      }
    },
    {
      "id": "8afb93b2-e547-4f3b-be25-5ab85a3f477d",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -545,
        600
      ],
      "parameters": {
        "width": 777.0408639013781,
        "height": 201.45195676871373,
        "content": "## Setup\n1. **`DigitalOcean API Key`**: You’ll need to configure the HTTP Request nodes with your DigitalOcean API key. This key is required for authenticating requests to list droplets, retrieve snap"
      }
    },
    {
      "id": "325a4b9c-9bd4-4f29-8595-98f0579d15c1",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        60
      ],
      "parameters": {
        "width": 809.515353297114,
        "height": 944.3745310796205,
        "content": "## Automate Droplet Snapshot Management on DigitalOcean\nBuilt for the [Let's Automate It Community](http://onlinethinking.io/community) by [Optimus Agency](https://optimus01.co.za/)\n\nThis workflow aut"
      }
    },
    {
      "id": "9540cfa4-4b72-40c2-b1d1-5bf3f9bd7884",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -545,
        820
      ],
      "parameters": {
        "width": 777.0408639013781,
        "height": 168.5111194243667,
        "content": "## How to customize this workflow\n- **`Adjust Snapshot Limit`**: Change the value in the filter node if you want to keep more or fewer snapshots.\n- **`Modify Run Frequency`**: The workflow runs every "
      }
    }
  ],
  "connections": {
    "Filter": {
      "main": [
        [
          {
            "node": "Delete a Snapshot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Runs every 48hrs": {
      "main": [
        [
          {
            "node": "List All Droplets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete a Snapshot": {
      "main": [
        [
          {
            "node": "Droplet Actions snapshot (n8n.optimus01.co.za)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List All Droplets": {
      "main": [
        [
          {
            "node": "List Snapshots for a Droplet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Snapshots for a Droplet": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}