Back to cases
群组记账机器人
Telegram SaaS多租户订阅制

Group Accounting Bot

Multi-tenant subscription SaaS for Telegram group bookkeeping

Type:Subscription Telegram SaaS
Timeline:Ongoing

About the Project

A professional group bookkeeping service for Telegram, supporting dual-currency pricing (local currency and a unified accounting currency), automatic Chinese/English language detection, and a multi-tenant architecture with strict group-level data isolation. Users record transactions with simple commands; the system automatically generates shareable web-based statements that admins can view in any browser at any time. The product runs as a subscription SaaS and is in active production serving multiple groups, covering real business scenarios including cross-border settlement, community operations, and studio revenue splitting.

Core Features

  • Real-Time Bookkeeping: Quick in-group commands to record income and expenses, with undo and memo support
  • Dual Pricing Modes: Local currency and unified accounting currency, with flexible view switching
  • Web Statements: Shareable web-based statements with date filtering and Excel export
  • Multi-Tenant Architecture: Each group has independent data and configuration with no cross-group leakage
  • Subscription Billing: Full trial / subscription / authorization management lifecycle
  • Three-Tier Permissions: Super admin / group owner / operator with distinct access levels
  • Multi-Language: Automatic Chinese/English detection and switching, suitable for cross-border teams
  • Wallet Monitoring: Connects to a group's designated external accounting wallet; balance changes and transactions sync to the group in real time

Tech Stack

Python python-telegram-bot FastAPI PostgreSQL SQLAlchemy pytz

Engineering Highlights

1. Group-Level Multi-Tenant Isolation The Telegram chat_id is the tenant key. Data is isolated at the database layer — each group has its own exchange rates, language setting, permissions, and subscription state. One deployment serves N groups simultaneously; adding a new group requires zero infrastructure changes.

2. Dual-Currency Coexistence Each ledger entry carries both the local currency amount and the unified accounting currency amount. When an admin switches views, the backend recalculates using the live exchange rate at display time — eliminating exchange-rate drift in the common scenario of "record in local currency, reconcile in unified currency."

3. External Wallet Balance Monitoring A polling-plus-debounce strategy on an external monitoring service captures real-time balance changes and transaction events from the linked accounting wallet, then pushes them directly to the group. This avoids the latency and missed-event issues common with third-party API webhooks.

4. Web Statements and Bot Share One Database The FastAPI statement pages and python-telegram-bot command handlers read and write the same PostgreSQL instance. There is no sync lag — admins see the latest data the moment they refresh the page.

Deliverables

  • Full subscription-model multi-currency bookkeeping SaaS, covering trial, payment, authorization, and renewal flows
  • Automatic Chinese/English detection — cross-border teams need no manual language switching
  • In active production serving multiple paying groups, with ongoing iterative development

Need something like this?

We can build you a tailored solution drawing on what we learned from this project.

More work