← Back to Projects

AI Invoice System Automation

n8n invoice workflow: Telegram Trigger and Switch, LlamaParse upload and status polling, Basic LLM Chain with OpenAI and a structured output parser, Google Sheets and Google Drive, plus Yes, No and Payment reply branches
The n8n workflow: invoices sent to a Telegram bot are parsed by LlamaParse, structured by an OpenAI LLM chain, logged to Google Sheets, and filed in Google Drive. Click to view full size.

A Telegram-based invoice assistant built in n8n: send a PDF or photo of an invoice to the bot, and AI extracts the data, logs it to Google Sheets, files the document in Google Drive, and keeps track of what has been paid.

n8n Telegram Bot LlamaParse OpenAI Google Sheets Google Drive

The problem

Invoices arrive as PDFs, scanned documents, and phone photos, and someone has to read each one and retype the supplier, invoice number, dates, line items, and totals into a spreadsheet. It is slow, error-prone work, and the original files end up scattered across inboxes, chats, and downloads folders.

Tracking which invoices are still open and which have been paid usually means yet another manual update, so the records quickly fall out of date.

The solution

This project turns a Telegram bot into an invoice assistant. Instead of typing anything, you simply send the invoice — as a PDF document or a photo — to the bot, and an n8n workflow does the rest.

The file is uploaded to LlamaParse, which converts the invoice into clean, machine-readable text. A Basic LLM Chain powered by an OpenAI chat model, with a structured output parser, then extracts the invoice fields into a consistent format. The result is appended to Google Sheets, the original file is uploaded to Google Drive, and the bot replies in Telegram with what it captured.

Simple text replies keep the records up to date. A second switch handles Yes, No, and Payment replies: confirming an entry, removing an incorrect one from the sheet and moving its file in Drive, or moving an invoice from the open list to the paid records and filing the document accordingly.

How it works

  1. The Telegram Trigger receives a new message and a Switch routes it by type: document, image, or text.
  2. For invoices, the bot acknowledges the upload and downloads the file from Telegram.
  3. The file is sent to LlamaParse; the workflow polls the job status and waits between checks to stay within the service limits.
  4. Once parsing succeeds, the parsed invoice data is passed to a Basic LLM Chain (OpenAI chat model + structured output parser) that extracts the invoice fields.
  5. The extracted data is appended to Google Sheets, the bot sends a summary back in Telegram, and the original file is uploaded to Google Drive.
  6. Text replies go through a second switch: Yes confirms, No removes the entry and moves its file, and Payment moves the invoice to the paid records and files it in Drive.

Tools used

  • n8n — orchestrates the full workflow, including switches, polling, and wait steps
  • Telegram Bot — the interface: receives invoices and replies, and sends confirmations
  • LlamaParse — parses PDF and image invoices into text via its API
  • OpenAI chat model + structured output parser — extracts consistent invoice fields with a Basic LLM Chain
  • Google Sheets — invoice log, plus separate open and paid records
  • Google Drive — stores the original invoice files and organizes them by status

Who it's for

Small businesses, freelancers, bookkeepers, and finance teams that receive invoices from many suppliers and still key them in by hand. Because it runs through Telegram, anyone on the team can capture an invoice straight from their phone — no new app or login needed.

Results

Invoice data entry goes from minutes of typing per invoice to sending a single message, with every invoice logged, filed, and tracked automatically.

  • Accurate data — fields are extracted by AI from the original document, not retyped.
  • Faster processing — invoices are logged as soon as they are sent to the bot.
  • Less manual work — no copying between files, spreadsheets, and folders.
  • Clear payment tracking — open and paid invoices are kept separate in Sheets and Drive.

Want something like this for your business? See my Workflow Automation service.

Interested in something similar?

Let's talk about building an automation like this for your business.

Book a Call