{
  "name": "Track invoice spending vs budget from Google Drive with GPT-4o and Telegram alerts",
  "nodes": [
    {
      "id": "1c7353fe-71c5-4856-91b5-c7ce0603cbf3",
      "name": "README",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        157456,
        94896
      ],
      "parameters": {
        "width": 900,
        "height": 3392,
        "content": "# Invoice Budget Tracker\n\nAuto-categorize business invoices and track spending vs budget with AI alerts.\n\n## Quick Start Guide\n\n## 1. Setup Google Drive\n### 1.1 Create Google OAuth credentials\n- https"
      }
    },
    {
      "id": "77376161-4a33-4f2a-92bd-febc5d521630",
      "name": "Budget Agent",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        158384,
        96528
      ],
      "parameters": {
        "width": 3092,
        "height": 676,
        "content": "## 2. Budget Management AI Agent\nTelegram-based budget configuration via AI Agent + MCP Storage"
      }
    },
    {
      "id": "bb80a7e2-993f-450a-9cbe-7f2fbf9208b7",
      "name": "Weekly Summary",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        158384,
        97232
      ],
      "parameters": {
        "width": 1660,
        "height": 428,
        "content": "## 3. Weekly Budget Check\nWeekly check on current month's budget progress (every Friday)"
      }
    },
    {
      "id": "40784f04-0883-487c-8774-aabcd1727f50",
      "name": "DownloadInvoice",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        160112,
        95248
      ]
    },
    {
      "id": "f032ae09-11e3-499c-9d8c-b68713247533",
      "name": "CheckInvoiceExists",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        158672,
        96096
      ]
    },
    {
      "id": "1335f683-10ca-40c2-aa06-34475db9a604",
      "name": "IfNewInvoice",
      "type": "n8n-nodes-base.if",
      "position": [
        158880,
        96096
      ]
    },
    {
      "id": "3b95acab-3f78-4e0e-9826-526276eae440",
      "name": "OcrExtract",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        160336,
        95152
      ]
    },
    {
      "id": "3e1df0bc-78c4-4c45-b687-c68fba448845",
      "name": "IfOcrSuccess",
      "type": "n8n-nodes-base.if",
      "position": [
        160928,
        95248
      ]
    },
    {
      "id": "e040e1b9-d74b-4427-aa5a-8d23ace1da24",
      "name": "GetBudgets",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        161312,
        95168
      ]
    },
    {
      "id": "2af3851b-e42b-4397-9108-aa6637eaf058",
      "name": "Gpt4oCategorizer",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        161712,
        95536
      ]
    },
    {
      "id": "613ec53d-c9d5-4dc7-9455-ec4544fc2baf",
      "name": "SaveInvoice",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        159152,
        96000
      ]
    },
    {
      "id": "b06d1994-4670-4e12-a45d-e4e087cb6160",
      "name": "GetSummary",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        159376,
        96000
      ]
    },
    {
      "id": "d894c7fd-da95-4c47-b3fc-01760ff54e1a",
      "name": "SaveSummary",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        160048,
        96000
      ]
    },
    {
      "id": "c4aa4e6f-14a5-4f08-a5cf-7b0a77570dc7",
      "name": "IfNeedsAlert",
      "type": "n8n-nodes-base.if",
      "position": [
        160288,
        96000
      ]
    },
    {
      "id": "2cffc820-7e18-41b2-8a13-0b0479b4f8a7",
      "name": "AlertMessage",
      "type": "n8n-nodes-base.telegram",
      "position": [
        160512,
        95984
      ]
    },
    {
      "id": "96484f33-8cea-4495-a297-39de4d2c871f",
      "name": "RenameFile",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        160288,
        96304
      ]
    },
    {
      "id": "f56074bc-60e2-4d47-aa80-579d0f855cec",
      "name": "SearchMonthFolder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        160608,
        96304
      ]
    },
    {
      "id": "354e6a3e-d173-4133-a199-05364605905f",
      "name": "IfFolderExists",
      "type": "n8n-nodes-base.if",
      "position": [
        160832,
        96304
      ]
    },
    {
      "id": "6301903e-1e50-48c3-8ba1-2e7f15c6306e",
      "name": "CreateMonthFolder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        161056,
        96304
      ]
    },
    {
      "id": "eae48e84-547e-4bc5-865d-e0cfd700b0a3",
      "name": "MoveToMonth",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        161520,
        96000
      ]
    },
    {
      "id": "8e1a79e1-a557-40d2-ac08-9653d42cd915",
      "name": "SuccessLog",
      "type": "n8n-nodes-base.telegram",
      "position": [
        161856,
        96000
      ]
    },
    {
      "id": "a2963aae-e11d-4db6-83ee-80e8f0ec15ca",
      "name": "ErrorAlert",
      "type": "n8n-nodes-base.telegram",
      "position": [
        161440,
        95568
      ]
    },
    {
      "id": "8a87dce0-e94e-4a3a-9def-4fa381223f0c",
      "name": "BudgetTrigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        158496,
        96752
      ]
    },
    {
      "id": "97e829f9-d398-42a4-a3c7-3b6cacd022e7",
      "name": "IfFirstRun",
      "type": "n8n-nodes-base.if",
      "position": [
        158912,
        96752
      ]
    },
    {
      "id": "428a2867-8c88-40d5-af32-b9665517e0a3",
      "name": "SaveAppSettings",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        160064,
        96736
      ]
    },
    {
      "id": "8556410e-40fb-4f4a-b834-4f62c3482dfe",
      "name": "NotAuthorizedMessage",
      "type": "n8n-nodes-base.telegram",
      "position": [
        159152,
        96992
      ]
    },
    {
      "id": "96afc98b-ef1f-480c-9822-b489d16b87f8",
      "name": "BudgetInput",
      "type": "n8n-nodes-base.set",
      "position": [
        159712,
        96976
      ]
    },
    {
      "id": "89cde197-55f3-4565-8af9-f5d18ecd22e9",
      "name": "Gpt4oBudgetAgent",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        160336,
        96976
      ]
    },
    {
      "id": "c46112d3-ad52-434a-afd8-dc71687b383d",
      "name": "JsonStorageMcp",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "position": [
        160592,
        96976
      ]
    },
    {
      "id": "c0d1ffda-7dd0-46c9-9d4f-e31e65e3ed9f",
      "name": "Calculator",
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "position": [
        160720,
        96976
      ]
    },
    {
      "id": "aa17d101-b7d9-4b3d-b728-d855b1b02f10",
      "name": "Think",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        160848,
        96976
      ]
    },
    {
      "id": "fafdaefb-bb22-47d9-ac99-12744332dec4",
      "name": "BudgetMemory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        160464,
        96976
      ]
    },
    {
      "id": "900133bf-182c-4d10-96b5-5ab6320efbd0",
      "name": "BudgetReply",
      "type": "n8n-nodes-base.telegram",
      "position": [
        161152,
        96752
      ]
    },
    {
      "id": "4903afe0-b865-4047-9b21-eefe49efb61a",
      "name": "WelcomeMessage",
      "type": "n8n-nodes-base.telegram",
      "position": [
        159856,
        96736
      ]
    },
    {
      "id": "593f57b9-c89c-4ccc-b5d2-acb9a2c1b70c",
      "name": "WeeklyTrigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        158464,
        97440
      ]
    },
    {
      "id": "694e0916-8ee8-4c50-b17b-0cab3cec3884",
      "name": "GetWeeklySummary",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        158912,
        97440
      ]
    },
    {
      "id": "32266bbd-88a8-4d66-85e6-7121fe9d19bf",
      "name": "IfHasData",
      "type": "n8n-nodes-base.if",
      "position": [
        159136,
        97440
      ]
    },
    {
      "id": "db67740e-04d4-4b20-b1c1-1cb437c1a6cd",
      "name": "CalcWeeklySummary",
      "type": "n8n-nodes-base.code",
      "position": [
        159360,
        97440
      ]
    },
    {
      "id": "6b536150-f447-4743-a09b-2472b3b0b85f",
      "name": "BuildWeeklyMessage",
      "type": "n8n-nodes-base.set",
      "position": [
        159584,
        97440
      ]
    },
    {
      "id": "319e9bd1-eac9-4d4a-9a01-3a86030cc6af",
      "name": "WeeklySummaryMessage",
      "type": "n8n-nodes-base.telegram",
      "position": [
        159808,
        97440
      ]
    },
    {
      "id": "425607ec-05e3-4be8-9849-4bd7968fac20",
      "name": "Crypto",
      "type": "n8n-nodes-base.crypto",
      "position": [
        160336,
        95344
      ]
    },
    {
      "id": "56e13a30-186e-4aad-91e0-009bbb63ba54",
      "name": "WorkflowConfig",
      "type": "n8n-nodes-base.set",
      "position": [
        159616,
        95312
      ]
    },
    {
      "id": "23640908-7387-4ac4-bc7d-652c1cc662f1",
      "name": "ResultFolder",
      "type": "n8n-nodes-base.set",
      "position": [
        161296,
        96000
      ]
    },
    {
      "id": "e578be06-4922-4b47-a810-07e45dc69759",
      "name": "RenameToReview",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        161184,
        95568
      ]
    },
    {
      "id": "e73828e5-98ba-40e4-b7fc-01d621577063",
      "name": "DuplicateLog",
      "type": "n8n-nodes-base.telegram",
      "position": [
        159376,
        96320
      ]
    },
    {
      "id": "38778ce2-2a0d-4fe1-956a-92c3bbf0e428",
      "name": "IfNotForReviewOrDuplicate",
      "type": "n8n-nodes-base.if",
      "position": [
        159840,
        95312
      ]
    },
    {
      "id": "edbd6079-9253-4031-ab54-66ca7db69c08",
      "name": "GetFiles",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        159152,
        95312
      ]
    },
    {
      "id": "541e0e09-a215-4d5c-8b77-15143cf3caa0",
      "name": "LoopInput",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        159376,
        95312
      ]
    },
    {
      "id": "9fc45e3f-0d8e-4c1f-9f39-e200a8d793a4",
      "name": "HourlyTrigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        158480,
        95312
      ]
    },
    {
      "id": "a1c99368-bfd1-440f-8d21-ce78ed8b8cc0",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        160752,
        95248
      ]
    },
    {
      "id": "101debc3-625d-4927-8806-d2fae41b02c4",
      "name": "OcrOutput",
      "type": "n8n-nodes-base.set",
      "position": [
        160560,
        95152
      ]
    },
    {
      "id": "d064a5b7-bcae-49cd-8668-21648bfb745a",
      "name": "InputFile",
      "type": "n8n-nodes-base.set",
      "position": [
        160560,
        95344
      ]
    },
    {
      "id": "ae090e45-8510-4efd-9fba-3afcd79998a0",
      "name": "ProcessingInput",
      "type": "n8n-nodes-base.set",
      "position": [
        161680,
        95168
      ]
    },
    {
      "id": "ce72a80a-2f2c-41fa-9d25-57f2cadbd8b4",
      "name": "StorageInput",
      "type": "n8n-nodes-base.set",
      "position": [
        158464,
        96096
      ]
    },
    {
      "id": "b9229f35-4a2b-4332-9c09-7435d3485107",
      "name": "Monthly Summary",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160064,
        97232
      ],
      "parameters": {
        "width": 1420,
        "height": 1052,
        "content": "## 4. Monthly Summary\nScheduled report generation on 10th of each month"
      }
    },
    {
      "id": "986b3dbf-cd37-472f-b233-bafc89b0bcf7",
      "name": "MonthlyTrigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        160144,
        97424
      ]
    },
    {
      "id": "647185b5-2ced-4257-8d1e-0787cf4bebc4",
      "name": "MonthlySummaryMessage",
      "type": "n8n-nodes-base.telegram",
      "position": [
        160912,
        97424
      ]
    },
    {
      "id": "6f88e46e-c38b-4851-b761-0f416921dfd6",
      "name": "IfHasMonthlyData1",
      "type": "n8n-nodes-base.if",
      "position": [
        160816,
        97808
      ]
    },
    {
      "id": "b87f2e29-e7ef-4745-8dd2-8ad0b85017ad",
      "name": "CalcMonthlySummary",
      "type": "n8n-nodes-base.code",
      "position": [
        161040,
        97712
      ]
    },
    {
      "id": "6f6a13e1-f4dc-4f10-8563-abf5e695d60a",
      "name": "BuildMonthlyMessage",
      "type": "n8n-nodes-base.set",
      "position": [
        161264,
        97712
      ]
    },
    {
      "id": "81f5c1a9-3da1-4188-adcf-ad968a87ee52",
      "name": "WorkflowInput",
      "type": "n8n-nodes-base.set",
      "position": [
        160368,
        97808
      ]
    },
    {
      "id": "c9d350c1-7fc1-4980-a412-8a8dff4dcdc3",
      "name": "GetMonthlySummaryTrigger",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        160144,
        97808
      ]
    },
    {
      "id": "b04313c1-249d-4ce6-b88f-d258cf2eb83c",
      "name": "MonthlySummary",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        160976,
        96976
      ]
    },
    {
      "id": "58b67b0a-3c3d-4dea-806a-5c373490f08c",
      "name": "GetMonthlySummary",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        160592,
        97808
      ]
    },
    {
      "id": "2b71f7d0-fe8c-4077-8271-2d0569215841",
      "name": "GetMonthlySummaryText",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        160592,
        97424
      ]
    },
    {
      "id": "2971c307-2b46-433a-8a28-9a752ef0fa87",
      "name": "CalcSummary",
      "type": "n8n-nodes-base.code",
      "position": [
        159600,
        96000
      ]
    },
    {
      "id": "e7f87a8a-9724-4fe2-b7ba-043df5c44542",
      "name": "SummaryInput",
      "type": "n8n-nodes-base.set",
      "position": [
        159824,
        96000
      ]
    },
    {
      "id": "130593ac-8c99-4b8c-b365-81bb1d124be6",
      "name": "IfAuthorized",
      "type": "n8n-nodes-base.if",
      "position": [
        158912,
        96976
      ]
    },
    {
      "id": "0bc1dd6c-1f9d-4a48-be17-f7ccac7035b9",
      "name": "GetAppConfig2",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        160368,
        97424
      ]
    },
    {
      "id": "a410987e-c7ad-4726-b834-a56e8adfea82",
      "name": "ErrorOutput",
      "type": "n8n-nodes-base.set",
      "position": [
        161040,
        97904
      ]
    },
    {
      "id": "1fdbbaa6-70d5-48cd-b09e-4a50e6f845be",
      "name": "ManualResetTrigger",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        158464,
        97904
      ]
    },
    {
      "id": "832ce7c3-0d67-408d-8aa4-84a65fa44fad",
      "name": "ForEachCategory",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        159424,
        97888
      ]
    },
    {
      "id": "9f45a2ac-c67a-4c7c-ab92-752f8e4285f2",
      "name": "DeleteItem",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        159696,
        98096
      ]
    },
    {
      "id": "ccee79a6-2fa5-447c-a711-b46cb55eaff5",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        158416,
        97776
      ],
      "parameters": {
        "width": 1584,
        "height": 464,
        "content": "## Cleanup / Reset\nThis is **MANUAL** trigger to full data cleanup. **Warning - this will DELETE ALL DATA** stored in your **Ainoflow** account"
      }
    },
    {
      "id": "afd9800b-cc16-46b6-aee2-165aa010c2a8",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        158416,
        95168
      ],
      "parameters": {
        "width": 208,
        "height": 304,
        "content": "## Scheduled Trigger"
      }
    },
    {
      "id": "b7e850ad-de62-469e-a536-43cdeff53018",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        158624,
        95168
      ],
      "parameters": {
        "width": 464,
        "height": 304,
        "content": "## Ensure Tool Configuration Exists\nBefore starting processing, we should have a Telegram bot successfully configured and linked to the workflow via the `/start` message."
      }
    },
    {
      "id": "cf649ee2-81e7-4280-aa9a-8c8ad5c920b7",
      "name": "GetAppSettings",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        158704,
        95312
      ]
    },
    {
      "id": "8b9b5220-2d22-4799-8f1a-59108a660c76",
      "name": "GetAppSettings1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        158720,
        96752
      ]
    },
    {
      "id": "1a8389a1-32e0-438c-879e-625a1e55d2e0",
      "name": "GetAppSettings2",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        158688,
        97440
      ]
    },
    {
      "id": "3516a16f-4c10-42ee-934d-c73a1afa1516",
      "name": "IfRegistrationExists",
      "type": "n8n-nodes-base.if",
      "position": [
        158928,
        95312
      ]
    },
    {
      "id": "c8104c27-cf1c-4342-8eb2-6f76b04f5cc0",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        159088,
        95168
      ],
      "parameters": {
        "width": 464,
        "height": 304,
        "content": "## Loop over unprocessed files\n- Get all files in folder, iterate one by one\n- Make sure you have selected right (inbox) directory here\n"
      }
    },
    {
      "id": "0ca2c565-ac22-4ac1-bd9e-677ce62a45ae",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        158432,
        96640
      ],
      "parameters": {
        "width": 208,
        "height": 320,
        "content": "## Chat Trigger"
      }
    },
    {
      "id": "ac805847-4685-4f0d-b1aa-29ef044a52e8",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        158640,
        96640
      ],
      "parameters": {
        "width": 928,
        "height": 528,
        "content": "## Ensure Bot Privacy\nOn first use, the bot stores the user ID and locks access to that user. Any other user will receive an “unauthorized” message.\n"
      }
    },
    {
      "id": "187ac6c2-1ed5-449c-844b-d6141c56c9ef",
      "name": "IfStartMessage",
      "type": "n8n-nodes-base.if",
      "position": [
        159392,
        96864
      ]
    },
    {
      "id": "59e48c58-68ae-443b-bb1b-1c718b5c0742",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        159568,
        96640
      ],
      "parameters": {
        "width": 720,
        "height": 256,
        "content": "## Add processing started message\nNotify user about processing start (with message ... )"
      }
    },
    {
      "id": "09f8c8f5-157a-40f5-9233-828e516832b3",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        159568,
        96896
      ],
      "parameters": {
        "width": 720,
        "height": 272,
        "content": "## Build Agent Input\n"
      }
    },
    {
      "id": "72de16dc-c2bd-4277-aff8-a2ee95eae8fa",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160288,
        96640
      ],
      "parameters": {
        "width": 800,
        "height": 528,
        "content": "## Budget Agent Processing\n- answer to user message\n- ensure budget is set as expected"
      }
    },
    {
      "id": "4bae5be7-e65e-4b9c-b22a-e72a011c616f",
      "name": "BudgetAgent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        160560,
        96752
      ]
    },
    {
      "id": "99e32992-9780-494e-9c64-99154722e57e",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        161088,
        96640
      ],
      "parameters": {
        "width": 288,
        "height": 528,
        "content": "## Result / Reply Message\nSends reply to the user"
      }
    },
    {
      "id": "3ce0b558-2b8a-4c70-8fcc-b5ccfdc22452",
      "name": "Budget Agent1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        158384,
        94896
      ],
      "parameters": {
        "width": 4068,
        "height": 868,
        "content": "## 1.1 Document Processing Loop / Data Extraction (Scheduled)\n"
      }
    },
    {
      "id": "111e0912-7e9c-461d-a494-95a36a752492",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        159552,
        95168
      ],
      "parameters": {
        "width": 464,
        "height": 304,
        "content": "## Get Config and Validate Input File\n- Document not marked for manual review\n- Document not marked as duplicate\n"
      }
    },
    {
      "id": "c33f4996-4c7e-41e0-aca0-9e07754ee77d",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160016,
        95072
      ],
      "parameters": {
        "width": 1088,
        "height": 432,
        "content": "## Get Document Content\n- Downloads file\n- Extract text from file\n- Calculate file hash\n"
      }
    },
    {
      "id": "d7b453c3-d836-4b2e-846a-607235d74b89",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        161104,
        95072
      ],
      "parameters": {
        "width": 528,
        "height": 288,
        "content": "## Load Budget Data\n- Budget json loaded from config storage"
      }
    },
    {
      "id": "2a06727f-aa5f-46e8-a4a9-6676a71cccd3",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        161104,
        95360
      ],
      "parameters": {
        "width": 528,
        "height": 368,
        "content": "## Require manual review\n- If OCR / text extraction failed\n- If categorizer identified invalid content\n"
      }
    },
    {
      "id": "3ea2ad97-17ba-4007-9ee9-ef42032c1a49",
      "name": "IfInvalidContent",
      "type": "n8n-nodes-base.if",
      "position": [
        160880,
        95536
      ]
    },
    {
      "id": "485da58e-1815-44c3-afb9-4f1e46f1a9d8",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        161632,
        95072
      ],
      "parameters": {
        "width": 688,
        "height": 656,
        "content": "## Extract Invoice Data"
      }
    },
    {
      "id": "84d1b344-f5b1-4057-979b-0dd5f6936960",
      "name": "Budget Agent2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        158384,
        95840
      ],
      "parameters": {
        "width": 4068,
        "height": 660,
        "content": "## 1.2 Document Processing Loop / Invoice Processing\n"
      }
    },
    {
      "id": "59bbb7aa-83e1-487a-bb38-6be826e4c6ba",
      "name": "RenameAsDuplicate",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        159152,
        96320
      ]
    },
    {
      "id": "352a4f6f-dab1-4106-8d75-766b52fee649",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        159088,
        96192
      ],
      "parameters": {
        "width": 512,
        "height": 288,
        "content": "## Handle Duplicate Invoice\n- Rename as duplicate (for manual processing) \n- Notify user about duplicate"
      }
    },
    {
      "id": "6b92e2a6-3292-4736-9f72-22b0e57d2108",
      "name": "Sticky Note17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        158592,
        96000
      ],
      "parameters": {
        "width": 496,
        "height": 304,
        "content": "## Duplicate Check\n"
      }
    },
    {
      "id": "13111eac-ce49-47e5-bf07-3b85f33620c0",
      "name": "Sticky Note18",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        159088,
        95904
      ],
      "parameters": {
        "width": 208,
        "height": 288,
        "content": "## Save Record\n"
      }
    },
    {
      "id": "5b1fede8-d5e9-48e0-84ea-51bf4b12987c",
      "name": "Sticky Note19",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        159296,
        95904
      ],
      "parameters": {
        "width": 928,
        "height": 288,
        "content": "## Update Summary\n"
      }
    },
    {
      "id": "73c0db71-0705-48b6-b9a5-0451c73923f8",
      "name": "Sticky Note20",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160224,
        95904
      ],
      "parameters": {
        "width": 448,
        "height": 288,
        "content": "## Budget Alerts\n"
      }
    },
    {
      "id": "ac1d07f5-e557-44fd-b807-bcd6ef4cc75f",
      "name": "Sticky Note21",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160224,
        96192
      ],
      "parameters": {
        "width": 304,
        "height": 288,
        "content": "## Rename Document\n- Use invoice details to build new document name\n"
      }
    },
    {
      "id": "9fe4053f-a90b-42db-a135-4e923452680d",
      "name": "Sticky Note22",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160528,
        96192
      ],
      "parameters": {
        "width": 736,
        "height": 288,
        "content": "## Ensure Month Folder Exists\n"
      }
    },
    {
      "id": "71e6d8f0-5460-4d67-a48b-9c8ec76d6e09",
      "name": "Sticky Note23",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        161200,
        95904
      ],
      "parameters": {
        "width": 560,
        "height": 288,
        "content": "## Move Document to Month Folder\n"
      }
    },
    {
      "id": "ee1122c7-62b4-42b7-b5f3-9eb2402d2f90",
      "name": "Sticky Note25",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        161760,
        95904
      ],
      "parameters": {
        "width": 336,
        "height": 288,
        "content": "## Success Notification\n- Send message to user with invoice details\n"
      }
    },
    {
      "id": "777c19d2-d3da-41ba-91a7-558f17412212",
      "name": "Sticky Note24",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        158416,
        97344
      ],
      "parameters": {
        "width": 208,
        "height": 288,
        "content": "## Weekly Trigger"
      }
    },
    {
      "id": "1b659b80-e5ed-41ee-a848-be729baf5907",
      "name": "Sticky Note26",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        158624,
        97344
      ],
      "parameters": {
        "width": 912,
        "height": 288,
        "content": "## Get Weekly Summary\n- Do not proceed if summary does not exist yet\n"
      }
    },
    {
      "id": "bcdd3131-8093-4d10-ac03-696b72b7575d",
      "name": "Sticky Note27",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        159536,
        97344
      ],
      "parameters": {
        "width": 464,
        "height": 288,
        "content": "## Send Weekly Notification"
      }
    },
    {
      "id": "b08ebd23-e906-460a-9ec5-6116f70ac2db",
      "name": "Sticky Note28",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160096,
        97328
      ],
      "parameters": {
        "width": 208,
        "height": 288,
        "content": "## Monthly Trigger"
      }
    },
    {
      "id": "9513d252-3a58-4468-bd07-db807d054995",
      "name": "Sticky Note29",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160304,
        97328
      ],
      "parameters": {
        "width": 464,
        "height": 288,
        "content": "## Get Monthly Summary\n- Do not proceed if summary does not exist yet\n"
      }
    },
    {
      "id": "54f09973-ad72-4177-9c67-8ecd665005a7",
      "name": "Sticky Note30",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160768,
        97328
      ],
      "parameters": {
        "width": 448,
        "height": 288,
        "content": "## Send Monthly Notification"
      }
    },
    {
      "id": "32d50423-9e8a-4d07-ac65-a824967d593f",
      "name": "Sticky Note31",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160096,
        97664
      ],
      "parameters": {
        "width": 1344,
        "height": 416,
        "content": "## Monthly Summary Calculation Logic\n- Respond with summary or error message\n- Uses subworkflow (workflow with same id)\n"
      }
    },
    {
      "id": "bf54a221-ed26-4ce4-aeec-625df8fac3bd",
      "name": "Monthly Summary1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        158384,
        97680
      ],
      "parameters": {
        "width": 1660,
        "height": 604,
        "content": "## 5. Data Reset\n- Removes all account / project data"
      }
    },
    {
      "id": "57a2e9b1-2d98-4b43-bbc0-546021395645",
      "name": "GetAppSettings3",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        158688,
        97904
      ]
    },
    {
      "id": "668e46fa-dc01-452a-8948-ac682eb6d9c7",
      "name": "ApproveRemove",
      "type": "n8n-nodes-base.telegram",
      "position": [
        158912,
        97904
      ]
    },
    {
      "id": "e754429a-d6cf-4d1e-a3d8-85287930f2a0",
      "name": "IfApproved",
      "type": "n8n-nodes-base.if",
      "position": [
        159120,
        97904
      ]
    },
    {
      "id": "5a0d78b8-8cab-46ed-befa-92f0e2441012",
      "name": "FirstRunOnlyStart",
      "type": "n8n-nodes-base.if",
      "position": [
        159152,
        96736
      ]
    },
    {
      "id": "cd18db5e-df54-4717-aaa3-bc5d5a289a1a",
      "name": "ForEachCategoryItem",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        159408,
        98112
      ]
    },
    {
      "id": "ac0992a0-7d3e-443d-9bfb-b4612d863f8d",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        159696,
        97872
      ]
    },
    {
      "id": "2f593874-03d0-4b5a-880a-a07ba313f377",
      "name": "SetDefaults",
      "type": "n8n-nodes-base.set",
      "position": [
        159632,
        96736
      ]
    },
    {
      "id": "a2f9b5b7-efff-4d9b-934f-78c9e6a3e55e",
      "name": "Think1",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        161856,
        95536
      ]
    },
    {
      "id": "bc49cb02-4592-457f-9972-bd4f05ace201",
      "name": "AICategorizer",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        161936,
        95296
      ]
    },
    {
      "id": "069cf08b-44ff-4db9-a7ef-099ba6a1ec16",
      "name": "StructuredOutputParser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        162016,
        95536
      ]
    },
    {
      "id": "8313adbf-f2b6-4d43-9c08-da69491f3828",
      "name": "RestartMessage",
      "type": "n8n-nodes-base.telegram",
      "position": [
        159120,
        98096
      ]
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "ForEachCategoryItem",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "IfOcrSuccess",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Think": {
      "ai_tool": [
        [
          {
            "node": "BudgetAgent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Crypto": {
      "main": [
        [
          {
            "node": "InputFile",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Think1": {
      "ai_tool": [
        [
          {
            "node": "AICategorizer",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "GetFiles": {
      "main": [
        [
          {
            "node": "LoopInput",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IfHasData": {
      "main": [
        [
          {
            "node": "CalcWeeklySummary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "InputFile": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "LoopInput": {
      "main": [
        [],
        [
          {
            "node": "LoopInput",
            "type": "main",
            "index": 0
          },
          {
            "node": "WorkflowConfig",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OcrOutput": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "BudgetAgent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "GetBudgets": {
      "main": [
        [
          {
            "node": "ProcessingInput",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GetSummary": {
      "main": [
        [
          {
            "node": "CalcSummary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IfApproved": {
      "main": [
        [
          {
            "node": "ForEachCategory",
            "type": "main",
            "index": 0
          },
          {
            "node": "RestartMessage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IfFirstRun": {
      "main": [
        [
          {
            "node": "FirstRunOnlyStart",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "IfAuthorized",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OcrExtract": {
      "main": [
        [
          {
            "node": "OcrOutput",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "RenameFile": {
      "main": [
        [
          {
            "node": "SearchMonthFolder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "BudgetAgent": {
      "main": [
        [
          {
            "node": "BudgetReply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "BudgetInput": {
      "main": [
        [
          {
            "node": "BudgetAgent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CalcSummary": {
      "main": [
        [
          {
            "node": "SummaryInput",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "MoveToMonth": {
      "main": [
        [
          {
            "node": "SuccessLog",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SaveInvoice": {
      "main": [
        [
          {
            "node": "GetSummary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SaveSummary": {
      "main": [
        [
          {
            "node": "IfNeedsAlert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SetDefaults": {
      "main": [
        [
          {
            "node": "WelcomeMessage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "BudgetMemory": {
      "ai_memory": [
        [
          {
            "node": "BudgetAgent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "IfAuthorized": {
      "main": [
        [
          {
            "node": "IfStartMessage",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "NotAuthorizedMessage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IfNeedsAlert": {
      "main": [
        [
          {
            "node": "AlertMessage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IfNewInvoice": {
      "main": [
        [
          {
            "node": "SaveInvoice",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "RenameAsDuplicate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IfOcrSuccess": {
      "main": [
        [
          {
            "node": "GetBudgets",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "RenameToReview",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ResultFolder": {
      "main": [
        [
          {
            "node": "MoveToMonth",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "StorageInput": {
      "main": [
        [
          {
            "node": "CheckInvoiceExists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SummaryInput": {
      "main": [
        [
          {
            "node": "SaveSummary",
            "type": "main",
            "index": 0
          },
          {
            "node": "RenameFile",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AICategorizer": {
      "main": [
        [
          {
            "node": "IfInvalidContent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ApproveRemove": {
      "main": [
        [
          {
            "node": "IfApproved",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "BudgetTrigger": {
      "main": [
        [
          {
            "node": "GetAppSettings1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GetAppConfig2": {
      "main": [
        [
          {
            "node": "GetMonthlySummaryText",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HourlyTrigger": {
      "main": [
        [
          {
            "node": "GetAppSettings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WeeklyTrigger": {
      "main": [
        [
          {
            "node": "GetAppSettings2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WorkflowInput": {
      "main": [
        [
          {
            "node": "GetMonthlySummary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GetAppSettings": {
      "main": [
        [
          {
            "node": "IfRegistrationExists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IfFolderExists": {
      "main": [
        [
          {
            "node": "ResultFolder",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "CreateMonthFolder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IfStartMessage": {
      "main": [
        [
          {
            "node": "SetDefaults",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "BudgetInput",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "JsonStorageMcp": {
      "ai_tool": [
        [
          {
            "node": "BudgetAgent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "MonthlySummary": {
      "ai_tool": [
        [
          {
            "node": "BudgetAgent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "MonthlyTrigger": {
      "main": [
        [
          {
            "node": "GetAppConfig2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "RenameToReview": {
      "main": [
        [
          {
            "node": "ErrorAlert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WelcomeMessage": {
      "main": [
        [
          {
            "node": "SaveAppSettings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WorkflowConfig": {
      "main": [
        [
          {
            "node": "IfNotForReviewOrDuplicate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DownloadInvoice": {
      "main": [
        [
          {
            "node": "OcrExtract",
            "type": "main",
            "index": 0
          },
          {
            "node": "Crypto",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ForEachCategory": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GetAppSettings1": {
      "main": [
        [
          {
            "node": "IfFirstRun",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GetAppSettings2": {
      "main": [
        [
          {
            "node": "GetWeeklySummary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GetAppSettings3": {
      "main": [
        [
          {
            "node": "ApproveRemove",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ProcessingInput": {
      "main": [
        [
          {
            "node": "AICategorizer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GetWeeklySummary": {
      "main": [
        [
          {
            "node": "IfHasData",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gpt4oBudgetAgent": {
      "ai_languageModel": [
        [
          {
            "node": "BudgetAgent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Gpt4oCategorizer": {
      "ai_languageModel": [
        [
          {
            "node": "AICategorizer",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "StructuredOutputParser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "IfInvalidContent": {
      "main": [
        [
          {
            "node": "RenameToReview",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "StorageInput",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CalcWeeklySummary": {
      "main": [
        [
          {
            "node": "BuildWeeklyMessage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CreateMonthFolder": {
      "main": [
        [
          {
            "node": "ResultFolder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "FirstRunOnlyStart": {
      "main": [
        [
          {
            "node": "IfStartMessage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GetMonthlySummary": {
      "main": [
        [
          {
            "node": "IfHasMonthlyData1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IfHasMonthlyData1": {
      "main": [
        [
          {
            "node": "CalcMonthlySummary",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "ErrorOutput",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "RenameAsDuplicate": {
      "main": [
        [
          {
            "node": "DuplicateLog",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SearchMonthFolder": {
      "main": [
        [
          {
            "node": "IfFolderExists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "BuildWeeklyMessage": {
      "main": [
        [
          {
            "node": "WeeklySummaryMessage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CalcMonthlySummary": {
      "main": [
        [
          {
            "node": "BuildMonthlyMessage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CheckInvoiceExists": {
      "main": [
        [
          {
            "node": "IfNewInvoice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ManualResetTrigger": {
      "main": [
        [
          {
            "node": "GetAppSettings3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ForEachCategoryItem": {
      "main": [
        [
          {
            "node": "DeleteItem",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IfRegistrationExists": {
      "main": [
        [
          {
            "node": "GetFiles",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GetMonthlySummaryText": {
      "main": [
        [
          {
            "node": "MonthlySummaryMessage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "StructuredOutputParser": {
      "ai_outputParser": [
        [
          {
            "node": "AICategorizer",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "GetMonthlySummaryTrigger": {
      "main": [
        [
          {
            "node": "WorkflowInput",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IfNotForReviewOrDuplicate": {
      "main": [
        [
          {
            "node": "DownloadInvoice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}