Skip to main content

Extract Details from Receipts via Telegram with Tesseract and Llama

Workflow preview

Workflow preview
100%
 Extract Details from Receipts via Telegram with Tesseract and Llama preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Tesseract Money Mate Workflow Description Disclaimer : This template requires the community node, which is only available on self hosted n8n inst...

Best for

  • Invoice Processing automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.code, n8n-nodes-base.httprequest, n8n-nodes-base.telegramtrigger, n8n-nodes-base.stickynote, @n8n/n8n-nodes-langchain.chainllm, n8n-nodes-base.if, n8n-nodes-base.set, @n8n/n8n-nodes-langchain.outputparserstructured

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Extract Details from Receipts via Telegram with Tesseract and Llama
Workflow name
Extract Details from Receipts via Telegram with Tesseract and Llama

Tesseract - Money Mate Workflow Description

Disclaimer: This template requires the n8n-nodes-tesseractjs community node, which is only available on self-hosted n8n instances. You’ll need a self-hosted n8n setup to use this workflow.

Who is this for?

This workflow is designed for individuals, freelancers, or small business owners who want an easy way to track expenses using Telegram. It’s ideal for anyone looking to digitize receipts—whether from photos or text messages—using free tools, without needing advanced technical skills.

What problem does this workflow solve?

Manually entering receipt details into a spreadsheet or app is time-consuming and prone to mistakes. This workflow automates the process by extracting information from receipt images or text messages sent via Telegram, categorizing expenses, and sending back a clear, formatted summary. It saves time, reduces errors, and makes expense tracking effortless.

What this workflow does

The workflow listens for messages sent to a Telegram bot, which can be either text descriptions of expenses or photos of receipts. If a photo is sent, Tesseract (an open-source text recognition tool) extracts the text. If text is sent, it’s processed directly. An AI model (LLaMA via OpenRouter) analyzes the input, categorizes it into expense types (e.g., Food & Beverages, Household, Transport), and creates a structured summary including store name, date, items, total, and category. The summary is then sent back to the user’s Telegram chat.

Setup Instructions

Follow these step-by-step instructions to set up the workflow. No advanced technical knowledge is required, but you’ll need a self-hosted n8n instance.

  1. Set Up a Self-Hosted n8n Instance:

    • If you don’t have n8n installed, follow the n8n self-hosting guide to set it up. You can use platforms like Docker or a cloud provider (e.g., DigitalOcean, AWS).
    • Ensure your n8n instance is running and accessible via a web browser.
  2. Install the Tesseract Community Node:

    • In your n8n instance, go to Settings > Community Nodes in the sidebar.
    • Click Install a Community Node, then enter n8n-nodes-tesseractjs in the search bar.
    • Click Install and wait for confirmation. This node enables receipt image processing.
    • If you encounter issues, check the n8n community nodes documentation for troubleshooting.
  3. Create a Telegram Bot:

    • Open Telegram and search for @BotFather to start a new bot.
    • Send /start to BotFather, then /newbot to create your bot.
    • Follow the prompts to name your bot (e.g., “MoneyMateBot”).
    • BotFather will provide a Bot Token (e.g., 23872837287:ExampleExampleExample). Copy this token.
    • In n8n, go to Credentials > Add Credential, select Telegram API, and paste the token. Name the credential (e.g., “MoneyMateBot”) and save.
  4. Set Up OpenRouter for AI Processing:

    • Sign up for a free account at OpenRouter.
    • In your OpenRouter dashboard, generate an API Key under the API section.
    • In n8n, go to Credentials > Add Credential, select OpenRouter API, and paste the API key. Name it (e.g., “OpenRouter Account”) and save.
    • The free tier of OpenRouter’s LLaMA model is sufficient for this workflow.
  5. Import and Configure the Workflow:

    • Download the workflow JSON file (provided separately or copy from the source).
    • In n8n, go to Workflows > Import Workflow and upload the JSON file.
    • Open the imported workflow (“Tesseract - Money Mate”).
    • Ensure the Telegram Trigger and Send Expense Summary nodes use the Telegram credential you created.
    • Ensure the AI Analyzer node uses the OpenRouter credential.
    • Save the workflow.
  6. Test the Workflow:

    • Activate the workflow by toggling the Active switch in n8n.
    • In Telegram, find your bot (e.g., @MoneyMateBot) and send /start.
    • Test with a sample input (see “Example Inputs” below).
    • Check the n8n workflow execution panel to ensure data flows correctly.
    • If errors occur, double-check credentials and node connections.
  7. Activate for Continuous Use:

    • Once tested, keep the workflow active in n8n.
    • Your bot will now process any text or image sent to it via Telegram.

