Receipt and Expense Tracker via Telegram using OCR and LLM - n8n Workflow

Use this powerful n8n workflow to track expenses instantly. Capture receipts via Telegram, extract text using Tesseract OCR, and categorize expenses using AI parsing via OpenRouter/LangChain.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

-
Individuals seeking better budgeting: Those who want a fast, hands-free method to log daily expenses.
N8n power users: Developers looking for advanced n8n templates combining OCR, LLMs, and custom code.
Automation enthusiasts: Users who want to leverage Telegram as a primary input channel for data logging.
Financial professionals: Anyone needing structured, categorized data extraction from unstructured receipt photos.

Overview

This advanced n8n workflow solves the common problem of manual expense data entry by leveraging a series of specialized nodes. By utilizing the Telegram n8n trigger, users can simply snap a photo of a receipt or type an expense entry. The subsequent process intelligently detects images, uses Tesseract OCR to extract text from physical receipts, and then passes this complex data to an AI model (via OpenRouter/LangChain nodes) for structured parsing and categorization (e.g., Food & Beverages, Transport). The final output is a clean, comprehensive summary sent back to the user. This sophisticated n8n template demonstrates how to build robust, multi-modal automations, ensuring high accuracy and efficiency in your personal or business financial tracking.

How it Works

The entire process begins with the Telegram n8n trigger. Once activated by a user message or photo, the n8n workflow proceeds as follows:


  1. Input Check: The initial Check for Image n8n node determines if the input is text or a photo, routing the execution path accordingly.

  2. Receipt Processing (If Photo): If a receipt image is sent, the workflow uses HTTP requests (Get Telegram File and Download Image) to retrieve the photo data. The Extract Value From Image n8n node (Tesseract OCR) converts the visual data into raw text.

  3. Text Processing (If Text): If plain text is sent (e.g., 'Bought coffee for 5 USD'), the Extract Text Input n8n node prepares the raw message.

  4. AI Parsing: The raw text (from OCR or direct input) is passed to the AI Categorizer n8n node, which uses the LLM (AI Analyzer / OpenRouter) alongside the Receipt Parser to extract structured details like store name, total, date, and expense category.

  5. Summary Generation: The Format Summary Message Code n8n node converts the complex structured JSON into a simple, human-readable string, performing essential checks like verifying that the total expense is greater than zero.

  6. Validation and Notification: The Check Invalid Input n8n node filters out potential errors (like zero-value totals). The n8n workflow then sends the final, categorized summary or an error message back to the user using the Send Expense Summary or Send Error Message Telegram n8n nodes.

Installation Guide

To deploy this comprehensive n8n workflow, follow these steps:


  1. Import the n8n Workflow: Copy the provided JSON data and import it directly into your n8n instance using the 'New' > 'Import from JSON' function.

  2. Telegram Credentials: Set up your Telegram Bot API credentials. This requires a bot token for the Telegram Trigger n8n node and the two Telegram output n8n nodes.

  3. AI Credentials: Configure the credentials for the AI Analyzer n8n node. This particular n8n template uses OpenRouter, requiring an API key for access to powerful LLMs.

  4. Tesseract Configuration: Ensure your n8n environment supports the Tesseract n8n node for OCR functionality. For self-hosted Docker environments, this might require specific container setup.

  5. Webhook Setup: Activate the Telegram Trigger n8n node. You may need to manually configure your Telegram bot webhook URL to point to your n8n webhook address if running in production.

  6. Test Execution: Run a test execution by sending a receipt photo or an expense description to your Telegram bot to ensure all n8n nodes process the data correctly.

Node Details


  • Telegram Trigger (n8n trigger): The starting point of the n8n workflow. It listens for message updates, enabling the receipt of both text and photo inputs from any authorized Telegram chat.

  • Extract Value From Image (Tesseract n8n node): A critical component for handling images. It takes the downloaded receipt photo and uses Optical Character Recognition (OCR) to convert the visual data into text, feeding raw expense information into the AI pipeline.

  • AI Categorizer / AI Analyzer (LangChain LLM n8n node): These linked n8n nodes define and execute the LLM instruction. The AI Categorizer sets the system prompt (acting as a financial planner expert), while the AI Analyzer uses the configured OpenRouter credentials to perform the actual parsing and categorization based on defined options.

  • Receipt Parser (LangChain Output Parser n8n node): Ensures that the LLM's output conforms strictly to a financial JSON schema, detailing store, transaction, items, and summary objects. This standardization is vital for reliable subsequent processing in the n8n workflow.

  • Format Summary Message (Code n8n node): A custom n8n node containing JavaScript logic that formats the structured JSON into a neat summary string, calculates final totals, and implements a check to catch zero-value or incomplete entries, improving data integrity.

  • Check Invalid Input (If n8n node): A flow control n8n node that checks the output of the formatting step. If an error message (like a zero-total warning) is detected, it directs the n8n workflow to send an error notification instead of a successful summary.

  • Send Expense Summary (Telegram n8n node): The final action node, responsible for sending the categorized expense report back to the user via Telegram.

Related n8n Workflows

Free

Nodes: 11 Nodes
Updated: December 26 2025
View all
Created by

Featured*