View on GitHub:
github.com/sukhrobyangibaev/qarz_daftar

Qarz Daftar is a Telegram bot designed to help shop owners and debtors manage and track debts efficiently. Built with Python and the python-telegram-bot library, it provides an intuitive interface for registering shops, adding debtors, recording transactions, and viewing debt histories—all within Telegram.

The bot is ideal for small businesses, local shops, and anyone who needs a simple, accessible way to keep track of debts and payments.

Key Features

  • Shop & Debtor Registration: Shop owners and debtors can sign in using their phone numbers, ensuring secure and personalized access.
  • Debtor Management: Shops can add new debtors, search for existing ones by phone number, and view detailed debtor profiles.
  • Debt Tracking: Record new debts and payments with a simple interface. Each transaction is timestamped and logged for transparency.
  • Transaction History: View a full history of all debts and payments for each debtor, with clear formatting and easy navigation.
  • Persistent Storage: All data is stored in MongoDB, ensuring reliability and scalability.
  • Rich Telegram Integration: Utilizes custom keyboards, inline buttons, and contact sharing for a seamless user experience.
  • Error Handling: Robust error reporting and logging, with developer notifications for quick troubleshooting.

Technical Architecture

  • Backend: Written in Python, using the python-telegram-bot library for asynchronous Telegram API integration.
  • Database: Uses MongoDB to store shops, debtors, and transaction histories.
  • Models: Clean separation of business logic with Shop and Debtor classes.
  • Conversation Flows: Multi-step guided conversations for adding shops, debtors, and recording transactions.
  • Security: Phone number verification ensures users can only access their own data.

Example Workflow

  1. User starts the bot:
    The bot prompts the user to choose a role: Shop or Debtor.
  2. Shop registration:
    Shop owners sign in with their phone number, register their shop, and can then add or search for debtors.
  3. Adding a debtor:
    The shop enters the debtor’s name, nickname, phone number, and initial debt amount.
  4. Recording transactions:
    Shops can add new debts or payments for each debtor, with every transaction logged and visible in the debtor’s history.
  5. Debtor view:
    Debtors can sign in, view their debts across shops, and see detailed transaction histories.

Technologies Used

  • Python 3
  • python-telegram-bot
  • MongoDB
  • AsyncIO
  • pymongo
  • dotenv (for environment configuration)

This project showcases how Telegram bots can simplify business processes, making debt management accessible and transparent for shop owners and their customers.