🔓 Unlock all 10,000+ workflows & prompts free Join Newsletter →
✅ Full access unlocked — explore all 10,000 AI workflow and prompt templates Browse Templates →
Home n8n Workflow
January 22, 2026

Telegram + Google Sheets, expenses logged and categorized

Lisa Granqvist Partner Workflow Automation Expert

Expense tracking usually fails for one boring reason. You don’t forget to spend money, you forget to write it down, then you end up “catching up” on a Sunday night with a pile of receipts.

Marketing managers doing client reimbursements feel it. Small business owners feel it harder. And if you’re a freelancer juggling tools, Telegram expense logging automation is the first thing that makes tracking feel effortless instead of annoying.

This n8n workflow turns your Telegram messages (text, voice, photos, PDFs) into clean, categorized rows in Google Sheets, then lets you ask questions like “How much on groceries this month?” without building a spreadsheet monster.

How This Automation Works

The full n8n workflow, from trigger to final output:

n8n Workflow Template: Telegram + Google Sheets, expenses logged and categorized

The Problem: Expense Tracking Breaks the Moment You Get Busy

You already have the intent to track expenses. The breakdown happens in the tiny gap between “I just paid” and “I should log that.” Receipts end up in your pocket, screenshots disappear into camera roll, and voice notes sit in your head until they don’t. Then you’re stuck reverse-engineering dates, vendors, and categories from messy bank statements. Honestly, the worst part isn’t the time. It’s the constant mental tab you keep open because you know your numbers aren’t current.

It adds up fast. Here’s where it usually goes sideways.

  • Manual entry turns into a weekly chore, so you delay it and your data becomes unreliable.
  • Receipts come in different formats (photos, PDFs, crumpled paper), which makes “one process” impossible.
  • Categories drift over time, so “Dining Out” becomes “Food,” “Meals,” and “Restaurants” in the same month.
  • You can’t answer basic questions quickly, because totals and breakdowns require extra spreadsheet work.

The Solution: Log Expenses From Telegram (Text, Voice, Receipts)

This workflow gives you a private Telegram bot that behaves like an expense assistant. You send a receipt photo, a PDF invoice, a voice message (“Bought coffee for five euros”), or a quick text (“50 uber”). The workflow pulls the content from Telegram, converts it into usable text (OCR for images and documents, transcription for audio), and hands it to an AI agent that extracts the important parts: amount, date, vendor, currency, and category. Then it stores the structured result in your expense store and writes a clean, consistent log in Google Sheets so you can filter, sort, and summarize whenever you want.

It starts with a Telegram message trigger. From there, n8n routes the message type, runs OCR or transcription when needed, and sends one standardized payload to the AI router. Finally, the bot replies back in Telegram with a friendly “Added: 45.50 EUR – Groceries (Lidl)” style confirmation, and your sheet stays up to date in the background.

What You Get: Automation vs. Results

Example: What This Looks Like

Say you log 5 expenses a day. Manually, it’s usually about 5 minutes each once you find the receipt, remember the category, and type it in, so you’re at roughly 25 minutes a day (and more when you miss a day). With this workflow, you forward a receipt photo or voice note in Telegram in about 1 minute and you’re done. The AI processing runs while you move on, then your Google Sheet is already updated for month-end totals.

What You’ll Need

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • Telegram Bot to receive messages and reply.
  • Google Sheets to store a clean expense ledger.
  • OpenRouter API key (get it from your OpenRouter dashboard).

Skill level: Intermediate. You’ll connect accounts, paste API keys, and tweak a couple of AI prompts for categories and currency.

Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).

How It Works

Telegram message comes in. The workflow triggers on any message to your bot, then captures context (chat ID, attachments, message type) so replies go to the right place.

Privacy lock and routing happen immediately. On first use, the bot “claims” a single user and saves preferences. After that, unauthorized chats get rejected, which keeps your expense data private.

