# Track & query expenses with Telegram and OpenAI: n8n workflow

> Started by an incoming Telegram message, and works across Gmail, Google Sheets and Telegram.

Source: https://millionrounds.com/workflow/track-and-query-expenses-with-telegram-and-openai (Millionrounds; every figure on the page links to its filing or article)

[Automation library](https://millionrounds.com/workflows) · [Money admin](https://millionrounds.com/workflows?category=Money+admin#library)

# Track & query expenses with Telegram and OpenAI

Started by an incoming Telegram message, and works across Gmail, Google Sheets and Telegram. It puts OpenAI behind a retrieval step, so answers are drawn from documents you supply rather than from the model alone. 24 steps, 3 branches, 1 loop or waits: large, and worth reading before you trust it with anything live.

Large Calls a model: OpenAI Retrieval

[Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Ftrack-and-query-expenses-with-telegram-and-openai)

**24 steps** Large: read it before trusting it with anything live

**3** Branches: places the flow splits

**1** Loop or waits

**3** Services it connects to

## The flow

Starts it 1 Model 3 Logic 6 Service 14

The steps in the order they run, from what starts it.

- 1 **Telegram Input** Telegram trigger *Starts it*
- 2 **Append Transaction to Sheet** Google Sheets Tool *Service*
- 3 **Read Sheet for Queries** Google Sheets Tool *Service*
- 4 **Send Low Balance Alert** Gmail Tool *Service*
- 5 **GPT-4.1 Mini Model** Lm Chat Open Ai *Model*
- 6 **Conversation Memory** Memory Buffer Window *Model*
- 7 **Route by Message Type** Switch *Logic*
- 8 **AI Expense Analyzer** Agent *Model*
- 9 **Check Voice Quality** Switch *Logic*
- 10 **Send Processing Notification (Text)** Telegram *Service*
- 11 **Generate Voice Response** Http Request *Service*
- 12 **Track API Costs** Code *Logic*
- 13 **Send Processing Notification (Voice)** Telegram *Service*
- 14 **🎙️ Download Voice File** Telegram *Service*
- 15 **Read Transaction History** Google Sheets *Service*
- 16 **Send Voice to Telegram** Telegram *Service*
- 17 **Send Text to Telegram** Telegram *Service*
- 18 **Log Cost to Sheet** Google Sheets *Service*
- 19 **Upload to AssemblyAI** Http Request *Service*
- 20 **Calculate Starting Balance** Code *Logic*
- 21 **Start Transcription** Http Request *Service*
- 22 **Wait for Transcription** Wait *Logic*
- 23 **Get Transcription Result** Http Request *Service*
- 24 **Check Transcription Status** If *Logic*

## How it's built

- **Starts on:** An incoming Telegram message
- **Steps:** 24, with 3 branches, 1 loop or waits
- **Size:** Large: read it before trusting it with anything live
- **Connects to:** Gmail, Google Sheets, Telegram
- **Model:** OpenAI
- **Retrieval:** Answers are drawn from documents you supply, not from the model alone

## Questions

What does it need to run?

An n8n account, plus your own Gmail, Google Sheets and Telegram accounts, and a key for OpenAI. You connect your own accounts after importing it; none are included.

What starts it?

It starts on an incoming Telegram message.

Does it use AI?

Yes. It calls OpenAI. Its answers draw on documents you give it, not on the model alone. Model calls are billed by the provider, not by n8n.

How long does it take to set up?

Take your time. At 24 steps it is large: read it before trusting it with anything live.

How do I import it?

Copy the workflow, open a new workflow in n8n and paste. The steps appear on the canvas, ready for your own accounts.

**Before you run it**

Nothing here has been tested by us. It is somebody's working automation, read and described from its own steps. Treat the connections it wants as a list of accounts it will touch, and read the 24 steps before you point it at anything that matters.

## Run it in n8n

- **Create your n8n account** Free to start. n8n is where the workflow runs. [Create an n8n account ↗](https://millionrounds.com/n8n)
- **Download the workflow** Free with a Millionrounds account. [Download free](https://millionrounds.com/login?next=%2Fapp%2Fworkflow%2Ftrack-and-query-expenses-with-telegram-and-openai)
- **Paste it into n8n** Open a new workflow in n8n and paste. Then connect your own accounts.

Stored with the author's traces removed: canvas notes, instance identifiers, saved credential names and any live document they had left behind.

## Connects to

Each opens the other workflows that use it.

[Gmail](https://millionrounds.com/workflows?service=Gmail#library)[Google Sheets](https://millionrounds.com/workflows?service=Google+Sheets#library)[Telegram](https://millionrounds.com/workflows?service=Telegram#library)

## Workflows like it

Also money admin, with the same services where possible, closest in size first.

- [**Log receipt expenses in Notion with Gmail and Telegram** 24 steps · calls a model · Airtable, Gmail](https://millionrounds.com/workflow/log-receipt-expenses-in-notion-with-gmail-and-telegram)
- [**Telegram Expense Tracker with Image and PDF** 24 steps · calls a model · Google Sheets, Telegram](https://millionrounds.com/workflow/telegram-expense-tracker-with-image-and-pdf)
- [**Automated expense tracking from emails & Telegram with Gemini** 23 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/automated-expense-tracking-from-emails-and-telegram-with-gem)
- [**Automated template delivery system with Stripe and Gmail** 25 steps · calls a model · Gmail, Google Sheets](https://millionrounds.com/workflow/automated-template-delivery-system-with-stripe-and-gmail)
- [**Create AI proposals from Fireflies transcripts with OpenAI** 25 steps · calls a model · Gmail, Google Docs](https://millionrounds.com/workflow/create-ai-proposals-from-fireflies-transcripts-with-openai)
- [**Create cinematic quote videos with Gemini** 25 steps · calls a model · Google Cloud Storage, Google Sheets](https://millionrounds.com/workflow/create-cinematic-quote-videos-with-gemini)
