{
  "name": "AI-powered receipt and expense tracker with Telegram, Google Sheets & OpenAI",
  "nodes": [
    {
      "id": "951302cb-527f-480f-8cb7-3b4f2bb9b7f0",
      "name": "Convert to Base64",
      "type": "n8n-nodes-base.code",
      "position": [
        1660,
        200
      ]
    },
    {
      "id": "21049da5-f9a0-4587-9725-5d958c05de8c",
      "name": "Google Vision OCR",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1880,
        200
      ]
    },
    {
      "id": "38757c15-e984-4029-b805-679219e02006",
      "name": "Check OCR Result",
      "type": "n8n-nodes-base.code",
      "position": [
        2100,
        200
      ]
    },
    {
      "id": "49e85c47-29bd-4344-afcb-1ef87d2a9861",
      "name": "Extract OCR Text",
      "type": "n8n-nodes-base.set",
      "position": [
        2320,
        200
      ]
    },
    {
      "id": "e59e2779-03b0-496a-8c98-96c16cf13623",
      "name": "☁️ Upload PDF to LlamaIndex",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1660,
        540
      ]
    },
    {
      "id": "5719ea7d-eb4e-47d0-bb4f-ee981a0e416f",
      "name": "⏳ Check Parsing Status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1860,
        540
      ]
    },
    {
      "id": "11ab2d2d-eb07-4c56-84b2-e40b66f86a13",
      "name": "🔁 Condition: Was Parsing Successful?",
      "type": "n8n-nodes-base.if",
      "position": [
        2080,
        540
      ]
    },
    {
      "id": "6094e839-18a5-4a9b-b8ed-d903309fd4c7",
      "name": " ⏱ Delay Before Recheck",
      "type": "n8n-nodes-base.wait",
      "position": [
        2300,
        660
      ]
    },
    {
      "id": "63b6dba7-bce2-47e8-9370-9dafa9c822e8",
      "name": " 📥 Get Parsed Markdown Result",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2300,
        420
      ]
    },
    {
      "id": "7d80a792-da59-4082-9734-3a59e80a0125",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        2300,
        880
      ]
    },
    {
      "id": "ec1162d2-7e91-4459-8fe7-d099e4cb1e1e",
      "name": "Download VN",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2080,
        880
      ]
    },
    {
      "id": "84f5364b-acac-48f4-9e8b-88e208589498",
      "name": "AI Categorizer",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        260,
        1200
      ]
    },
    {
      "id": "8da9481f-024a-4c37-a5d1-9f6ff0abdb58",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        300,
        1420
      ]
    },
    {
      "id": "d9c34a6c-2bb6-47df-8f6d-1ea840ac9244",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        420,
        1420
      ]
    },
    {
      "id": "87b1ca88-3069-48f7-adaf-74cd5a41fc80",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        2540,
        860
      ]
    },
    {
      "id": "7471d089-459c-4515-b500-b39902121572",
      "name": "price greater than 0?",
      "type": "n8n-nodes-base.if",
      "position": [
        1460,
        1560
      ]
    },
    {
      "id": "70caa53d-103c-408f-836a-db9d060acca4",
      "name": "Check Start",
      "type": "n8n-nodes-base.if",
      "position": [
        340,
        160
      ]
    },
    {
      "id": "1f5c44fa-ed21-437e-a315-fb381d14b5eb",
      "name": "Welcome Menu",
      "type": "n8n-nodes-base.telegram",
      "position": [
        560,
        160
      ]
    },
    {
      "id": "22b87e94-d032-48a8-a28e-5823fae5480f",
      "name": "Check Income",
      "type": "n8n-nodes-base.if",
      "position": [
        340,
        360
      ]
    },
    {
      "id": "b3b06944-4165-49d9-a398-69d24c104f33",
      "name": "Check Expenses",
      "type": "n8n-nodes-base.if",
      "position": [
        340,
        560
      ]
    },
    {
      "id": "c6ddeae1-bb24-412c-96fc-5313eda34f26",
      "name": "Save Income to Redis",
      "type": "n8n-nodes-base.redis",
      "position": [
        560,
        360
      ]
    },
    {
      "id": "4d2c3576-94e2-47c9-963e-18bb22f97368",
      "name": "Save Expenses to Redis",
      "type": "n8n-nodes-base.redis",
      "position": [
        560,
        560
      ]
    },
    {
      "id": "ff8b9d8f-3c53-4873-add9-e09eb59f518b",
      "name": "Check Input",
      "type": "n8n-nodes-base.if",
      "position": [
        340,
        760
      ]
    },
    {
      "id": "fb2f2c73-7c9b-42e9-8801-355fb711f2ae",
      "name": "Content Type Router",
      "type": "n8n-nodes-base.switch",
      "position": [
        1000,
        740
      ]
    },
    {
      "id": "cb4b7d9a-deea-412e-affc-a85a5734e12f",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        120,
        460
      ]
    },
    {
      "id": "a053a6e1-74eb-4adf-a94b-46b4aebe7ba1",
      "name": "Request Pemasukan",
      "type": "n8n-nodes-base.telegram",
      "position": [
        780,
        360
      ]
    },
    {
      "id": "da9096d1-de27-4227-8141-697ab6946deb",
      "name": "Get Transaction Type",
      "type": "n8n-nodes-base.redis",
      "position": [
        560,
        760
      ]
    },
    {
      "id": "ee825901-0cb1-4716-a40b-b21d42600215",
      "name": "Extract Transaction Type",
      "type": "n8n-nodes-base.set",
      "position": [
        780,
        760
      ]
    },
    {
      "id": "632200e9-e6ec-49ad-b321-1d945130c9fa",
      "name": "Ambil Vn",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1860,
        880
      ]
    },
    {
      "id": "a2c85f3d-5692-4901-8cc5-f99a17af52a7",
      "name": "📥 Download PDF from Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1460,
        540
      ]
    },
    {
      "id": "7f7c5770-061c-4539-9177-8d924d04feb1",
      "name": "Extract Text Input",
      "type": "n8n-nodes-base.set",
      "position": [
        2300,
        1080
      ]
    },
    {
      "id": "c1d5be1e-4991-4390-8cd5-1bf2cd90c4b0",
      "name": "check price",
      "type": "n8n-nodes-base.set",
      "position": [
        1240,
        1500
      ]
    },
    {
      "id": "3fe0b043-e125-47de-ae39-e56acae5b525",
      "name": "Send Error",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1700,
        1680
      ]
    },
    {
      "id": "fb984f86-ed06-4721-9298-f9e15d070010",
      "name": "Delay",
      "type": "n8n-nodes-base.wait",
      "position": [
        1040,
        1200
      ]
    },
    {
      "id": "19dc3e08-be3c-4021-8df3-fcde585344cb",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        80
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "eae0aa84-dfba-4cac-a1bd-ba3a4b0536de",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        80
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "a9384ce4-00aa-49dc-83ba-cc85aa2e28c0",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -20,
        980
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "ddf6a17b-569e-4415-820d-9a45a0d0cf10",
      "name": "Expenses?",
      "type": "n8n-nodes-base.if",
      "position": [
        1700,
        1500
      ]
    },
    {
      "id": "62a24023-4d2f-41dd-8b14-eec66294120b",
      "name": "Send Income Summary",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1920,
        1600
      ]
    },
    {
      "id": "bcc98628-fcab-41a7-b28d-1789b8ea048f",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        1280
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "11ca6091-c7e5-4cae-a5c8-858080b0ca9a",
      "name": "Transform to Sheets Format",
      "type": "n8n-nodes-base.code",
      "position": [
        820,
        1200
      ]
    },
    {
      "id": "c206db06-d52e-4411-807a-74804bb5f69e",
      "name": "Send Expense Summary",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1920,
        1400
      ]
    },
    {
      "id": "4acb3a06-886e-4a6f-a8c5-0d3da4444d4d",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2080,
        1280
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "964f1b9d-f50f-4973-b784-80fc70f5f589",
      "name": "Append Expenses",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2220,
        1400
      ]
    },
    {
      "id": "2560f1d0-340c-423a-b2ba-8516ca7f175e",
      "name": "Append Income",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2220,
        1600
      ]
    },
    {
      "id": "0e4f95b7-3ff4-48fc-8b3f-415478755cfa",
      "name": "Request expense",
      "type": "n8n-nodes-base.telegram",
      "position": [
        780,
        560
      ]
    },
    {
      "id": "2b181326-5ddb-4c88-a5fa-a109e0b110ca",
      "name": "Input Accept",
      "type": "n8n-nodes-base.telegram",
      "position": [
        40,
        1200
      ]
    },
    {
      "id": "1b9e0241-ec84-4325-9232-7b2acb6154e8",
      "name": "Extract AI Result",
      "type": "n8n-nodes-base.telegram",
      "position": [
        600,
        1200
      ]
    },
    {
      "id": "3b4db463-29d6-4b93-a7b8-5cef16b42eb9",
      "name": "Download Image",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1260,
        200
      ]
    },
    {
      "id": "e3ee9235-c42a-4ec6-9c97-6a25f35c1c56",
      "name": "Notify PDf",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1240,
        540
      ]
    }
  ],
  "connections": {
    "Delay": {
      "main": [
        [
          {
            "node": "check price",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Input Accept",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Ambil Vn": {
      "main": [
        [
          {
            "node": "Download VN",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Expenses?": {
      "main": [
        [
          {
            "node": "Send Expense Summary",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Income Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify PDf": {
      "main": [
        [
          {
            "node": "📥 Download PDF from Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Input": {
      "main": [
        [
          {
            "node": "Get Transaction Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Start": {
      "main": [
        [
          {
            "node": "Welcome Menu",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download VN": {
      "main": [
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "check price": {
      "main": [
        [
          {
            "node": "price greater than 0?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Income": {
      "main": [
        [
          {
            "node": "Save Income to Redis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Input Accept": {
      "main": [
        [
          {
            "node": "AI Categorizer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Welcome Menu": {
      "main": [
        []
      ]
    },
    "AI Categorizer": {
      "main": [
        [
          {
            "node": "Extract AI Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Expenses": {
      "main": [
        [
          {
            "node": "Save Expenses to Redis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Image": {
      "main": [
        [
          {
            "node": "Convert to Base64",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check OCR Result": {
      "main": [
        [
          {
            "node": "Extract OCR Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract OCR Text": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Check Start",
            "type": "main",
            "index": 0
          },
          {
            "node": "Check Income",
            "type": "main",
            "index": 0
          },
          {
            "node": "Check Expenses",
            "type": "main",
            "index": 0
          },
          {
            "node": "Check Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to Base64": {
      "main": [
        [
          {
            "node": "Google Vision OCR",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract AI Result": {
      "main": [
        [
          {
            "node": "Transform to Sheets Format",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Vision OCR": {
      "main": [
        [
          {
            "node": "Check OCR Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Text Input": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Content Type Router": {
      "main": [
        [
          {
            "node": "Download Image",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Notify PDf",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Ambil Vn",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Extract Text Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Income Summary": {
      "main": [
        [
          {
            "node": "Append Income",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Transaction Type": {
      "main": [
        [
          {
            "node": "Extract Transaction Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Income to Redis": {
      "main": [
        [
          {
            "node": "Request Pemasukan",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Expense Summary": {
      "main": [
        [
          {
            "node": "Append Expenses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Categorizer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "price greater than 0?": {
      "main": [
        [
          {
            "node": "Expenses?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Expenses to Redis": {
      "main": [
        [
          {
            "node": "Request expense",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Transaction Type": {
      "main": [
        [
          {
            "node": "Content Type Router",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Categorizer",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "⏳ Check Parsing Status": {
      "main": [
        [
          {
            "node": "🔁 Condition: Was Parsing Successful?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    " ⏱ Delay Before Recheck": {
      "main": [
        [
          {
            "node": "⏳ Check Parsing Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transform to Sheets Format": {
      "main": [
        [
          {
            "node": "Delay",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "☁️ Upload PDF to LlamaIndex": {
      "main": [
        [
          {
            "node": "⏳ Check Parsing Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "📥 Download PDF from Telegram": {
      "main": [
        [
          {
            "node": "☁️ Upload PDF to LlamaIndex",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    " 📥 Get Parsed Markdown Result": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "🔁 Condition: Was Parsing Successful?": {
      "main": [
        [
          {
            "node": " 📥 Get Parsed Markdown Result",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": " ⏱ Delay Before Recheck",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}