Case study

Automated Invoicing

Snap a bill to a chat bot; it reads it, files it, and notifies the right tenant. The reading step was too important to guess, so four OCR routes went head to head and the best one won.

RoleDesigned and built for a client
Year2025
StatusShipped for a client
Stackn8n · Telegram · OCR · LLM extraction
The problem

Reading bills by hand does not scale.

A property-management company handles a constant stream of utility bills and invoices for many tenants. Reading each one and typing its numbers into a spreadsheet is slow, repetitive, and error-prone, and a wrong number in a balance sheet is expensive.

The job is a perfect fit for automation, but only if the reading step is genuinely reliable. So reliability was treated as an evaluation problem, not a guess.

What I built

From a photo to filed books.

I designed and built the full pipeline for the client: the Telegram intake, the file-type routing, the multi-route OCR with evaluation-driven selection, the structured extraction into a typed schema, the tenant matching and ledger update, the notification step, and a natural-language query agent over the accumulated data.

It is the production plumbing (routing, async polling, idempotent file handling, refusal handling) that separates a demo from a system someone relies on.

How it works

One bill in, bookkeeping out.

01 Telegram intake 02 Route the document 03 OCR read 04 Schema extraction 05 File to the books 06 Notify the tenant 07 Human confirmation

The OCR read step is the make-or-break risk, so the OCR route is the one that won a head-to-head benchmark, not a default.

The evaluation story

Four OCR routes, run head to head.

Four OCR and extraction routes ran against real bills, and the winner was chosen on measured results. Define what good output means, compare candidates against it, choose on evidence rather than reputation: the same discipline frontier-model evaluation requires.

Route

Mistral OCR

Hosted OCR for both images and PDFs.

Route

LlamaParse

Document parsing for PDFs: async upload, poll, fetch.

Route

Tesseract

Local OCR (Italian language), no API dependency.

Route

GPT-4o vision

Vision-model OCR, with a guard for model refusals.

Key features

Built to be relied on.

Typed-schema extraction

A LangChain Information Extractor turns raw text into a consistent record: client and invoice number, amount, dates, category.

Idempotent file lifecycle

Processed files are moved and removed, so nothing is handled twice.

Async job polling

Long-running parses upload, wait, check status, and fetch without blocking.

Failure handling

Detects and routes around model refusals instead of failing silently.

Multi-provider LLM

Mistral, OpenAI, and local Tesseract behind one routing layer.

A query agent

Answers natural-language questions over the ledger and writes summaries into Google Docs.

Tech stack

Under the hood.

Orchestration
n8n
Interface
Telegram bot
OCR and parsing
Mistral OCR · LlamaParse · Tesseract · GPT-4o vision (benchmarked)
Extraction
GPT-4.1 / GPT-4.1-mini via LangChain Information Extractor
Records and output
Google Sheets (ledger) · Google Docs (summaries) · Google Drive (files)
Notifications
Email and WhatsApp
Outcome

From manual typing to an auditable pipeline.

The client's bill handling moved from manual reading and typing to an automated, auditable pipeline: send a bill, and the data entry, tenant notification, and record-keeping happen on their own. The project shows applied document AI, real evaluation discipline in choosing the OCR approach, and the production engineering that makes such a system dependable.

Have a document workflow to automate?

I build document-AI pipelines with the evaluation rigor to make them trustworthy.