{
  "name": "🗜️ Automate image compression in Google Drive with Tinify API and email reports",
  "nodes": [
    {
      "id": "be3e62b9-5bd4-4ea5-a48a-b034a0f164ca",
      "name": "Save to Remove Background",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1168,
        192
      ]
    },
    {
      "id": "6e535295-a2b0-40cb-9ac4-0a000bf17d96",
      "name": "Get all files",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        96,
        288
      ]
    },
    {
      "id": "559ee1f9-6f93-4b05-8a4d-3702b68db6b6",
      "name": "Daily at 08:00 am",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -272,
        384
      ]
    },
    {
      "id": "4726eaa0-6726-42e1-8869-d4e7ae3a11cd",
      "name": "Tiny URL API Call",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        752,
        112
      ]
    },
    {
      "id": "6c1b3c2d-9d17-4c8c-b232-6ea2c8239751",
      "name": "Load Raw Image",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        528,
        112
      ]
    },
    {
      "id": "61712bd4-7b3f-45ab-85ce-d6f389bfb98f",
      "name": "Download Compressed Image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        976,
        112
      ]
    },
    {
      "id": "af8fdf34-004b-459b-98a4-c1de21dfce50",
      "name": "Move Files to the Folder /Original",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        736,
        464
      ]
    },
    {
      "id": "dba1c9be-4681-4a6c-9391-c283ae6b5232",
      "name": "Loop Over Processed Files",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        320,
        496
      ]
    },
    {
      "id": "45fd4fd1-5542-461d-995f-9907fca4c91f",
      "name": "Loop Over Original Files",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        304,
        192
      ]
    },
    {
      "id": "c94d5cec-5cc0-467f-a7e0-544da6e8a470",
      "name": "Generate Processing Id",
      "type": "n8n-nodes-base.set",
      "position": [
        -48,
        384
      ]
    },
    {
      "id": "b2cf7310-e8be-4dc9-85b1-c577d154fde5",
      "name": "Processing Logs",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        1312,
        80
      ]
    },
    {
      "id": "15145b80-ff7b-422b-ad98-9a74e748046b",
      "name": "Generate Report",
      "type": "n8n-nodes-base.code",
      "position": [
        -64,
        720
      ]
    },
    {
      "id": "0e0808a0-016b-46a4-be16-a461e6fa8e7f",
      "name": "Collect Logs",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        -256,
        720
      ]
    },
    {
      "id": "c2140aaa-4c2c-40b6-8568-5cb6612bc101",
      "name": "Send Report",
      "type": "n8n-nodes-base.gmail",
      "position": [
        112,
        720
      ]
    },
    {
      "id": "68de5d92-ff4e-434c-95a5-2f0002096e6e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -848,
        64
      ],
      "parameters": {
        "width": 544,
        "height": 784,
        "content": "## Image Compressor using Tinyfy API\n\n### How it works\n1. A schedule trigger runs every morning at 08:00 and generates a unique `processingId` for the execution.\n2. The workflow lists all images in yo"
      }
    },
    {
      "id": "5c938d32-7fef-4d8d-8717-bedfae691332",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -288,
        64
      ],
      "parameters": {
        "width": 524,
        "height": 524,
        "content": "## 1. Daily trigger to fetch all the pictures to compress and generate a random processing Id"
      }
    },
    {
      "id": "bb35f04e-4d62-4796-b775-8b418bd2851f",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        256,
        64
      ],
      "parameters": {
        "width": 1180,
        "height": 316,
        "content": "## 2. Compress each image using Tinyfy API and log the results"
      }
    },
    {
      "id": "5b5b986a-6d11-4bd5-8aea-a6865563f224",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        256,
        400
      ],
      "parameters": {
        "width": 636,
        "height": 252,
        "content": "## 3. Move the images that have been compressed to the folder for processed images"
      }
    },
    {
      "id": "0558053c-9d5e-47cf-9ea2-af868d95165e",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -288,
        656
      ],
      "parameters": {
        "width": 1180,
        "height": 188,
        "content": "## 4. Load all logs of the current `processingId` to generate a report sent by email"
      }
    },
    {
      "id": "932f6365-26b1-4d1f-89ff-b23fba9f42e2",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        912,
        400
      ],
      "parameters": {
        "width": 528,
        "height": 432,
        "content": "## [Video Tutorial](https://youtu.be/qXQVcaJgwrA)\n@[youtube](qXQVcaJgwrA)"
      }
    }
  ],
  "connections": {
    "Collect Logs": {
      "main": [
        [
          {
            "node": "Generate Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get all files": {
      "main": [
        [
          {
            "node": "Loop Over Original Files",
            "type": "main",
            "index": 0
          },
          {
            "node": "Loop Over Processed Files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Load Raw Image": {
      "main": [
        [
          {
            "node": "Tiny URL API Call",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Report": {
      "main": [
        [
          {
            "node": "Send Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Processing Logs": {
      "main": [
        []
      ]
    },
    "Daily at 08:00 am": {
      "main": [
        [
          {
            "node": "Generate Processing Id",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tiny URL API Call": {
      "main": [
        [
          {
            "node": "Download Compressed Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Processing Id": {
      "main": [
        [
          {
            "node": "Get all files",
            "type": "main",
            "index": 0
          },
          {
            "node": "Collect Logs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Original Files": {
      "main": [
        [],
        [
          {
            "node": "Load Raw Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Compressed Image": {
      "main": [
        [
          {
            "node": "Save to Remove Background",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Processed Files": {
      "main": [
        [],
        [
          {
            "node": "Move Files to the Folder /Original",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save to Remove Background": {
      "main": [
        [
          {
            "node": "Processing Logs",
            "type": "main",
            "index": 0
          },
          {
            "node": "Loop Over Original Files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Move Files to the Folder /Original": {
      "main": [
        [
          {
            "node": "Loop Over Processed Files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}