Finance · Small business

AI Agent for Telegram Expense Query with GPT-4.1 and Google Sheets

Chat with your expense data in Telegram. Ask natural-language questions and receive a clean summary from Google Sheets.

How it works
1 Step
Parse intent
2 Step
Resolve entities
3 Step
Query, summarize, respond
Parse the user’s natural-language query using GPT-4.1-nano to identify the time range, target category, and involved person(s).

Overview

End-to-end expense querying in Telegram powered by GPT-4.1-nano and mapping tables.

This AI agent connects your Google Sheets expense log to an AI-powered query engine that understands natural language. It resolves ambiguous categories and person names, and returns a clean, formatted summary directly in Telegram. The end-to-end flow enables chat-based questions to yield accurate, on-demand insights without opening a spreadsheet.


Capabilities

What Telegram Expense Query AI Agent does

Queries expenses from Google Sheets and returns a Telegram-ready summary.

01

Parse user intent from natural language queries using GPT-4.1-nano.

02

Resolve ambiguous categories and person names via mapping tables.

03

Query and filter Google Sheets expenses data by time range, category, and person.

04

Aggregate totals and provide breakdowns by category or person.

05

Format results into Telegram-ready messages with a clean layout.

06

Learn aliases over time to improve accuracy and reduce repeats.

Why you should use Telegram Expense Query AI Agent

This AI agent addresses real-world expense-reporting challenges by enabling natural-language access to financial data in a familiar chat interface. It processes ambiguous terms, resolves entities, and returns structured summaries. The system continuously learns by saving confirmed aliases, improving accuracy over time.

Before
Unknown category or person blocks accurate results
Manual filtering in Google Sheets is time-consuming
Ambiguous natural-language queries slow down answers
No quick way to see category or person breakdowns in real time
Lack of built-in confirmation for uncertain matches causes errors
After
Accurate results with AI-driven category/entity resolution
Fast responses in Telegram without opening spreadsheets
Automatic breakdowns by category or person
Self-learning aliases improve future accuracy
Inline confirmations reduce errors and speed decisions
Process

How it works

A simple 3-step flow that non-tech users can follow.

Step 01

Parse intent

Parse the user’s natural-language query using GPT-4.1-nano to identify the time range, target category, and involved person(s).

Step 02

Resolve entities

Resolve ambiguous categories and person names using mapping tables, offering closest matches when needed.

Step 03

Query, summarize, respond

Query Google Sheets with filters, aggregate results, format the summary for Telegram, and send it back; if needed, prompt for confirmation via inline buttons and save confirmed aliases for future accuracy.


Example

Example workflow

A realistic chat scenario showing input, processing, and output.

Scenario: A user in Telegram asks, “Show groceries spending last month.” The AI agent parses the request, resolves the groceries category, and filters the Google Sheets expenses log for the prior month. It then aggregates the total and provides a category breakdown, returning a clean, formatted summary directly in Telegram.

Finance & Accounting TelegramGoogle SheetsOpenAI GPT-4.1-nanoGoogle Sheets API AI Agent flow

Audience

Who can benefit

Roles that gain fast, chat-based access to expense insights.

✍️ Small business owner

Needs quick visibility into monthly expenses for decision-making without digging through spreadsheets.

💼 Freelancer

Wants project- or client-specific costs tracked across multiple clients via chat.

🧠 Finance manager

Needs consolidated expense views for teams or departments without complex dashboards.

Accountant

Requires on-demand summaries to reconcile ledgers efficiently.

🎯 Family budget manager

Keeps household spending in sight and under control through chat queries.

📋 Non-profit administrator

Tracks grant-related expenses and budgets quickly for reporting.

Integrations

Key tools work together to power chat-based expense insights.

Telegram

Delivers responses, uses inline buttons for disambiguation, and notifies users.

Google Sheets

Reads the expenses log and mapping tables; applies filters for time, category, and person.

OpenAI GPT-4.1-nano

Interprets natural-language queries, resolves entities, and generates formatted summaries.

Google Sheets API

Executes filtered queries, aggregations, and data retrieval.

Applications

Best use cases

Concrete scenarios where this AI agent adds value.

Answer monthly spend by category and person directly in Telegram.
Show weekly expense breakdowns with totals.
Identify top expense categories across the team for a period.
Compare spending against a budget for a selected timeframe.
Filter shared expenses with common_only and see who spent what.
Disambiguate unfamiliar categories or names with AI-suggested matches and confirm via inline buttons.

FAQ

FAQ

Common questions about data, usage, and security.

The AI agent reads data from your approved Google Sheets: expenses, expense_categories, categories_mapping, and person_mapping. It processes queries in Telegram and uses inline buttons to confirm ambiguous results when needed. Access is restricted to the specified sheets and authorized users. Data handling follows standard security practices, and changes to mappings update the resolution logic for future queries. You control which users can send queries and when data is retrieved.

Yes. The system supports natural-language queries in English and German, and it will resolve categories and entities accordingly. It provides the same formatted summaries regardless of language, ensuring consistency in responses. If a term is ambiguous in either language, it will prompt for clarification via Telegram inline buttons. You can switch languages mid-conversation, and the AI will adapt the remaining interaction.

Unknown categories or names trigger aAI-suggested closest matches. The agent asks for confirmation via Telegram inline buttons before saving a new alias. Once confirmed, the alias is stored to improve subsequent results. If a match is rejected, the system can propose alternatives and continue querying without disruption. This keeps results accurate while expanding the mapping dataset over time.

Data security is prioritized through restricted access to the Google Sheets and controlled integration points. All data transfers occur over secure channels, and only the specified sheets are read for querying. Users authenticate via Telegram, and access can be managed with an allowlist. The agent logs are designed to avoid exposing sensitive fields in Telegram messages, focusing on concise, formatted results.

Yes. The system supports multiple users via a Chat ID allowlist. Each user’s queries are scoped to their permissions and mappings. Responses are delivered in their Telegram chat, and disambiguation prompts are shown only to the relevant user when needed. This enables collaborative expense analysis without sharing sensitive data beyond allowed channels.

Date ranges can be specified in natural language, such as 'this week', 'last month', or specific periods like '2025-04'. The agent translates these into exact filters against Google Sheets data. It also supports relative dates for quick, repeatable queries. For precise reporting, you can combine date ranges with category or person filters in a single query.

Responses typically come back within a few seconds, depending on the query complexity and dataset size. Simple queries return results faster, while multi-criteria requests may require deeper filtering. The system is optimized for Telegram delivery, so formatted summaries are provided promptly with clear breakdowns. If a query is ambiguous, the bot prompts for confirmation to avoid delays from incorrect results.


AI Agent for Telegram Expense Query with GPT-4.1 and Google Sheets

Chat with your expense data in Telegram. Ask natural-language questions and receive a clean summary from Google Sheets.

Use this template → Read the docs