Voice, receipt photos, and PDFs get converted into text. Audio files are fetched from Telegram and transcribed. Documents and images are pulled and run through OCR so the AI can read totals, dates, and vendor names.

The AI agent extracts and categorizes, then stores the result. The router sends the standardized payload to the expense assistant, which validates the structure, applies categories, calculates stats when you ask, and writes output for Google Sheets and Telegram.

You can easily modify the default currency and category list to match your bookkeeping. See the full implementation guide below for customization options.

Step-by-Step Implementation Guide

Step 1: Configure the Telegram Trigger

Set up the workflow entry point to capture Telegram messages and attachments.

  1. Add and open Telegram Intake Trigger.
  2. Set Updates to message.
  3. In Additional Fields, enable Download and set Image Size to extraLarge.
  4. Credential Required: Connect your telegramApi credentials.

Step 2: Connect App Preferences and Authorization

Capture language context, retrieve app settings, and control who can use the bot.

  1. Open Capture Message Context and set the assignment document_language to {{ $json.message.from.language_code ?? "en" }} with Include Other Fields enabled.
  2. Open Fetch App Preferences and set URL to https://api.ainoflow.io/api/v1/storage/json/config/expense-app-settings.
  3. Credential Required: Connect your httpBearerAuth credentials in Fetch App Preferences.
  4. Configure Authorize Chat Access to compare {{ $('Telegram Intake Trigger').item.json.message.chat.id }} with {{ $json.chat_id ?? $('Telegram Intake Trigger').item.json.message.chat.id }}, and allow a 404 status for first-time setup.
  5. Ensure Fetch App Preferences outputs to both Detect First Use and Authorize Chat Access in parallel.
  6. In Detect First Use, keep the condition to check {{ $json.error.status }} equals 404, then connect to Store App Preferences.
  7. Open Store App Preferences and map fields: {{ $('Telegram Intake Trigger').item.json.message.chat.id }}, {{ $('Telegram Intake Trigger').item.json.message.date }}, and {{ $('Telegram Intake Trigger').item.json.message.chat.first_name }}.
  8. Credential Required: Connect your httpBearerAuth credentials in Store App Preferences.
Tip: The workflow uses Fetch App PreferencesAuthorize Chat Access parallel routing to allow new users while preventing unauthorized access.

Step 3: Configure Message Routing and Input Mapping

Route Telegram messages into text, voice, document, and photo processing paths and normalize all content into a single agent input format.

  1. Open Route Message Type and keep the outputs for /start, text, voice, document, and photo using expressions like {{ $('Telegram Intake Trigger').item.json.message.text }} and {{ $('Telegram Intake Trigger').item.json.message.voice.file_id }}.
  2. Authorize Chat Access outputs to Route Message Type, Post Processing Notice, and Fetch Processing State in parallel.
  3. Configure Send Welcome Note to use Chat ID {{ $('Telegram Intake Trigger').item.json.message.chat.id }} and the provided welcome message text.
  4. Credential Required: Connect your telegramApi credentials in Send Welcome Note.
  5. For text messages, open Map Text Payload and map text to {{ $('Telegram Intake Trigger').item.json.message.text }} and chat_id to {{ $('Telegram Intake Trigger').item.json.message.chat.id }}.
  6. For voice messages, configure Retrieve Voice File using {{ $('Telegram Intake Trigger').item.json.message.voice.file_id }}, then Transcribe Voice with the languages field set to {{ $('Capture Message Context').item.json.document_language }}.
  7. Credential Required: Connect your telegramApi credentials in Retrieve Voice File and httpBearerAuth credentials in Transcribe Voice.
  8. Map transcriptions in Map Voice Payload using {{ $json.content[0].text }} and {{ $('Telegram Intake Trigger').item.json.message.chat.id }}.
  9. For documents and photos, configure Retrieve Document File and Retrieve Photo File with file IDs from the trigger, then run Extract Document Text and Extract Image Text with multipart-form-data and {{ $('Capture Message Context').item.json.document_language }}.
  10. Credential Required: Connect your telegramApi credentials to file retrieval nodes and httpBearerAuth credentials to the extraction nodes.
  11. Normalize all document/photo outputs in Map File Payload and Map Image Payload using the combined text template: User uploaded document / photo: {{ $('Capture Message Context').item.json.message.caption ?? "" }} {{ $json.content ? $json.content[0].text : "The uploaded file does not contain text content." }}.
  12. Finally, open Prepare Agent Input and map text to {{ $json.text }} and chat_id to {{ $json.chat_id }}.
