Hi everyone,
I’m still fairly new to n8n, and I wanted a project that goes beyond “form → spreadsheet”. So I built a small expense tracker and put it on GitHub in case it helps other beginners.
How it works:
You send a plain message to a Telegram bot, like “Lunch 850 at KFC”. Gemini turns that into structured data (amount, currency, category, merchant, date). n8n saves it to a Google Sheet and the bot replies with a confirmation.
The flow:
Telegram Trigger → IF (is it me?) → AI extraction → IF (is the result valid?) → Google Sheets → Telegram reply
If the AI can’t find an amount, the bot asks you to try again instead of saving junk.
Things I learned that might save you some time:
- A Structured Output Parser plus temperature 0 gave me clean JSON far more reliably than just asking for JSON in the prompt.
- Don’t trust AI output blindly. I added an IF node that checks “valid” is true and the amount is above 0 before anything reaches the sheet.
- After the AI node, $json holds the AI output, not the original message. To get the original text, I had to reference the earlier node, like $(‘Telegram Trigger’).
- The IF node only accepts my own chat ID, so anyone who finds the bot gets ignored.
- Only one active workflow can use a Telegram bot at a time, so don’t leave a test listener running next to an active one.
- Set the date column in Sheets to plain text, or dates get converted.
The repo has the sanitized workflow JSON, the exact prompt, sample test messages (including ones that should be rejected), a troubleshooting table, and a note on swapping Telegram for a Webhook in case Telegram isn’t available where you are.
Repo: GitHub - codewithghani/n8n-ai-expense-tracker-telegram-google-sheets: Send expenses to a Telegram bot, let Gemini extract the details, and log them to Google Sheets with n8n. · GitHub
I’d really appreciate feedback, especiall
