{
  "name": "Extract & categorize receipt data with Google OCR, OpenRouter AI & Telegram",
  "nodes": [
    {
      "id": "ecd439fe-ccbb-4653-9880-165a6f69426b",
      "name": "Format Summary Message",
      "type": "n8n-nodes-base.code",
      "position": [
        100,
        200
      ]
    },
    {
      "id": "14a47f09-075d-47c6-a56f-8b44b2079e6e",
      "name": "Get Telegram File",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -600,
        -180
      ]
    },
    {
      "id": "8f50e858-6cbc-4999-bf27-6253fc0fcd41",
      "name": "Download Image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -300,
        -180
      ]
    },
    {
      "id": "45b7b3c5-c6d4-45b6-8806-a0804b6a6551",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -1280,
        0
      ]
    },
    {
      "id": "721e7f94-27a4-4d93-b362-aa449e8404a9",
      "name": "Sticky - Telegram Trigger",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1280,
        -140
      ],
      "parameters": {
        "width": 260,
        "height": 180,
        "content": "## 📲 **Telegram Trigger**\nReceives user messages (text or photo) from Telegram to start the expense tracking flow."
      }
    },
    {
      "id": "563a242d-fe74-4d42-9a72-79cb2945acc9",
      "name": "AI Categorizer",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -200,
        200
      ]
    },
    {
      "id": "b8db4655-b419-424f-b5e9-2111d5831507",
      "name": "Check Invalid Input",
      "type": "n8n-nodes-base.if",
      "position": [
        380,
        200
      ]
    },
    {
      "id": "47efaf2d-23e9-43d9-bf82-1fa32b5e76fb",
      "name": "Extract Text Input",
      "type": "n8n-nodes-base.set",
      "position": [
        -600,
        200
      ]
    },
    {
      "id": "490fe4dc-5456-4f08-ace7-8ee9f4bc87fb",
      "name": "Check for Image",
      "type": "n8n-nodes-base.if",
      "position": [
        -980,
        0
      ]
    },
    {
      "id": "970fe327-8b82-4d8c-9f81-b38deb768dd1",
      "name": "Sticky - Check for Image",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -980,
        -140
      ],
      "parameters": {
        "width": null,
        "height": 180,
        "content": "## 🔍 **Check for Image**\nDetermines whether the input is an image or text to route accordingly."
      }
    },
    {
      "id": "de5ac510-d757-449e-92cf-ad22976bf06d",
      "name": "Receipt Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -40,
        380
      ]
    },
    {
      "id": "a2b4ffb7-abe8-4298-abee-8d14390ad242",
      "name": "AI Analyzer",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -200,
        380
      ]
    },
    {
      "id": "aa36fb3b-fc38-419d-b520-7fd5cc474697",
      "name": "Send Error Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        700,
        180
      ]
    },
    {
      "id": "e1e9ecb9-c40f-4031-8d40-01ce7fb01ddc",
      "name": "Send Expense Summary",
      "type": "n8n-nodes-base.telegram",
      "position": [
        700,
        460
      ]
    },
    {
      "id": "d416dcad-b156-40c7-a0de-e46b268dd878",
      "name": "Sticky - Parse Receipt Data1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        680,
        -300
      ],
      "parameters": {
        "width": 360,
        "height": 200,
        "content": "## **MoneyMate is free to use!**\nGot feedback, ideas, or just wanna chat? Find me at [khmuhtadin.com](https://khmuhtadin.com).  \n\nWanna buy me a coffee to fuel more workflows? Head to [buymeacoffee.co"
      }
    },
    {
      "id": "958bcce1-d9a2-4318-b6fd-47351631af7d",
      "name": "Extract Value From Image",
      "type": "n8n-nodes-tesseractjs.tesseractNode",
      "position": [
        20,
        -180
      ]
    },
    {
      "id": "bf5e529b-f6a7-433c-bf91-1d6d55542766",
      "name": "Sticky - Send Expense Summary1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        700,
        360
      ],
      "parameters": {
        "width": 340,
        "height": null,
        "content": "## 📬 **Send Expense Summary**\nSends a summary of the recognized receipt or input to the user's Telegram chat."
      }
    },
    {
      "id": "482b1aca-67ff-4c5c-8201-35799a032990",
      "name": "Sticky - Extract Text Input1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -600,
        100
      ],
      "parameters": {
        "width": 260,
        "height": null,
        "content": "## 📝 **Extract Text Input**\nHandles plain text inputs when no image is provided by the user."
      }
    },
    {
      "id": "3a0e917f-acae-48ca-93ee-bc48b94c61e6",
      "name": "Sticky - Parse Receipt Data2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        500
      ],
      "parameters": {
        "width": 300,
        "height": null,
        "content": "## 📊 **Parse Receipt Data**\nConverts AI output into structured JSON with store, transaction, items, and totals."
      }
    },
    {
      "id": "4dc34baf-b732-47c2-932f-be2e67752cf2",
      "name": "Sticky - Get Telegram File1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -600,
        -280
      ],
      "parameters": {
        "width": 260,
        "height": null,
        "content": "## 📦 **Get Telegram File**\nFetches the file ID of a receipt image uploaded via Telegram."
      }
    },
    {
      "id": "62a9671e-ad05-40c3-9538-e0d5485c7978",
      "name": "Sticky - Download Image2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -300,
        -280
      ],
      "parameters": {
        "width": 260,
        "height": null,
        "content": "## ⬇️ **Download Image**\nDownloads the receipt photo and prepares it for text extraction."
      }
    },
    {
      "id": "a4a22a9f-8035-4508-a0b6-b5e2cf95d309",
      "name": "Sticky - Download Image3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -280
      ],
      "parameters": {
        "width": 260,
        "height": null,
        "content": "## 🖼️ **Text Extractor**\nExtract text from given image "
      }
    },
    {
      "id": "c0e74e58-1e17-4ffd-8c01-870e8b750054",
      "name": "Sticky - Format Summary Message1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        100,
        80
      ],
      "parameters": {
        "width": 260,
        "height": null,
        "content": "## 🧾 **Format Message**\nCreates a clear summary of expenses with store, date, items, total, and category."
      }
    },
    {
      "id": "f5ec65f1-738b-42a2-9114-7b1c694887d1",
      "name": "Sticky - AI Categorizer1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -200,
        80
      ],
      "parameters": {
        "width": 280,
        "height": null,
        "content": "## 🧠 **AI Categorizer**\nUses AI to classify input into categories like income or expenses, handling dates and languages."
      }
    },
    {
      "id": "5758b4fc-34ce-4451-a328-71528995b28c",
      "name": "Sticky - Send Error Message1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        700,
        80
      ],
      "parameters": {
        "width": 340,
        "height": null,
        "content": "## ❗ **Send Error Message**\nSends a warning to the user if the input is invalid or incomplete."
      }
    },
    {
      "id": "d945a2b3-7c41-41fe-9d89-72f69a42229d",
      "name": "Sticky - Check Invalid Input1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        380,
        80
      ],
      "parameters": {
        "width": 280,
        "height": null,
        "content": "## 🚫 **Check Invalid Input**\nDetects and flags incorrect or zero-value entries before sending a response."
      }
    },
    {
      "id": "101e18a0-1949-41f8-9826-dc2b5f1a2984",
      "name": "Sticky - OpenRouter AI Model1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        500
      ],
      "parameters": {
        "width": 300,
        "height": null,
        "content": "## 🤖 **OpenRouter AI Model**\nConfigures the language model to extract structured information from natural language input."
      }
    }
  ],
  "connections": {
    "AI Analyzer": {
      "ai_languageModel": [
        [
          {
            "node": "AI Categorizer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Categorizer": {
      "main": [
        [
          {
            "node": "Format Summary Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Image": {
      "main": [
        [
          {
            "node": "Extract Value From Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receipt Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Categorizer",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Check for Image": {
      "main": [
        [
          {
            "node": "Get Telegram File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Extract Text Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Check for Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Telegram File": {
      "main": [
        [
          {
            "node": "Download Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Text Input": {
      "main": [
        [
          {
            "node": "AI Categorizer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Invalid Input": {
      "main": [
        [
          {
            "node": "Send Error Message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Expense Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Summary Message": {
      "main": [
        [
          {
            "node": "Check Invalid Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Value From Image": {
      "main": [
        [
          {
            "node": "AI Categorizer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}