{
  "name": "One-way sync Stripe invoice PDFs to a S3 bucket",
  "nodes": [
    {
      "id": "d72750fc-6415-4da6-977a-46d025a91ef9",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -900,
        900
      ]
    },
    {
      "id": "b00e7434-f83e-438e-a47b-12d4a2c4fe5b",
      "name": "List Invoices",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        180,
        900
      ]
    },
    {
      "id": "c142f60b-dbbd-444a-b39b-365e9eb1ff58",
      "name": "Inject s3 Subpath",
      "type": "n8n-nodes-base.set",
      "position": [
        820,
        640
      ]
    },
    {
      "id": "4cdd4338-7225-442b-8df6-44bebfe6d5e9",
      "name": "Set-Subpath",
      "type": "n8n-nodes-base.set",
      "position": [
        1000,
        640
      ]
    },
    {
      "id": "4965110b-0516-4a5d-9b04-8ccbb337f9d5",
      "name": "We do only Invoice Objects",
      "type": "n8n-nodes-base.if",
      "position": [
        360,
        900
      ]
    },
    {
      "id": "def30f79-593f-48b3-b46f-29c5329a59ae",
      "name": "It shouldn't be something else",
      "type": "n8n-nodes-base.stopAndError",
      "position": [
        580,
        1042.3086136912689
      ]
    },
    {
      "id": "927c4bbd-5a57-4929-aebb-b187690108ac",
      "name": "ENV*",
      "type": "n8n-nodes-base.set",
      "position": [
        -500,
        900
      ]
    },
    {
      "id": "dd75af83-6e0a-4685-a3bd-1622e2c800de",
      "name": "Download Invoice PDF from Stripe",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        580,
        640
      ]
    },
    {
      "id": "30c4090d-043c-4b3b-b86c-df1e10544b2e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -600,
        802.3086136912689
      ],
      "parameters": {
        "width": 305.7072653471566,
        "height": 670.9306322684054,
        "content": "## 👇  Configure here\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n`folderName` *(optional)* = Subfolder for your Invoices, otherwise it will create in root. e.g: \"invoices\"\n\n`bucketName` *(required)* = the S3 Bucket Name, where i"
      }
    },
    {
      "id": "4134f369-84de-4019-a014-1d823ec77668",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        780,
        480
      ],
      "parameters": {
        "width": 362.3514596119466,
        "height": 336.03175807685056,
        "content": "## Build Pathes\n\n*yourFolder/invoiceYear/invoiceMonth/fileName*\n\ne.g.: invoices/2024/12/invoice-number-123.pdf"
      }
    },
    {
      "id": "c8ecef82-ef73-4920-b9fa-16220009f7d9",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1203.398651655887,
        482.2657677705912
      ],
      "parameters": {
        "width": 283.04958764124035,
        "height": 329.9325827943702,
        "content": "## Upload to Bucket\n\n**⚠️ You might want to check Storage Class, ACL, etc.**"
      }
    },
    {
      "id": "a0505cc0-8312-46f2-970d-bfabff881ced",
      "name": "Every Month the First Day of the Month",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -900,
        1102.3086136912689
      ]
    },
    {
      "id": "53ee7468-f478-4c10-8767-1aa7967b3225",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -100,
        820
      ],
      "parameters": {
        "width": 232,
        "height": 256,
        "content": "### Use Stripe Predefined Credential"
      }
    },
    {
      "id": "6055b93d-0462-4d1a-974a-7d31143e6b79",
      "name": "Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1360,
        780
      ],
      "parameters": {
        "width": 367.15098241985504,
        "height": 485.66522445338995,
        "content": "## Instructions\n\nThis automation syncs monthly your Invoice PDF from Stripe to a (AWS) S3 Bucket of your choice with the following subPaths (Key):\n\n*yourFolder/invoiceYear/invoiceMonth/fileName*\n\n\nFil"
      }
    },
    {
      "id": "c5e5946c-c74f-435f-9664-491bbbca00f2",
      "name": "Get all Invoices*",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -40,
        900
      ]
    },
    {
      "id": "5ed183d2-3001-40ef-9dc6-897c6789209a",
      "name": "Upload to S3 Bucket*",
      "type": "n8n-nodes-base.awsS3",
      "position": [
        1280,
        640
      ]
    },
    {
      "id": "04b57622-64b2-4c62-b84b-61d49c3171fb",
      "name": "Clean and Escape ENV",
      "type": "n8n-nodes-base.set",
      "position": [
        -240,
        900
      ]
    }
  ],
  "connections": {
    "ENV*": {
      "main": [
        [
          {
            "node": "Clean and Escape ENV",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set-Subpath": {
      "main": [
        [
          {
            "node": "Upload to S3 Bucket*",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Invoices": {
      "main": [
        [
          {
            "node": "We do only Invoice Objects",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get all Invoices*": {
      "main": [
        [
          {
            "node": "List Invoices",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Inject s3 Subpath": {
      "main": [
        [
          {
            "node": "Set-Subpath",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean and Escape ENV": {
      "main": [
        [
          {
            "node": "Get all Invoices*",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "We do only Invoice Objects": {
      "main": [
        [
          {
            "node": "Download Invoice PDF from Stripe",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "It shouldn't be something else",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Invoice PDF from Stripe": {
      "main": [
        [
          {
            "node": "Inject s3 Subpath",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "ENV*",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Every Month the First Day of the Month": {
      "main": [
        [
          {
            "node": "ENV*",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}