{
  "name": "Kharcha Tracker Starter",
  "nodes": [
    {
      "id": "1",
      "name": "New Spend",
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      }
    },
    {
      "id": "2",
      "name": "Read Spend",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.6,
      "position": [
        300,
        0
      ],
      "parameters": {
        "promptType": "define",
        "hasOutputParser": true,
        "text": "=You split a short personal expense message into fields. Reply only in the requested format.\n- amount: the number only, no currency sign (use 0 if there is no number)\n- category: one of food, travel, study, fun, shopping, bills, other\n- note: the item in one or two words\n\nMessage: {{ $json.message.text }}"
      }
    },
    {
      "id": "3",
      "name": "Gemini Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        220,
        260
      ],
      "parameters": {
        "options": {}
      }
    },
    {
      "id": "4",
      "name": "Fixed Fields",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.2,
      "position": [
        420,
        260
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"amount\": 80,\n  \"category\": \"food\",\n  \"note\": \"momos\"\n}"
      }
    },
    {
      "id": "5",
      "name": "Add Row",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.6,
      "position": [
        640,
        0
      ],
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Date": "={{ $now.toFormat('dd LLL') }}",
            "Amount": "={{ $json.output.amount }}",
            "Category": "={{ $json.output.category }}",
            "Note": "={{ $json.output.note }}"
          },
          "matchingColumns": [],
          "schema": []
        },
        "options": {}
      }
    },
    {
      "id": "6",
      "name": "Send Reply",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        940,
        0
      ],
      "parameters": {
        "chatId": "={{ $('New Spend').item.json.message.chat.id }}",
        "text": "=Logged: {{ $('Read Spend').item.json.output.amount }} ({{ $('Read Spend').item.json.output.category }})",
        "additionalFields": {
          "appendAttribution": false
        }
      }
    }
  ],
  "connections": {
    "New Spend": {
      "main": [
        [
          {
            "node": "Read Spend",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Spend": {
      "main": [
        [
          {
            "node": "Add Row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini Model": {
      "ai_languageModel": [
        [
          {
            "node": "Read Spend",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Fixed Fields": {
      "ai_outputParser": [
        [
          {
            "node": "Read Spend",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Add Row": {
      "main": [
        [
          {
            "node": "Send Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}