⚠️ Common Pitfall: If Retrieve Photo File is missing, OCR will never run and document messages will not reach Prepare Agent Input.

Step 4: Set Up AI Routing and Tools

Configure the primary AI router and its specialized tools to interpret and store expenses.

  1. Open Primary AI Router and set Text to {{ $('Prepare Agent Input').item.json.text }} with the provided system prompt.
  2. Attach Main Memory Buffer to Primary AI Router using Session Key agent_{{ $('Prepare Agent Input').item.json.chat_id }} and Context Window Length 30.
  3. Attach Reflection Tool as a tool for Primary AI Router.
  4. Connect OpenAI Model as the language model with Model set to openai/gpt-4o.
  5. Credential Required: Connect your openRouterApi credentials in OpenAI Model.
  6. Open Expense Specialist and keep the tool description and system message intact for storage rules and categories.
  7. Attach Assistant Memory Buffer to Expense Specialist with Session Key expense_assitant_{{ $('Prepare Agent Input').item.json.chat_id }}.
  8. Connect Sonnet Model as the language model for Expense Specialist with Model anthropic/claude-sonnet-4.5.
  9. Credential Required: Connect your openRouterApi credentials in Sonnet Model.
  10. Attach Reasoning Tool, JSON Storage Tool, and Math Helper to Expense Specialist as tools.
  11. Credential Required: Connect your httpBearerAuth credentials in JSON Storage Tool.
Tip: Main Memory Buffer, Assistant Memory Buffer, Reflection Tool, Reasoning Tool, JSON Storage Tool, and Math Helper are AI sub-nodes. Add credentials on their parent nodes (Primary AI Router or Expense Specialist), not on the sub-nodes.

Step 5: Configure Processing Notices and State Cleanup

Use Telegram notices and HTTP storage to display processing status and remove temporary messages once done.

  1. Open Post Processing Notice and set Chat ID to {{ $('Telegram Intake Trigger').item.json.message.chat.id }}.
  2. Credential Required: Connect your telegramApi credentials in Post Processing Notice.
  3. Open Record Processing State and set URL to https://api.ainoflow.io/api/v1/storage/json/expense-app-processing/{{ $('Telegram Intake Trigger').item.json.update_id }}.
  4. Map Body Parameters to {{ $json.result.chat.id }} and {{ $json.result.message_id }}, and set expiresMs to 3600000.
  5. Credential Required: Connect your httpBearerAuth credentials in Record Processing State.
  6. Open Fetch Processing State with the same URL pattern and connect to Check State Presence, which then deletes the status via Remove Processing Note.
  7. Credential Required: Connect your httpBearerAuth credentials in Fetch Processing State and telegramApi credentials in Remove Processing Note.
  8. Keep Send Unauthorized Alert connected to the false path of Authorize Chat Access with message You are not authorized to use this bot..
  9. Credential Required: Connect your telegramApi credentials in Send Unauthorized Alert.

Step 6: Configure Agent Output Delivery

Deliver AI responses back to the user after processing the input.

  1. Open Send Agent Reply and set Text to {{ $json.output }}.
  2. Set Chat ID to {{ $('Prepare Agent Input').item.json.chat_id }}.
  3. Ensure Additional Fields include parse_mode set to Markdown.
  4. Credential Required: Connect your telegramApi credentials in Send Agent Reply.

