Skip to content

Repository files navigation

Telegram Multi-Account Forward Admin

A small self-hosted admin panel for managing multiple Telegram user sessions and forwarding rules on one VPS.

Architecture

Browser -> FastAPI Admin Panel -> SQLite -> TelegramManager -> Telethon session A -> rules -> Telethon session B -> rules -> Telethon session N -> rules

One VPS is enough for multiple light-use accounts. Each Telegram user gets a separate .session file.

Features

  • Admin login
  • Add multiple Telegram accounts
  • OTP login + Telegram 2FA support
  • Separate Telethon session per user
  • Multiple source -> target rules
  • Enable/disable accounts and rules
  • Restart accounts
  • Text and common media copying
  • Recent forwarding/error logs
  • PM2 deployment

VPS install

  1. Upload this folder: scp -r telegram_forward_admin root@YOUR_VPS_IP:/root/
  2. SSH into VPS: ssh root@YOUR_VPS_IP
  3. Configure: cd /root/telegram_forward_admin cp .env.example .env nano .env
  4. Set a strong ADMIN_PASSWORD and random SESSION_SECRET.
  5. Run: chmod +x deploy.sh run.sh ./deploy.sh
  6. Check: pm2 logs tg-forward-admin pm2 list

Panel listens on port 8787.

Recommended HTTPS

Put the panel behind Nginx/Caddy with HTTPS and preferably IP allowlisting, Tailscale, or another VPN. Do not expose an admin panel carrying Telegram sessions and API credentials over plain HTTP.

Adding a friend

  1. Friend creates/uses their own Telegram API ID/API hash.
  2. Admin -> Add Telegram Account.
  3. Click Send OTP.
  4. Friend provides the OTP directly while present/consenting; enter it immediately.
  5. If Telegram 2FA is enabled, enter it only for the login flow.
  6. Add rule:
    • Source: bot username such as moneygo_user_verification_bot, or numeric chat ID.
    • Target: private group numeric ID, or public username.
  7. Account status becomes running.

Important security

  • Never reuse your own .session for another person.
  • Treat .session, API hash, OTP, and 2FA password as secrets.
  • Get explicit permission from every account owner.
  • Back up sessions securely; never publish them to GitHub.
  • .env and data/ are ignored by git.
  • Telegram/third-party service terms may restrict automated access; use only where authorized.
  • The sample stores API hashes in local SQLite. For a higher-security production service, move secrets to an encrypted secrets store and encrypt backups.

Migrating an existing session

For safety this starter does not auto-import your old session. Add your own account through the panel first and test it. After successful testing, retire the old tg-forward process: pm2 stop tg-forward Do this only after confirming the new rule works.

Notes

  • This is a ready-to-deploy starter, not a hardened multi-tenant SaaS.
  • If many accounts are added, use PostgreSQL, encrypted secret storage, worker supervision, rate limiting, audit logs, and per-user RBAC.

V2 fixes

  • More reliable incoming source detection using username plus resolved Telegram entity ID.
  • Debug log for every incoming chat, so source matching problems are visible.
  • Find Groups button lists groups and exact numeric IDs.
  • Test Send verifies target access before testing forwarding.
  • Windows launcher run_windows.bat loads .env automatically.

Windows V2 test

For a fresh test, extract the ZIP, configure .env, then double-click run_windows.bat. If migrating an existing local V1 database/session, copy the old data folder into V2 while both servers are stopped.

V3

  • Super Admin and User roles
  • Super Admin can create/disable users, reset passwords, see/manage all accounts/rules/logs
  • Users only see/manage their own Telegram accounts and rules
  • Guided setup instructions in dashboard
  • Responsive mobile-friendly UI
  • Existing V2 data can be migrated by copying data/; old accounts may initially be unassigned and should be recreated/assigned for clean multi-user use.

V4 UX improvements

  • Verified accounts show OTP Verified / Login Complete instead of redundant OTP controls.
  • 2FA password has Show/Hide.
  • Find Chats / IDs lists groups, channels, bots and other dialogs with one-click Copy.
  • Recent Logs collapsed by default.
  • Redesigned responsive login page with password Show/Hide.

V5

  • Chats & IDs page now has instant search by chat name, @username, numeric ID, and type (Bot/Group/Channel/Chat).
  • Live result count and Clear Search button.
  • Setup Instructions are collapsed by default and expand on click.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages