Skip to main content

Query expenses on Telegram with GPT-4.1 and Google Sheets

Workflow preview

Workflow preview
100%
Query expenses on Telegram with GPT-4.1 and Google Sheets preview
Open on n8n.io

1. Workflow Overview

Chat with Your Finances on Telegram Ask questions like “How much did I spend on food last month?” and get instant answers from your financial data — directly in Telegram. This workflow connects ...

Best for

  • Document Extraction automation workflows
  • AI Chatbot automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.telegramtrigger, @n8n/n8n-nodes-langchain.openai, n8n-nodes-base.code, n8n-nodes-base.googlesheets, n8n-nodes-base.telegram, n8n-nodes-base.merge, n8n-nodes-base.if, n8n-nodes-base.splitout

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Robin.

Original n8n.io source

1.1 Workflow description

Title
Query expenses on Telegram with GPT-4.1 and Google Sheets
Workflow name
Query expenses on Telegram with GPT-4.1 and Google Sheets

💬 Chat with Your Finances on Telegram

Ask questions like “How much did I spend on food last month?” and get instant answers from your financial data — directly in Telegram.

This workflow connects your Google Sheets expense log to an AI-powered query engine that understands natural language, resolves ambiguous categories and person names, and sends back a clean formatted summary in Telegram.

No spreadsheets. No dashboards. Just chat with your financial data.


⚡ How it works

Simply send a message like:

  • How much did we spend on groceries last month?
  • Show me a breakdown by category for this week.

The workflow automatically:

  1. Parses your intent using GPT-4.1-nano
  2. Resolves categories and person names via mapping tables
  3. Filters and aggregates expense data from Google Sheets
  4. Returns a formatted summary directly in Telegram

If a category or person is unknown, the workflow uses AI to suggest the closest match and asks the user to confirm via Telegram inline buttons.

Confirmed aliases are saved automatically, making the system self-learning over time.


✨ Key Features

  • Natural language queries in English and German
  • AI intent parsing with GPT-4.1-nano (time range, person, category, filters)
  • Self-learning entity resolution for categories and names
  • Interactive disambiguation via Telegram inline buttons
  • Relative date support (this week, last month, this year)
  • Group-by breakdowns by category or person
  • Shared expense filtering via common_only flag
  • Multi-user support via Chat ID allowlist

📋 Requirements

To run this workflow you need:

  • Telegram Bot (created via @BotFather)
  • OpenAI API key
  • Four Google Sheets

Required sheets:

  • expenses
  • expense_categories
  • categories_mapping
  • person_mapping

⏱ Setup Time

Approx. 15 minutes

All required configuration steps are documented directly inside the workflow using "Action Required" notes in each workflow layer.


Examples

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - MSG | Telegram Inbound

Type / Role
n8n-nodes-base.telegramTrigger - telegramTrigger
Config choices
Version 1.1

Block 2 - LLM | Parse Intent

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 1.4

Block 3 - JS | Extract Intent JSON

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 4 - GS | Load Expenses

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.4

Block 5 - GS | Load Categories

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.4

Block 6 - JS | Filter & Aggregate

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 7 - JS | Format Response Message

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 8 - TG | Send Reply

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 9 - MERGE | Combine Expenses + Categories

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 10 - IF | User Authorized?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 11 - SPLIT | Split Categories

Type / Role
n8n-nodes-base.splitOut - splitOut
Config choices
Version 1

Block 12 - GS | Read Category Mapping

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.7

Block 13 - MERGE | Join Categories with Mapping

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 14 - TG | Confirm Category Suggestion

Type / Role
n8n-nodes-base.telegram - telegram
Config choices
Version 1.2

Block 15 - GS | Read Allowed Categories

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.7

Block 16 - SET | Normalize Category

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 17 - MERGE | Check Category against Allowed

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 18 - IF | Category Known?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.3

Block 19 - LLM | Classify Category

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 1.4

Block 20 - MERGE | Combine Categories with List

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 21 - SET | Extract LLM Category

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 22 - IF | Category Suggestion Accepted?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.3

Block 23 - GS | Save Category Mapping

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.7

Block 24 - MERGE | Loop Entry (Category)

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Showing the first 24 of 89 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Query expenses on Telegram with GPT-4.1 and Google Sheets
Complexity advanced
Nodes 89
Categories Document Extraction, AI Chatbot
Author Robin
Published 14 Mar 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/14051/14051.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Query expenses on Telegram with GPT-4.1 and Google Sheets do?

Chat with Your Finances on Telegram Ask questions like “How much did I spend on food last month?” and get instant answers from your financial data — directly in Telegram. This workflow connects ...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction, AI Chatbot use case.