Build a Financial RAG Chatbot — Ask Questions About Your Bank Statement via Telegram Workflow with n8n
Your bank statement holds every answer about where your money goes — and none of them are accessible. To find out how much you spent on food last month, you export a CSV, open a spreadsheet, filter by
Your bank statement holds every answer about where your money goes — and none of them are accessible. To find out how much you spent on food last month, you export a CSV, open a spreadsheet, filter by category, sum a column, and cross-check dates. Five minutes for one question. For a founder tracking burn or an ops lead reconciling spend, that friction means the questions never get asked. The data sits there, unqueried, until the monthly review when it's already too late to change anything.
This article walks through building a Financial RAG chatbot with n8n: you upload transactions to a spreadsheet, then ask plain-language questions on Telegram — "How much on food last month?" or "What were my three biggest expenses in June?" — and GPT-4o answers from your actual data. No dashboards to build, no BI tool to license, no SQL to write.
Why spreadsheets and dashboards both fail here
The two default options each break for a specific reason. Spreadsheets are accurate but demand manual query construction — every question is a fresh pivot table. Dashboards are the opposite: they answer the questions you pre-defined months ago, and the moment reality shifts ("wait, why did software spend spike?") you're back to exporting raw data.
The real problem is the interface, not the storage. Financial questions are ad hoc and conversational by nature. You don't want a chart — you want an answer, in the two seconds between the thought and the next meeting. A retrieval-augmented generation (RAG) pattern fits perfectly: the spreadsheet is the source of truth, the language model is the query engine, and Telegram is the interface you already have open on your phone.
How the RAG chatbot works
The architecture is deliberately lean. Instead of embedding transactions into a vector database — overkill for a few hundred structured rows — the workflow pulls the relevant transaction rows directly from your spreadsheet and injects them into the model's context as grounding data. GPT-4o then reasons over real numbers rather than hallucinating plausible-sounding ones.
The flow, end to end:
- You upload or append transactions to a Google Sheet (date, description, amount, category).
- You send a question to your Telegram bot.
- n8n catches the message, reads the sheet, and passes both the question and the transaction rows to GPT-4o.
- The model computes the answer — sums, filters, comparisons — grounded strictly in your data.
- n8n sends the reply back to the same Telegram chat.
Because the answer is generated from rows the model can actually see, it's auditable. Ask "which transactions made up that food total?" and it lists them. That grounding is what separates a useful financial assistant from a confident liar.
Building it in n8n — node by node
Here's the concrete setup. The whole workflow is six nodes and takes about twenty minutes once your credentials are connected.
1. Telegram Trigger node. Create a bot via @BotFather in Telegram, copy the token, and add it as a Telegram credential in n8n. The Telegram Trigger node listens for the message update type. This fires every time you text the bot. Pull {{ $json.message.text }} for the question and {{ $json.message.chat.id }} for the reply address — you'll need that chat ID at the end.
2. Google Sheets node (read). Add a Google Sheets node set to Get Rows. Point it at your transactions sheet and return all rows. Connect your Google account via OAuth2. Keep the column headers clean and consistent — date, description, amount, category — because the model relies on them to reason. If your bank export uses different names, remap them here or in a Set node.
3. Code or Set node (format context). Add a Code node to compress the rows into a compact string the model can consume cheaply. Serialize each transaction as a single line: 2026-06-14 | Uber Eats | -42.90 | food. This slashes token usage versus dumping raw JSON and makes the data easier for GPT-4o to parse. For large histories, filter to the last 90 days here before sending.
4. AI Agent / OpenAI node. Use the AI Agent node (or the OpenAI Chat Model node directly) with GPT-4o selected. Your system prompt is the guardrail — something like: "You are a financial assistant. Answer only from the transaction data provided below. Show the numbers you used. If the data doesn't contain the answer, say so — never estimate or invent figures." Then pass the user's question and the formatted transaction block as the user message. Set temperature to 0.1 for deterministic arithmetic.
5. Telegram node (send). Add a Telegram node set to Send Message. Wire the chat ID from step 1 into the Chat ID field and the model output into Text. Enable Markdown parsing so numbers and lists render cleanly. Connect it to the AI node's output and the loop is closed.
6. (Optional) Google Sheets node (append). If you want the bot to also log expenses ("add $12 coffee to food"), branch after the trigger with a Switch node that routes commands to an Append Row Sheets node. This turns the same bot into a lightweight expense tracker.
What this actually buys you
The payoff isn't novelty — it's the collapse of friction between a financial question and its answer. Concretely:
- Instant answers on the device you already use. No laptop, no export, no pivot table. Ask from the checkout line.
- Grounded, not guessed. Because GPT-4o answers from real rows, you can trust the totals — and verify them, since it shows its work.
- Zero new infrastructure. Google Sheets you already have, Telegram is free, and n8n runs the orchestration. The only variable cost is a few cents of OpenAI tokens per question.
- Natural-language flexibility. The dashboard you'd have built answers ten questions. This answers any question — including the ones you haven't thought of yet.
- Fully private and self-hosted. On a self-hosted n8n instance, your transaction data never touches a third-party analytics vendor — it flows only between your sheet and the model call you control.
For a founder, that's real-time burn awareness. For an ops team, it's reconciliation questions answered in the thread instead of a ticket.
Common pitfalls — and how to avoid them
Sending too many rows. Dumping years of transactions into every prompt inflates token cost and can exceed context limits. Filter by date range in the Code node before the model call, or pre-aggregate by category when the question is high-level.
Letting the model do fuzzy math. Language models can drift on long arithmetic. Keep temperature near zero, insist in the system prompt that it show the transactions it summed, and — for mission-critical totals — do the sum in a Code node and let GPT-4o only phrase the answer. Deterministic math belongs in code; language belongs in the model.
Inconsistent categories. If "food," "Food," "groceries," and "restaurants" all coexist, "how much on food" undercounts. Normalize categories in the sheet or add a mapping step. Garbage categorization is the number-one cause of wrong answers here.
No Telegram whitelist. By default anyone who finds your bot can query your finances. Add an IF node right after the trigger that checks message.from.id against your own Telegram user ID and drops everything else. This one node is non-negotiable for financial data.
Silent failures. If the Sheets read returns empty or the OpenAI call errors, a naive workflow just goes quiet. Add an Error Trigger workflow or a fallback Telegram message ("Couldn't reach your data — try again") so you know when something broke instead of assuming the bot is thinking.
Ambiguous date logic. "Last month" means different things on the 1st versus the 30th. Compute the actual date boundaries in the Code node and pass them explicitly to the model rather than trusting it to infer "last month" from today's date.
Get those six things right and you have a financial assistant that's faster than any dashboard, cheaper than any BI tool, and honest about its numbers — all in a workflow you can read on one screen.
Ja construimos isso pra voce
Nao comece do zero. O Financial RAG Chatbot — Ask Questions About Your Bank Statement via Telegram e um workflow n8n pronto para instalar — conecta suas ferramentas em minutos, sem codigo.
Instalar por $59 →