{
  "name": "Track expenses from Telegram to Google Sheets with GPT-4.1 Mini",
  "nodes": [
    {
      "id": "528b33c9-b3d7-4fc2-ad0c-8112b09377b2",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        864,
        2512
      ]
    },
    {
      "id": "73e405fd-1906-4970-9bfd-034663753371",
      "name": "OpenAI Chat Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1376,
        2436
      ]
    },
    {
      "id": "0923ce77-3410-4f8d-b8ca-19f1912bdb43",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1504,
        2436
      ]
    },
    {
      "id": "e61ee81e-b66a-4df9-a2d1-ad6b181fa009",
      "name": "Supported scenario?",
      "type": "n8n-nodes-base.if",
      "position": [
        1744,
        2316
      ]
    },
    {
      "id": "bcf6f9b4-23aa-4ddb-8b80-c7bbf54bf681",
      "name": "Acknowledge the expense",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1968,
        2176
      ]
    },
    {
      "id": "5a98d5eb-c402-4473-bd1c-5d1c4a9406be",
      "name": "Send un-supported scenario message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1968,
        2560
      ]
    },
    {
      "id": "b0377606-2f20-4329-9a11-7e710eea221e",
      "name": "Transform the output to expense record",
      "type": "n8n-nodes-base.code",
      "position": [
        1968,
        2368
      ]
    },
    {
      "id": "f5f1845c-02b3-4f9c-8e8f-5e98dda19dda",
      "name": "Log expense record to google sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2192,
        2368
      ]
    },
    {
      "id": "2fb66558-eae4-4a25-ad99-86c7e02e3a77",
      "name": "Budget Buddy Telegram Agent Text",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1344,
        2212
      ]
    },
    {
      "id": "ea33d919-65ea-4337-b386-a37a0999d006",
      "name": "Is text message?",
      "type": "n8n-nodes-base.if",
      "position": [
        1120,
        2516
      ]
    },
    {
      "id": "8227ca3e-9e42-4be6-942e-7febe923d4d8",
      "name": "Un-supported message type",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1432,
        2612
      ]
    },
    {
      "id": "8672c0fe-ff15-4dd2-a7fc-40f70539ad51",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1024,
        1520
      ],
      "parameters": {
        "width": 1024,
        "height": 2000,
        "content": "# 📒 Telegram Expense Tracker to Google Sheets with GPT-4.1\n\n## 👤 Who’s it for\nThis workflow is for anyone who wants to log their daily expenses by simply chatting with a Telegram bot. Ideal for:\n- Ind"
      }
    },
    {
      "id": "6dd2be31-9532-4cc9-b42a-6c7e55db816f",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2720,
        2224
      ],
      "parameters": {
        "width": 960,
        "height": 320,
        "content": "![Alt text](https://wisestackai.s3.ap-southeast-1.amazonaws.com/Screenshot+2025-08-04+at+9.32.37%E2%80%AFPM.png \"Optional title\")"
      }
    },
    {
      "id": "1b56c157-8f4d-4b8b-8b54-6a1993c20b25",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1952,
        1760
      ],
      "parameters": {
        "width": 960,
        "height": 272,
        "content": "![Alt text](https://wisestackai.s3.ap-southeast-1.amazonaws.com/Screenshot+2025-08-04+at+9.32.13%E2%80%AFPM.png \"Optional title\")"
      }
    },
    {
      "id": "6496a7e8-4c4d-4264-8e72-371a7457e415",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1920,
        2752
      ],
      "parameters": {
        "width": 960,
        "height": 288,
        "content": "![Alt text](https://wisestackai.s3.ap-southeast-1.amazonaws.com/Screenshot+2025-08-04+at+9.28.40%E2%80%AFPM.png \"Optional title\")"
      }
    },
    {
      "id": "083253a0-bc79-4acc-816b-bc3d0a5e8f4c",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        864,
        2816
      ],
      "parameters": {
        "width": 960,
        "height": 208,
        "content": "![Alt text](https://wisestackai.s3.ap-southeast-1.amazonaws.com/Screenshot+2025-08-04+at+9.37.48%E2%80%AFPM.png \"Optional title\")"
      }
    },
    {
      "id": "a3959a72-29f4-4947-b20a-d088781674dc",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        512,
        2512
      ],
      "parameters": {
        "width": 304,
        "height": 128,
        "content": "### 1. 📩 Telegram Trigger  \n**Description**: Listens for incoming messages from the user via the connected Telegram bot. This is the entry point of the workflow."
      }
    },
    {
      "id": "5cd98929-68d9-42fe-bf55-354efebe8dbc",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        976,
        2336
      ],
      "parameters": {
        "width": 272,
        "height": 144,
        "content": "### 2. Is Text Message?  \n**Description**: Checks whether the incoming Telegram message is a text message. If not, the workflow routes to an \"unsupported message type\" handler."
      }
    },
    {
      "id": "93216e1c-1d56-4b52-b81f-0cc10186549c",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1216,
        2064
      ],
      "parameters": {
        "width": 512,
        "height": 112,
        "content": "### 3. 💬 Budget Buddy Telegram Agent (GPT-4.1 Mini)  \n**Description**: Sends the user’s text message to the GPT-4.1 Mini model along with a system prompt. The model returns a JSON object with `relevan"
      }
    },
    {
      "id": "81c17aea-3f22-4c29-b220-17bc14f6512e",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1968,
        2048
      ],
      "parameters": {
        "width": 640,
        "height": 96,
        "content": "### 4.1. ✅ Acknowledge the Expense  \n**Description**: Sends a friendly confirmation message back to the user on Telegram, using the `message` field returned by the LLM.\n"
      }
    },
    {
      "id": "147c9089-8fed-44a7-86a5-350d9a5e56f5",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2144,
        2240
      ],
      "parameters": {
        "width": 512,
        "height": 96,
        "content": "### 4.2 Transform & log expense\n- Transform the Output to Expense Record  \n- Log Expense Record to Google Sheet  \n\n"
      }
    },
    {
      "id": "f453b718-dc12-41e5-8d6c-90323d546744",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2208,
        2576
      ],
      "parameters": {
        "width": 512,
        "height": 96,
        "content": "### 5 Let use know that the scenario is not supported\n- Only support budget expense\n- Let use know that their question/message is not relevant"
      }
    },
    {
      "id": "42f1955f-ba2e-466f-b3ed-ab2226b353a6",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        1520
      ],
      "parameters": {
        "width": 1136,
        "height": 752,
        "content": "![Alt text](https://wisestackai.s3.ap-southeast-1.amazonaws.com/Screenshot+2025-08-04+at+9.49.43%E2%80%AFPM.png \"Optional title\")"
      }
    }
  ],
  "connections": {
    "Is text message?": {
      "main": [
        [
          {
            "node": "Budget Buddy Telegram Agent Text",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Un-supported message type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Is text message?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "Budget Buddy Telegram Agent Text",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Supported scenario?": {
      "main": [
        [
          {
            "node": "Acknowledge the expense",
            "type": "main",
            "index": 0
          },
          {
            "node": "Transform the output to expense record",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send un-supported scenario message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Budget Buddy Telegram Agent Text",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Budget Buddy Telegram Agent Text": {
      "main": [
        [
          {
            "node": "Supported scenario?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transform the output to expense record": {
      "main": [
        [
          {
            "node": "Log expense record to google sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}