MRPYWEB

Website, Web Application & Business Systems Development
Back to Portfolios
سیستم مدیریت مشتریان و ربات تلگرام (CRM Bot)

Customer Management & Telegram Bot System (CRM Bot)

A comprehensive CRM system built with Django, integrated with a Telegram bot (Aiogram). The project features a custom admin panel for viewing registered users, managing consultation, investment, and trader recruitment r…

Overview

About the Project

A comprehensive CRM system built with Django, integrated with a Telegram bot (Aiogram). The project features a custom admin panel for viewing registered users, managing consultation, investment, and trader recruitment requests, sending broadcast messages to Telegram users, and managing channel links. Users register through the Telegram bot, submit their information, and can send various requests that are tracked in the admin panel.

Case Study

Project Case Study

Challenges, solutions, outcomes, technical highlights, architecture, and project scale.

⚡

Challenges

1. Managing two different environments (Django web + Aiogram Telegram bot) in a single project.
2. Passwordless user authentication using Telegram ID.
3. Broadcasting messages to many Telegram users while respecting rate limits.
4. Integrating a CustomUser model with Django's authentication system.
5. Managing multilingual requests and storing 4-language data in the database.
6. Coordinating async Telegram bot execution with sync Django execution.

💡

Solutions

1. Using Aiogram for bot management and Django for the admin panel.
2. Identifying users by unique telegram_id instead of username/password.
3. Sending messages in a separate thread with a 60-second interval per send to prevent blocking.
4. Building CustomUser by inheriting from AbstractUser and adding Telegram-specific fields.
5. Storing multilingual content in separate fields (title_en, title_ar, title_tr, etc.).
6. Using sync_to_async to call Django ORM in the async bot environment.

📚

Outcomes

- Reduced customer response time from days to hours.
- Unified management of all user requests in a single panel.
- Ability to broadcast messages to all users with one click.
- Automatic user registration through the Telegram bot without forms.
- Support for 4 languages (Persian, English, Arabic, Turkish) for project content.

🔧

Technical Highlights

- Using FSM (Finite State Machine) in Aiogram for user registration flow.
- Implementing a custom permission system (IsSuperUser) to restrict access.
- Converting Gregorian dates to Jalali using the persiantools library.
- Secure file upload management with unique timestamp-based naming.
- Using AJAX to edit channel links without page refresh.
- SOCKS5 proxy support for connecting to Telegram in restricted environments.

🏗️

Architecture

The project is built on Django's MVT architecture and consists of three main apps:
1. crm: User management, consultation, investment, traders, and channel links.
2. telegram_bot: Telegram bot implementation with Aiogram and FSM management.
3. payments: Payment module (under development).

Communication between the bot and the panel is through a shared database (SQLite/MySQL). The bot runs in a separate thread when runserver starts.

📐

Project Scale

The project is designed at the level of a medium-sized application with potential to scale to a large one. It currently uses SQLite, which is suitable for development and testing and can be upgraded to MySQL or PostgreSQL for production.

Stack

Technologies

Django JavaScript Python
Categories

Categories

Office Automation CRM System Social Network / Forum
Industry

Industry

Information Technology, Customer Relationship Management (CRM), Digital Services
Scope

Scope

Web Development, Telegram Bot Development, Management System
Statistics

Project Statistics

12
👁️ Views
0
❤️ Likes
0
⬇️ Downloads
0
⭐ Rating
Team

Project Team

People who collaborated on this project

حسن کاظمی
Hasan Kazemi
Full Stack Developer

Have a similar project in mind?

If you need collaboration for developing a website, CRM, ERP, or a custom system, I'd be happy to discuss your project.

Start a Project