See llms.txt for all machine-readable content.

Back to Templates

Track expenses and monthly budgets from Telegram with OpenAI and Google Sheets

Quick overview

This workflow listens for Telegram messages, transcribes voice notes with OpenAI, extracts a structured expense, and appends it to a Google Sheets “Expenses” tab, then replies in Telegram with month-to-date totals and category budget status.

How it works

  1. Triggers when your Telegram bot receives a message and checks the sender chat ID against an allowed list.
  2. If the workflow is not locked yet, it replies with your chat ID so you can add it to the allowed list.
  3. If the message contains a voice note, it downloads the audio, renames it to a compatible format, and transcribes it with OpenAI.
  4. Uses the transcript or typed message text to have OpenAI parse a single expense (amount, category, merchant, date, and note) as JSON.
  5. Validates the parsed expense and, if it is not a valid spend, replies in Telegram asking for a clearer amount.
  6. Appends the expense to the Google Sheets “Expenses” worksheet, or reports an error in Telegram if the save fails.
  7. Reads all rows from the sheet, totals spending for the current month (overall and by category), compares it to your configured monthly budgets, and sends a confirmation summary back to Telegram.

Setup

  1. Create a Telegram bot with @BotFather and add a Telegram Trigger credential using the bot token.
  2. Add an OpenAI credential for audio transcription and chat completion.
  3. Create a Google Sheet with a worksheet named “Expenses” and headers: date, amount, category, merchant, note, then add a Google Sheets credential.
  4. Paste your Google Sheet URL into sheet_url in the Settings step, publish the workflow, message the bot once, and copy the returned chat ID into allowed_chat_id.