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
- Triggers when your Telegram bot receives a message and checks the sender chat ID against an allowed list.
- If the workflow is not locked yet, it replies with your chat ID so you can add it to the allowed list.
- If the message contains a voice note, it downloads the audio, renames it to a compatible format, and transcribes it with OpenAI.
- Uses the transcript or typed message text to have OpenAI parse a single expense (amount, category, merchant, date, and note) as JSON.
- Validates the parsed expense and, if it is not a valid spend, replies in Telegram asking for a clearer amount.
- Appends the expense to the Google Sheets “Expenses” worksheet, or reports an error in Telegram if the save fails.
- 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
- Create a Telegram bot with @BotFather and add a Telegram Trigger credential using the bot token.
- Add an OpenAI credential for audio transcription and chat completion.
- Create a Google Sheet with a worksheet named “Expenses” and headers: date, amount, category, merchant, note, then add a Google Sheets credential.
- 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.