Discuss a project

AI agent in Telegram for invoices and delivery notes

A manager types or dictates an order in Telegram, and within a minute the agent produces an invoice (Excel) and a delivery note (Word) from the company's templates, with correct numbering and the amount in words.

Type
AI agent + document automation
What we did
n8n · Google Gemini · AI agent · Telegram bot · Python · FastAPI · PostgreSQL · Docker
AI agent in Telegram for invoices and delivery notes

About the project

CompTeam, a computer hardware store, issues invoices and delivery notes every day. They used to be filled in by hand in Excel and Word: copying customer details, calculating totals, writing the amount in words and keeping track of numbering. Now an AI agent in Telegram does it.

How it works

  • An employee writes to the bot or sends a voice message: "Make an invoice for …, HP 6150 computers, 5 pcs at 15,000 UAH".
  • The agent transcribes the speech, finds the customer in the database (or saves a new one with their details) and shows a draft: items, total, amount in words, invoice validity date.
  • After "Yes", two ready files with the same number arrive in the chat: an invoice (.xlsx) and a delivery note (.docx) based on the company's templates.
  • Customer details can also be sent as a file: the agent reads PDFs, photos, Word and Excel.

Technical solution

  • n8n: a main workflow with an AI agent and conversation memory, plus a separate tools workflow (customer search, preliminary calculation, document creation).
  • Google Gemini: understanding requests, recognising voice messages and files, with a fallback model in case of failure.
  • Custom doc-service in Python (FastAPI): fills Excel and Word templates, writes the amount and the date in Ukrainian words, reads attached documents.
  • PostgreSQL: customer base, document log and monthly numbering (11-001, 11-002 …).
  • Everything runs in Docker on a VPS over HTTPS. Only whitelisted employees can use the bot.

Key principle

AI only turns free text into structured data. Totals, rounding and document numbers are calculated by code, so there are no arithmetic errors.

Let's create something together

Become a client
Free consultation

30 minutes: we will look into your task and suggest possible solutions.