{
  "name": "Telegram Expense Tracker Bot",
  "nodes": [
    {
      "parameters": {
        "updates": ["message"],
        "additionalFields": {}
      },
      "id": "tet00001-0001-4000-8000-000000000001",
      "name": "Telegram Message Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1,
      "position": [240, 300]
    },
    {
      "parameters": {
        "model": "gpt-4o-mini",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are an expense parser. Given a natural-language expense message, extract: amount (number), currency (string, default USD), category (one of: food, transport, accommodation, entertainment, health, work, other), description (string), date (ISO date string, default today). Return JSON only."
            },
            {
              "role": "user",
              "content": "{{ $json.message.text }}"
            }
          ]
        },
        "options": {
          "temperature": 0,
          "responseFormat": "json_object"
        }
      },
      "id": "tet00001-0002-4000-8000-000000000002",
      "name": "Parse Expense",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1,
      "position": [460, 300]
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": { "value": "YOUR_GOOGLE_SHEET_ID", "mode": "id" },
        "sheetName": { "value": "Expenses", "mode": "name" },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {}
        },
        "options": {}
      },
      "id": "tet00001-0003-4000-8000-000000000003",
      "name": "Log to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4,
      "position": [680, 300]
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram Message Trigger').item.json.message.chat.id }}",
        "text": "={{ '✅ Logged: ' + JSON.parse($('Parse Expense').item.json.message.content).description + ' — ' + JSON.parse($('Parse Expense').item.json.message.content).amount + ' ' + JSON.parse($('Parse Expense').item.json.message.content).currency }}",
        "additionalFields": {}
      },
      "id": "tet00001-0004-4000-8000-000000000004",
      "name": "Confirm via Telegram",
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1,
      "position": [900, 300]
    }
  ],
  "connections": {
    "Telegram Message Trigger": {
      "main": [[{ "node": "Parse Expense", "type": "main", "index": 0 }]]
    },
    "Parse Expense": {
      "main": [[{ "node": "Log to Google Sheets", "type": "main", "index": 0 }]]
    },
    "Log to Google Sheets": {
      "main": [[{ "node": "Confirm via Telegram", "type": "main", "index": 0 }]]
    }
  },
  "active": false,
  "settings": { "executionOrder": "v1" },
  "meta": {},
  "pinData": {}
}
