Volver a projects
Aug 10, 2025
2 min read

GastoBot

A Telegram bot that uses Google AI to record and organise personal expenses from text, voice, or receipt photos.

GastoBot

GastoBot is a Telegram bot designed to simplify personal expense tracking. It lets users record expenses quickly and flexibly through text, voice notes, or receipt photos. It integrates Google’s generative AI (Gemini) and automatically stores the information in monthly Google Sheets.

Purpose

The bot offers an intelligent, centralised alternative to manually entering expenses in a spreadsheet. Every entry can be validated, corrected, and organised before saving, ensuring accuracy and control.

Main features

  • Smart capture: accepts messages such as “I paid €15 at the supermarket”, voice notes, and receipt photos. It automatically extracts the merchant, amount, description, and category.
  • Validation before saving: the user can accept the expense, edit any field, or cancel the operation.
  • Automatic organisation: expenses are saved in Google Sheets, with one tab per month.
  • Monthly summaries: the /summary command generates a category breakdown for the current month.
  • Security: the bot only responds to the authorised Telegram user.

Workflow

  1. The user sends text, voice, or an image.
  2. Gemini processes the content and returns merchant, amount, description, and category in JSON format.
  3. The bot presents the extracted data in an interactive menu.
  4. The user confirms, edits, or cancels it.
  5. Once confirmed, the expense is added as a new row in the correct monthly Google Sheets tab.

Technology used

  • Python
  • python-telegram-bot
  • Google Generative AI (Gemini)
  • gspread and Google Sheets
  • python-dotenv

Commands

  • /start: displays the welcome message.
  • /help: shows usage instructions.
  • /summary: provides a current-month category summary.
  • /myid: displays the user ID used during initial setup.