Example Inputs/Formats

To help the workflow process your data accurately, use clear and structured inputs. Below are examples of valid inputs:

Text Input Example:

Send a message to your Telegram bot like this:

Bought coffee at Starbucks, Jalan Sudirman, yesterday. Total Rp 50,000. 2 lattes, each Rp 25,000.

Expected Output:

hello [Your Name]

Ini Rekap Belanjamu
📋 Store: Starbucks
📍 Location: Jalan Sudirman
📅 Date: 2025-05-26
🛒 Items:
- Latte: Rp 25,000
- Latte: Rp 25,000
💸 Total: Rp 50,000
📌 Category: Food & Beverages

Image Input Example:

Upload a photo of a receipt to your Telegram bot. The receipt should contain:

  • Store name (e.g., “Alfamart”)
  • Address (e.g., “Jl. Gatot Subroto, Jakarta”)
  • Date and time (e.g., “27/05/2025 14:00”)
  • Items with prices (e.g., “Bread Rp 15,000”, “Milk Rp 20,000”)
  • Total amount (e.g., “Total: Rp 35,000”)

Expected Output:

hello [Your Name]

Ini Rekap Belanjamu
📋 Store: Alfamart
📍 Location: Jl. Gatot Subroto, Jakarta
📅 Date: 2025-05-27 14:00
🛒 Items:
- Bread: Rp 15,000
- Milk: Rp 20,000
💸 Total: Rp 35,000
📌 Category: Household

Tips for Images:

  • Ensure the receipt is well-lit and text is readable.
  • Avoid blurry or angled photos for better Tesseract accuracy.

How to Customize This Workflow

  • Change Expense Categories: In the AI Categorizer node, edit the prompt to include custom categories (e.g., add “Entertainment” or “Utilities” to the list: Food & Beverages, Household, Transport).
  • Modify Response Format: In the Format Summary Message node, adjust the JavaScript code to change how the summary looks (e.g., add emojis, reorder fields).
  • Save to a Database: Add a node (e.g., Google Sheets or PostgreSQL) after the Format Summary Message node to store summaries.
  • Support Other Languages: In the AI Categorizer node, update the prompt to handle additional languages (e.g., Spanish, Mandarin) by specifying them in the instructions.
  • Add Error Handling: Enhance the Check Invalid Input node to catch more edge cases, like invalid dates.

All Free, End-to-End

This workflow is 100% free! It leverages:

  • Telegram Bot API: Free via BotFather.
  • Tesseract: Open-source text recognition.
  • LLaMA via OpenRouter: Free tier available for AI processing.

Enjoy automating your expense tracking without any cost!

Made by: khmuhtadin Need a custom? contact me on LinkedIn or Web

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 - Format Summary Message

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

Block 2 - Get Telegram File

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 3 - Download Image

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 4 - Telegram Trigger

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

Block 5 - Sticky - Telegram Trigger

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

Block 6 - AI Categorizer

Type / Role
@n8n/n8n-nodes-langchain.chainLlm - chainLlm
Config choices
Version 1.6

Block 7 - Check Invalid Input

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

Block 8 - Extract Text Input

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

Block 9 - Check for Image

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

Block 10 - Sticky - Check for Image

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

Block 11 - Receipt Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.2

Block 12 - AI Analyzer

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenRouter - lmChatOpenRouter
Config choices
Version 1

Block 13 - Send Error Message

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

Block 14 - Send Expense Summary

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

Block 15 - Sticky - Parse Receipt Data1

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

Block 16 - Extract Value From Image

Type / Role
n8n-nodes-tesseractjs.tesseractNode - tesseractNode
Config choices
Version 1

Block 17 - Sticky - Send Expense Summary1

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

Block 18 - Sticky - Extract Text Input1

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

Block 19 - Sticky - Parse Receipt Data2

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

Block 20 - Sticky - Get Telegram File1

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

Block 21 - Sticky - Download Image2

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

Block 22 - Sticky - Download Image3

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

Block 23 - Sticky - Format Summary Message1

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

Block 24 - Sticky - AI Categorizer1

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

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

3. Summary Table

Workflow Extract Details from Receipts via Telegram with Tesseract and Llama
Complexity advanced
Nodes 27
Categories Invoice Processing, AI Summarization
Author Khairul Muhtadin
Published 24 May 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/4361/4361.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 Extract Details from Receipts via Telegram with Tesseract and Llama do?

Tesseract Money Mate Workflow Description Disclaimer : This template requires the community node, which is only available on self hosted n8n inst...

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 Invoice Processing, AI Summarization use case.