{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "4a011d72-5efd-4489-8371-478c0906dbf9",
      "name": "Processing Sticky",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        656,
        1392
      ],
      "parameters": {
        "color": 7,
        "width": 780,
        "height": 380,
        "content": "### \u2699\ufe0f Processing & Consolidation\nNodes grouped here handle the downloading, batching, and merging of validated binary data."
      },
      "typeVersion": 1
    },
    {
      "id": "2e6c337f-1c68-4f86-9b7c-93276777af97",
      "name": "Merge multiple PDFS into one",
      "type": "n8n-nodes-htmlcsstopdf.htmlcsstopdf",
      "position": [
        1120,
        1536
      ],
      "parameters": {
        "resource": "pdfManipulation"
      },
      "credentials": {
        "htmlcsstopdfApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4ad15d38-d0f0-4446-85e6-a06c37aee070",
      "name": "Trigger: Monthly on the 1st1",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        32,
        1552
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "months"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "06d90181-4b77-4a42-b573-37d8c8a0b833",
      "name": "List Financial PDFs from Drive1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        256,
        1552
      ],
      "parameters": {
        "resource": "folder",
        "operation": "list"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "46680caa-e991-46b7-a0ef-15d874749aea",
      "name": "Validate File Format (PDF only)1",
      "type": "n8n-nodes-base.if",
      "position": [
        480,
        1552
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.mimeType }}",
              "value2": "application/pdf"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0b886372-f371-496e-be0f-5f0300d5f5c0",
      "name": "Download Documents for Processing1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        704,
        1536
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "023d1e62-46f2-423b-8790-c8d225bfdd2c",
      "name": "Batch Files for Merging1",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        912,
        1536
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "fieldToAggregate": "data"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "12d1459a-2963-4e1f-bbff-e0ef69b73fe6",
      "name": "Upload Consolidated Master Report1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1360,
        1536
      ],
      "parameters": {
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "49317e2c-6952-4d1e-96c0-c0843d03620c",
      "name": "Notify Finance Team (Slack)1",
      "type": "n8n-nodes-base.slack",
      "position": [
        1584,
        1536
      ],
      "parameters": {
        "text": "=\u2705 *Monthly Finance Bundle Generated* for {{$now.setZone('America/New_York').toFormat('MMMM yyyy')}}\n\nYour consolidated report is now available in Drive.\nFile: `{{ $node[\"Merge multiple PDFS into one\"].json.fileName }}`",
        "user": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "select": "user",
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "dc04a0ed-89ed-4a50-94e1-d3e2901fc775",
      "name": "Main Documentation1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        944
      ],
      "parameters": {
        "width": 460,
        "height": 420,
        "content": "## How it works\nThis workflow automates the gathering and merging of financial records. It triggers monthly, scans a specific Google Drive folder for PDF files, and validates the file types to prevent errors. All identified PDFs are then merged into a single \"Master Report\" using the HTML/CSS to PDF service and uploaded back to Drive. Finally, it sends a formatted notification to the finance team via Slack.\n\n## Setup steps\n1. **Google Drive**: Connect your account and select the folder containing your docs.\n2. **HTML/CSS to PDF**: Add API credentials to the merge node.\n3. **Slack**: Choose the #finance-dept channel for notifications.\n4. **Time-stamping**: The workflow uses Luxon expressions `{{$now.format('MMMM')}}` to automatically label reports by current month."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Batch Files for Merging1": {
      "main": [
        [
          {
            "node": "Merge multiple PDFS into one",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge multiple PDFS into one": {
      "main": [
        [
          {
            "node": "Upload Consolidated Master Report1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger: Monthly on the 1st1": {
      "main": [
        [
          {
            "node": "List Financial PDFs from Drive1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Financial PDFs from Drive1": {
      "main": [
        [
          {
            "node": "Validate File Format (PDF only)1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate File Format (PDF only)1": {
      "main": [
        [
          {
            "node": "Download Documents for Processing1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Documents for Processing1": {
      "main": [
        [
          {
            "node": "Batch Files for Merging1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Consolidated Master Report1": {
      "main": [
        [
          {
            "node": "Notify Finance Team (Slack)1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}