{
  "name": "Process incoming files and notify via email with GitHub storage",
  "nodes": [
    {
      "id": "ef26b9a6-1831-46e6-bcab-181075c3a072",
      "name": "Workflow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -384,
        208
      ],
      "parameters": {
        "width": 550,
        "height": 706,
        "content": "## How it works\nThis workflow runs on a fixed schedule and checks an external endpoint for any newly-uploaded files that need processing.  If files exist, each one is downloaded in turn and its type i"
      }
    },
    {
      "id": "7b77f257-297a-4c42-b211-f3923de8c071",
      "name": "Trigger & Fetch",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        304
      ],
      "parameters": {
        "width": 994,
        "height": 654,
        "content": "## Trigger & Retrieval\nThis section contains the **Schedule Trigger** that launches the workflow and the HTTP Request that fetches the list of files waiting to be processed.  A preliminary Code node c"
      }
    },
    {
      "id": "e57d8c88-feed-49e8-85d1-6d7a74cc246c",
      "name": "Processing & Validation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1520,
        288
      ],
      "parameters": {
        "width": 1026,
        "height": 654,
        "content": "## Processing & Validation\nNodes in this cluster handle per-file work.  Files arrive one at a time via **SplitInBatches**, get downloaded, then routed by an IF node that checks MIME/type.  CSVs are pa"
      }
    },
    {
      "id": "f1c7b100-a7bc-47f2-8bfa-43c5ec84d1f6",
      "name": "Storage & Notification",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2576,
        304
      ],
      "parameters": {
        "width": 994,
        "height": 622,
        "content": "## Storage & Notification\nAfter a record set passes validation, it is wrapped in JSON, committed to GitHub and the success branch crafts a confirmation email.  Any failure along the way jumps to an al"
      }
    },
    {
      "id": "267a08d7-e5dd-4beb-8e7e-53f71655aab2",
      "name": "Daily File Check",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        512,
        576
      ]
    },
    {
      "id": "45b00107-991d-410a-a9c1-b1d454ac6d38",
      "name": "Fetch File List",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        704,
        576
      ]
    },
    {
      "id": "acf76dcf-9922-4e18-a640-d18b8143eb61",
      "name": "Check File Count",
      "type": "n8n-nodes-base.code",
      "position": [
        912,
        576
      ]
    },
    {
      "id": "f55e226c-09e7-40df-a0d2-032e4b8325bd",
      "name": "Any New Files?",
      "type": "n8n-nodes-base.if",
      "position": [
        1104,
        576
      ]
    },
    {
      "id": "5e90a2c9-8a61-4158-9d0e-ccbbaf3671a8",
      "name": "Prepare File Items",
      "type": "n8n-nodes-base.code",
      "position": [
        1312,
        576
      ]
    },
    {
      "id": "eab73259-410f-40ae-add9-d0ab535dc08b",
      "name": "Iterate Files",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1504,
        576
      ]
    },
    {
      "id": "3a5a7674-e38e-4325-8d49-889ec1f43ad5",
      "name": "Download File",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1712,
        576
      ]
    },
    {
      "id": "2c1cc809-e708-4a24-b792-ef052ac88897",
      "name": "Is CSV?",
      "type": "n8n-nodes-base.if",
      "position": [
        1904,
        576
      ]
    },
    {
      "id": "2b67be02-6092-4309-8f8f-2106caeb58fe",
      "name": "Parse CSV",
      "type": "n8n-nodes-base.code",
      "position": [
        2112,
        576
      ]
    },
    {
      "id": "e775790b-55c1-4835-aab4-2ccef039a327",
      "name": "Validate Data",
      "type": "n8n-nodes-base.code",
      "position": [
        2304,
        576
      ]
    },
    {
      "id": "bdfd326d-0806-44b8-bab3-5cc1b3a29426",
      "name": "Validation Passed?",
      "type": "n8n-nodes-base.if",
      "position": [
        2656,
        576
      ]
    },
    {
      "id": "77243b3b-8b6f-403b-abac-1900ca662af1",
      "name": "Prepare GitHub Commit",
      "type": "n8n-nodes-base.set",
      "position": [
        2832,
        496
      ]
    },
    {
      "id": "9595ba2f-a213-4bc6-9813-8b3e83bbb226",
      "name": "Create/Update File",
      "type": "n8n-nodes-base.github",
      "position": [
        2992,
        480
      ]
    },
    {
      "id": "d7468b8b-c647-411a-9a6f-8f65ebff11d8",
      "name": "Success Email Content",
      "type": "n8n-nodes-base.set",
      "position": [
        3152,
        512
      ]
    },
    {
      "id": "814955dc-d483-470d-af17-a8feb058678c",
      "name": "Send Success Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        3360,
        544
      ]
    },
    {
      "id": "94405ec6-a93c-412c-8a2b-f1973ca4b650",
      "name": "Error Email Content",
      "type": "n8n-nodes-base.set",
      "position": [
        2768,
        784
      ]
    },
    {
      "id": "cc483eaf-cce5-4232-8769-269f296f03d1",
      "name": "Send Error Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        3040,
        784
      ]
    }
  ],
  "connections": {
    "Is CSV?": {
      "main": [
        [
          {
            "node": "Parse CSV",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error Email Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse CSV": {
      "main": [
        [
          {
            "node": "Validate Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download File": {
      "main": [
        [
          {
            "node": "Is CSV?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Iterate Files": {
      "main": [
        [
          {
            "node": "Download File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Data": {
      "main": [
        [
          {
            "node": "Validation Passed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Any New Files?": {
      "main": [
        [
          {
            "node": "Prepare File Items",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error Email Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch File List": {
      "main": [
        [
          {
            "node": "Check File Count",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check File Count": {
      "main": [
        [
          {
            "node": "Any New Files?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily File Check": {
      "main": [
        [
          {
            "node": "Fetch File List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create/Update File": {
      "main": [
        [
          {
            "node": "Success Email Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare File Items": {
      "main": [
        [
          {
            "node": "Iterate Files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validation Passed?": {
      "main": [
        [
          {
            "node": "Prepare GitHub Commit",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error Email Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Error Email Content": {
      "main": [
        [
          {
            "node": "Send Error Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare GitHub Commit": {
      "main": [
        [
          {
            "node": "Create/Update File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Success Email Content": {
      "main": [
        [
          {
            "node": "Send Success Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}