Step 7: Configure Manual Cleanup Utilities

Use the manual cleanup path to purge stored expense data when required.

  1. Open Manual Cleanup Trigger to allow on-demand execution.
  2. Configure Iterate Categories with URL https://api.ainoflow.io/api/v1/storage/json.
  3. Configure Iterate Category Items with URL https://api.ainoflow.io/api/v1/storage/json/{{ $json.category }}.
  4. Configure Delete Stored Item with URL https://api.ainoflow.io/api/v1/storage/json/{{ $json.category }}/{{ $json.key }} and Method DELETE.
  5. Credential Required: Connect your httpBearerAuth credentials in Iterate Categories, Iterate Category Items, and Delete Stored Item.

Step 8: Test and Activate Your Workflow

Validate all paths and activate the workflow for production use.

  1. Click Execute Workflow and send a Telegram text like spent 50 on groceries to confirm Send Agent Reply returns a formatted response.
  2. Test a voice note and a receipt photo to confirm Transcribe Voice and Extract Image Text flow into Prepare Agent Input.
  3. Verify the processing notice appears from Post Processing Notice and is removed by Remove Processing Note.
  4. If a chat is not authorized, confirm Send Unauthorized Alert is sent.
  5. When all tests pass, toggle the workflow to Active to enable production execution.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Common Gotchas

  • Telegram bot credentials can expire or be mis-scoped. If replies stop working, check the BotFather token and the Telegram node credentials in n8n first.
  • If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
  • Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.

Frequently Asked Questions

How long does it take to set up this Telegram expense logging automation?

About 30 minutes if you already have your Telegram bot token and API keys ready.

Do I need coding skills to automate Telegram expense logging?

No coding required. You’ll mostly be connecting accounts and pasting API keys into n8n.

Is n8n free to use for this Telegram expense logging workflow?

Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in OpenRouter API usage for AI processing and OCR/transcription API costs.

Where can I host n8n to run this automation?

Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.

Can I customize this Telegram expense logging automation for different categories and currencies?

Yes, and you should. You can update the category list inside the Expense Assistant prompt, and change the default currency there as well (it defaults to EUR). If you prefer different AI models, swap the OpenRouter chat model nodes used for the main processing and the assistant responses. Many people also tweak the reply formatting so Google Sheets gets short descriptions while Telegram gets a nicer summary.

Why is my Telegram connection failing in this workflow?

Most of the time it’s an invalid or rotated bot token in your Telegram credentials. It can also be a privacy setting mismatch (wrong chat, wrong bot) or missing permissions to fetch files, which shows up when audio/photo/document retrieval nodes start failing. Check the Telegram node credential in n8n, then send a simple text message to confirm the trigger still fires before testing receipts again.

How many expenses can this Telegram expense logging automation handle?

A typical setup can handle hundreds of expenses a month without issue; the real limits come from your n8n plan and your OCR/transcription/AI API rate limits.

Is this Telegram expense logging automation better than using Zapier or Make?

It depends on what you’re doing. If you only want “Telegram message → add a row,” Zapier or Make can be quicker to click together. This workflow is more than that: it routes message types, fetches Telegram files, runs OCR and transcription, and uses an AI agent with memory to both log expenses and answer questions like “compare last 3 months.” n8n also gives you a self-hosting option, which is useful if you don’t want per-task pricing every time you log a receipt. If you want someone to sanity-check your setup, Talk to an automation expert.

Once this is running, your sheet stays current without you thinking about it. The bot handles the repetitive capture, and you finally get clean monthly totals when you need them.

Need Help Setting This Up?

Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.

Lisa Granqvist

Workflow Automation Expert

Expert in workflow automation and no-code tools.

×

Use template

Get instant access to this n8n workflow Json file

💬
Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Launch login modal Launch register modal