π€ Telegram Inviter Bot is a professional tool for automatically inviting users from one Telegram group to another. It supports two operating modes, session rotation, flexible settings, and full control via the Telegram interface.
β¨ Key Features π Inviting modes
- π Participant list mode ( member_list) – recommended View the full list of members of the source group Inviting in sequential order Skipping already invited users Automatic continuation after restart
- π¬ Message mode ( message_based) Analysis of the source group’s message history Inviting message authors (active participants) Suitable for large groups with limited access to the participant list π Session Management Adding sessions : via CLI with interactive authorization Task assignment : link sessions to specific task types Session rotation : automatic switching when blocked Monitoring : status of all sessions in real time βοΈ Flexible settings Main parameters: Delay between invites : 1-300 seconds (30+ recommended) Delay frequency : after every Nth invite Invite Limit : The maximum number of invites per task. Session rotation : enable/disable Rotation frequency : after every Nth invite or only in case of errors Protection from blocking: Automatic FloodWait processing Skipping users with closed privacy Smart session rotation in case of critical errors Limits on the number of invites per hour/day
ποΈ Architecture
inviter/
βββ bot/ # Telegram bot (management interface)
β βββ bot_main.py # Main bot file
β βββ handlers.py # Command and menu handlers
β βββ states.py # FSM states and keyboards
β βββ session_handlers.py # Session management
β βββ api_client.py # HTTP client for the API
β βββ config.py # Bot configuration
β
βββ parser/ # API server and worker (core)
β βββ main.py # FastAPI application
β βββ inviter_worker.py # Inviting logic
β βββ session_manager.py # Session manager
β βββ database.py # SQLite database
β βββ add_session.py # CLI for adding sessions
β βββ config.py # Server configuration
β
βββ shared/ # Shared models
β βββ models.py # Dataclasses (SessionMeta, InviteTask)
β
βββ sessions/ # .session files for Telegram
βββ *.bat # Startup scripts (Windows)
βββ start_parser.bat # Start API server (Windows)
βββ start_bot.bat # Start Telegram bot (Windows)
βββ add_session.bat # Add session (Windows)
βββ pyproject.toml # Dependencies and metadata
βββ .env.example # Example configuration
βββ README.mdπ Installation and launch
π System requirements
- PythonΒ : 3.8+ (3.11+ recommended)
- RAMΒ : minimum 512MB
- DiskΒ : minimum 100MB of free space
- NetworkΒ : stable internet connection for using the Telegram API
π¦ Installing dependencies
Ubuntu/Debian (including WSL):
# Update packages
sudo apt update
# Install Python venv and pip
sudo apt install python3-venv python3-pip python3-dev
# For additional libraries (optional)
sudo apt install build-essential libssl-dev libffi-devCentOS/RHEL/Fedora:
# CentOS/RHEL
sudo yum install python3-devel python3-pip
# or for newer versions
sudo dnf install python3-devel python3-pip
# Fedora
sudo dnf install python3-devel python3-pipmacOS
# Installation via Homebrew (recommended)
brew install python3
# Or, upgrading an existing Python
brew upgrade python3
# Installing dependencies for compilation
brew install openssl readline sqlite3 xz zlibArch Linux:
sudo pacman -S python python-pip python-virtualenv2. Cloning and preparation
# Navigate to the project directory
cd /path/to/project/inviter
# Create a virtual environment
python3 -m venv venv
# Activate the virtual environmentActivating the virtual environment
Windows (cmd/PowerShell):
venv\Scripts\activateWindows (PowerShell):
venv\Scripts\Activate.ps1Linux/Mac:
source venv/bin/activate3. Installing dependencies
pip install -r requirements.txt4. Solving problems with the virtual environment
If you get the error “ensurepip is not available” (WSL/Debian/Ubuntu):
# Install python3-venv
sudo apt install python3.8-venv # or python3.10-venv, depending on your Python version
# Recreate the virtual environment
python3 -m venv venv
# Activate
source venv/bin/activateIf the virtual environment is not created:
# Check the Python version
python3 --version
# Install virtualenv as an alternative
pip3 install virtualenv
virtualenv venv
source venv/bin/activateProblems installing dependencies in a virtual environment:
# Upgrade pip in the virtual environment
source venv/bin/activate
pip install --upgrade pip
# If you encounter compilation errors, install build dependencies
# Ubuntu/Debian:
sudo apt install build-essential python3-dev
# CentOS/RHEL:
sudo yum groupinstall "Development Tools"
sudo yum install python3-devel
# macOS:
brew install openssl readline sqlite3 xz zlibβοΈ Configuration
1. Creating a configuration file
cp .env.example .env2. Filling the .env file
# Telegram bot token (get from @BotFather)
BOT_TOKEN=1234567890:ABCdefGHIjklMNOpqrsTUVwxyz123456789
# Administrator IDs (comma-separated)
ADMIN_IDS=123456789,987654321
# API data for sessions (get from https://my.telegram.org)
API_ID=12345678
API_HASH=abcdef1234567890abcdef1234567890
# Port for the API server (default is 8001)
API_PORT=8001
# Path to the database (default is ./inviter.db)
DATABASE_PATH=./inviter.db
# Directory for sessions (default is ./sessions)
SESSIONS_DIR=./sessionsπ Getting API data
- Go toΒ https://my.telegram.org
- Log in with your phone number
- Go to theΒ API development tools section
- Create a new application
- CopyΒ
api_idandapi_hash
π€ Creating a bot
- WriteΒ @BotFatherΒ on Telegram
- Send a command
/newbot - Follow the instructions to create a bot.
- Copy the token and paste it intoΒ
.envthe file
π― Launching the application
π What do the scripts run:
start_parser.bat(Windows) β Starting the FastAPI server for API (port 8001)start_bot.bat(Windows) β Launch Telegram bot for controladd_session.bat(Windows) β Adding a Telegram Session Interactively
On Linux/Mac, the equivalent Python commands are used directly.
Windows
Option 1: Using .bat scripts (recommended)
# Run the API server (terminal 1)
.\start_parser.bat
# Run the bot (terminal 2)
.\start_bot.batOption 2: Manual launch with environment activation
# Terminal 1 - API Server
venv\Scripts\activate
python -m uvicorn parser.main:app --host 0.0.0.0 --port 8001 --reload
# Terminal 2 - Bot
venv\Scripts\activate
python -m bot.bot_mainOption 3: Manual launch without activation (if the virtual environment is already active)
# Terminal 1 - API Server
python -m uvicorn parser.main:app --host 0.0.0.0 --port 8001 --reload
# Terminal 2 - Bot
python -m bot.bot_mainLinux/Mac
Option 1: With a virtual environment (recommended)
# Terminal 1 - API Server
source venv/bin/activate
python -m uvicorn parser.main:app --host 0.0.0.0 --port 8001 --reload
# Terminal 2 - Bot
source venv/bin/activate
python -m bot.bot_mainOption 2: Loading environment variables from the .env file
# Terminal 1 - API Server
source venv/bin/activate
[ -f .env ] && export $(grep -v '^#' .env | xargs)
python -m uvicorn parser.main:app --host 0.0.0.0 --port 8001 --reload
# Terminal 2 - Bot
source venv/bin/activate
[ -f .env ] && export $(grep -v '^#' .env | xargs)
python -m bot.bot_mainπ³ Docker (optional)
# Build the image
docker build -t telegram-inviter .
# Run the container
docker run -p 8001:8001 -v $(pwd)/sessions:/app/sessions telegram-inviterπ Session Management
Adding a new session
Windows:
# Option 1: Via .bat script
.\add_session.bat
# Option 2: Manual execution
venv\Scripts\activate
python -m parser.add_sessionLinux/Mac:
# Option 1: With a virtual environment
source venv/bin/activate
python -m parser.add_session
# Option 2: With loading environment variables
source venv/bin/activate
[ -f .env ] && export $(grep -v '^#' .env | xargs)
python -m parser.add_sessionAdding process:
- Enter a session name (alias)
- Enter API ID
- Enter the Hash API
- Enter your phone number (+1234567890)
- Enter the confirmation code from Telegram
- If prompted, enter your two-factor authentication password.
Managing sessions via a bot
- Run the bot with the command
/start - Go to theΒ π Sessions section
- SelectΒ “Show Sessions”Β to view all sessions.
- SelectΒ “Assign Session”Β to manage the session:
- π₯ InvitingΒ – linking a session to inviting tasks
- π Configure proxyΒ – setting up a proxy for a session
- π§ͺ Check proxyΒ – check proxy functionality
- ποΈ Remove proxyΒ – removes a proxy from the session
- π Copy proxyΒ – copying proxies to other sessions
Setting up a proxy for sessions
Proxy format:
scheme://user:pass@host:port
scheme://host:portChecking the connection:
- After setting up the proxy, use theΒ π§ͺ Check proxy button
- The system will check the connection both with and without a proxy.
- In case of an error, a detailed description of the problem will be displayed.
π₯ Using the bot
Basic workflow
- Launching the bot
- Open the bot in Telegram
- Send a command
/start
- Setting up sessions
- Go toΒ π Sessions
- Add at least one session via CLI
- Assign a session to the “Inviting” task
- Creating an inviting task
- Go toΒ π₯ Inviting
- SelectΒ the source groupΒ (where to get users from)
- SelectΒ the target groupΒ (where to invite)
- SelectΒ operating modeΒ :
- πΒ By participant listΒ (recommended)
- π¬Β According to reports
- Adjust the settings
Invitation settings
π “By Participant List” mode
β’ Source group: must be readable for the member list
β’ Target group: the bot must have administrator rights to invite
β’ Recommended for groups up to 10,000 membersπ¬ “By Message” mode
β’ Analyzes recent group messages
β’ Invites only active participants (message authors)
β’ Suitable for large groups with limited access to the member list
β’ May operate slower, but more safelySetting options:
- Delay between invitesΒ : 30-60 seconds (minimum!)
- Delay frequencyΒ : after each invite
- Invite LimitΒ : Set a reasonable limit
- Session rotationΒ : enable for reliability
- Rotation frequencyΒ : after 10-20 invites or only in case of errors
Task monitoring
- Go toΒ π Task Status
- View active, completed, and failed tasks
- For active tasks: pause/resume/stop
π Bot commands
Basic commands:
/start– Main menu and getting started/sessions– Session management (administrators only)/status– View the status of all tasks
Navigation menu:
- π Main menuΒ – section navigation
- π₯ InvitingΒ – creating and configuring tasks
- π Task statusΒ – monitoring execution
- π SessionsΒ – Managing Telegram sessions
π‘οΈ Safety and Security
β οΈImportant Warnings
Telegram restrictions:
- FloodWaitΒ : No more than 50 invitations per hour from one session
- LimitsΒ : Maximum 100 invitations per day per account
- BlockingΒ : Violating the rules may result in account blocking.
Safety recommendations:
- UseΒ multiple sessionsΒ to distribute the load
- SetΒ long delaysΒ (30-60 seconds minimum)
- Do not exceedΒ 50 invitations per hourΒ per session.
- Monitor task statusΒ regularly
- UseΒ session rotationΒ to automatically switch
π Session rotation
Operating principle:
- Automatic switchingΒ during FloodWait or critical errors
- Checking accessΒ to groups before switching
- Excluding problematic sessionsΒ from the current task
- Continue workingΒ in a new session without losing progress
Rotation settings:
- DisabledΒ : The session runs until it is completely blocked.
- Only on errorsΒ : Switch to FloodWait/blocking only
- After N invitesΒ : forced rotation every N invites
π Statistics and monitoring
Tracked metrics:
- Number of successful invitations
- Failure and error rate
- Task execution time
- Status of each session
Notifications:
- Successful completionΒ of the task
- Critical errorsΒ with a description of the problem
- RotationΒ warnings
- Session statusΒ in case of problems
π§ Troubleshooting
Common problems
β “ChannelPrivate” error
Problem: Cannot access private group
Solution: Ensure the session is a member of the groupβ FloodWait
Problem: Request limit exceeded
Solution: Increase delay, enable session rotationβ “Admin rights required”
Problem: Bot cannot invite to the target group.
Solution: Grant the session administrator privileges with invitation rights.β The session does not see participants
Problem: Participant list hidden for non-administrators
Solution: Use "By Message" mode or assign an administratorLogs and debugging
View logs:
# API server logs
tail -f parser.log
# Bot logs
tail -f bot.logLogging levels:
INFO: Main events and statusesWARNING: Problem WarningsERROR: Critical errorsDEBUG: Detailed information for debugging
Disaster recovery
Force stop tasks:
# Via API
curl -X POST http://localhost:8001/tasks/{task_id}/stop
# Or via the bot in the task status menuCleaning the database:
```text
# Delete all tasks
rm inviter.db
# Restart the application
```ποΈ Additional features
History of groups
- Automatic saving of recently used groups
- Quick selection from history when creating new tasks
- Maximum 10 groups per user
Task management
- Pause/resumeΒ active tasks
- StoppingΒ while saving progress
- View the historyΒ of all completed tasks
- Export statisticsΒ in a convenient format
Notification system
- Telegram notificationsΒ about important events
- Real-timeΒ task status
- Session ProblemΒ Warnings
- CompletionΒ reports
π API documentation
REST API endpoints:
Sessions:
GET /sessions– list of all sessionsPOST /sessions/add– add a sessionDELETE /sessions/{alias}– delete session
Tasks:
GET /tasks– user task listPOST /tasks– create a taskGET /tasks/{id}– task statusPOST /tasks/{id}/start– run the taskPOST /tasks/{id}/stop– stop the task
Groups:
GET /groups/{session_alias}/info– information about the groupGET /user/{user_id}/groups– user groupsGET /user/{user_id}/target_groups– target user groups
Swagger documentation:
After starting the API server, open:http://localhost:8001/docs
π€ Support and updates
Useful links:
Recommendations for use:
- Start with test groups
- Increase the load gradually
- Check your session status regularly
- Make database backups
β οΈ DisclaimerΒ : Use this tool responsibly. Follow Telegram’s rules and adhere to the terms of use. The author is not responsible for account suspensions due to improper use.
