Build Telegram Chatbot as Expense Tracker with GPT-4.1 Mini

Hey fellow automators!

I’m excited to share a sleek little workflow I built that turns your everyday expense messages in Telegram into structured entries in Google Sheets—all powered by GPT-4.1 Mini and good ol’ n8n magic.

It’s perfect for freelancers, teams, or anyone who hates manual logging but loves automation.

Watch demo video: https://www.youtube.com/watch?v=DsSs1EF1lQg

Try it for free now: Track expenses from Telegram to Google Sheets with GPT-4.1 Mini | n8n workflow template

What It Does (TL;DR)

  1. Telegram Trigger: You message your bot with something like “Bought coffee for 50k at Highlands.”

  2. LLM Processing: GPT-4.1 Mini parses and converts the message into a clean JSON structure:

    • relevant: true/false

    • expense_record (fields: date, amount, currency, category, description, source message)

    • a friendly message confirmation or fallback if it fails.

  3. Conditional Flow:

    • If relevant, n8n replies with some fun acknowledgment and then logs the entry to a Google Sheet.

    • If not, it nudges the user to rephrase, all in an encouraging tone.

Why It’s Cool

  • Zero tedious logging: Just talk to your bot naturally. GPT-4.1 Mini tidies it up for you.

  • Highly customizable: Add multi-currency support, categories, summaries, Slack alerts, dashboards—you name it.

  • Human-friendly validations: No more cryptic errors—your bot keeps it conversational and helpful.

  • Fully built in n8n: Connect Telegram, OpenAI, and Google Sheets with minimal hassle.

Setup Steps

1. Telegram Bot Setup

  • Create your bot via BotFather in Telegram.

  • Paste the token into the Telegram Trigger node.

2. Google Sheet

  • Set up columns:

    Date | Amount | Currency | Category | Description | SourceMessage

  • Share the sheet with your n8n service account.

3. OpenAI Integration

  • Hook up your OpenAI API key via the OpenAI Chat Model node.

  • Use GPT-4.1 Mini.

  • Include a system prompt to output JSON with the fields: relevant, expense_record, message.

4. Parse Response

  • Slot in the Structured Output Parser node to safely convert GPT output to usable JSON.

5. Conditional Logic Nodes

  • Is text message? → ensure only text is processed.

  • Supported scenario? → check if relevant = true in GPT’s response.

6. Final Actions

  • If valid: send a fun confirmation via Telegram → append to Google Sheets.

  • If not: send a friendly fallback message encouraging rephrasing.

Final Thoughts

If you’ve ever thought tracking daily expenses is a drag—this little n8n bot proves otherwise. Talk to it like a buddy, and it logs everything with style. Plus, it’s a great template to branch out into more complex automations.

Would love to see your tweaks or extensions! Maybe someone builds a companion visualizer or budget tracker next?

:link: More From Me

If you enjoy workflows like this, I regularly share automation ideas, tutorials, and experiments:

Let’s keep building cool automations together :rocket: