Back to projects

Telegram bots · Python · 2026

Invoice & Task Bots

Two Telegram bots I built for myself and run around the clock. The invoice bot turns a photo or PDF of a receipt into a checked record, with the VAT worked out. The task bot turns a chat with myself into a task manager with a morning brief and an evening review. Both are Python, with Claude doing the reading.

  • Python
  • Telegram Bot API
  • Claude API
  • OpenAI API
  • Gemini API
  • Pydantic
  • SQLite
  • Google Sheets
  • systemd
My part
All of it, my own
When
Oct 2026
Status
Running 24/7
Mock-up with sample data: an invoice card from the invoice bot and a morning brief from the task bot

Overview

Both bots answer only to me and my family, so a stranger can never spend the AI credits. They share one small cloud server, each under its own locked-down service user with its own keys, and each has a smoke test that runs against a fake Telegram and fake AI providers.

LimitNeither bot has a screen of its own. The image above is a mock-up with sample data, built from the invoice bot's real card format.

The invoice bot

  • Send a photo or a PDF, in Arabic or English, and get a card back: shop, date, category, items, VAT and total.
  • VAT worked out from the arithmetic, included in the prices or added on top, with a check that the totals add up.
  • A choice of reader per person: Claude, OpenAI or Gemini, or all three side by side on the same invoice.
  • Fix a field by hand, or describe the fix in words and see a preview before anything is saved.
  • Duplicates caught by shop and invoice number, or by shop, date and total.
  • Spending summaries, a weekly report, price-rise alerts and a product search that understands Arabic spelling variants.

DecisionIf the items add up to the total, VAT was included. If subtotal plus VAT does, it was added. The model's answer only breaks a tie.

The task bot

  • Every message saved at once, word for word, then sorted by Claude Haiku three times a day into lists, projects and dates.
  • Repeats merged by link, by normalised Arabic text, or by meaning.
  • Open, Waiting, Someday, Done and Dropped, with a nudge on waiting items after three days, and recurring tasks.
  • A morning brief, an evening review and timed reminders.
  • Changes asked for in plain words, with a preview and Undo.
  • A shared family grocery list, with a role check on every button.

DecisionThe text is stored as sent. The AI returns line numbers and exact substrings, and the code checks both against the original message.

Worth a closer look

Comparing the providers on real receipts settled the default. On the small server, one photo took Gemini about seven minutes, where Claude took about ten seconds. Claude Sonnet now reads the invoices, and Claude Haiku does the cheap work: fixes described in words, and search by meaning.

ConstraintGemini stays available for comparison, so its timeout was raised to ten minutes.