Skip to main content

What you will build

  • A Telegram bot that receives a document (invoice or receipt) and replies with key details.
  • Processing powered by Google’s “Flash” model.

What you need

A Telegram bot token saved as TELEGRAM_BOT_TOKEN in your project environment (Project Settings → Environment or .env.local).
  • In Telegram, chat with @BotFather, run /newbot, name it, and copy the token once.
A Google AI account and API key for the Flash model saved as GEMINI_API_KEY in your env.
  • Go to ai.google.devGet an API key.
  • Create/select a project and generate a key with access to the Flash model.
  • Copy the key once and store it as GEMINI_API_KEY.
Sample invoices or receipts to test parsing.

Create Project Prompt

Create a Telegram bot that accepts invoices/receipts and returns key fields using Google's Flash model.

Plan A Feature Prompt

Build a Telegram doc bot that listens for uploaded invoices or receipts, sends them to Google's Flash model for extraction, and replies with vendor, date, total, and items. Handle wrong file types and missing fields gracefully.

Ideas after the initial build

  • Add currency normalization and totals-with-tax breakdowns.
  • Store a short log of the last few documents with their summaries.
  • Support multiple file types (PDF, image) and compress images before upload.
  • Let users ask follow-up questions about the parsed document.