Skip to content

Case study · Telegram assistant for voice and text records

PR-Agent

A Telegram bot and Mini App, built with privacy in mind, that turns text or voice notes into structured work logs, notes, expenses, reminders, goals and meal entries. Built with FastAPI, Next.js and Supabase PostgreSQL.

By · Updated

PR-Agent banner: a friendly robot assistant surrounded by icons for tasks, notes, money, goals, meals and reminders

Overview

PR-Agent is a personal tracker that lives in Telegram. Send a text or a voice note and it is stored as the right kind of record (a work log, note, expense, income entry, goal, reminder or meal), which can later be reviewed and edited in a Telegram Mini App.

What it does

  • Captures text or voice as work logs, notes, expenses, income, goals, reminders or meals.
  • Estimates calories and protein for Indian household foods, showing the assumptions it used; vague portions are flagged for review.
  • Answers questions about the user’s own spending and activity over time, such as totals for a period or the highest spending category.
  • Offers a Mini App for reviewing, filtering, editing and deleting records.
  • Supports an optional encrypted and masked vault for important personal facts, where actions need confirmation.
  • Keeps deterministic slash commands such as /log, /note and /expense available at all times.

Architecture

Telegram messages and the Mini App both talk to a FastAPI backend that acts as a bounded assistant. It stores records in Supabase PostgreSQL through SQLAlchemy (with Alembic migrations) and calls Groq for speech transcription and intent recognition. Updates arrive through Telegram webhooks, and scheduled workers run background jobs.

Privacy and safety decisions

  • Every query and mutation is scoped on the server to the authenticated Telegram user.
  • Voice audio is not kept after transcription.
  • Free text and voice requests share a daily allowance of 25; once it is reached, voice notes are rejected before transcription is called, so the limit also caps AI usage.

Testing and release checks

Release checks cover isolation between users (another user cannot read, edit or delete a record), the daily allowance, Mini App sign in and editing in a small mobile viewport like Telegram’s, spending queries by period and category, and meal logging. The repository’s release notes record a local run on 23 August 2026 in which 345 backend tests, 12 frontend tests and 6 mobile browser flows passed, together with lint, type checking and production build checks.