Effortlessly forward messages—including text, images, videos, voice notes, and more—between any number of Telegram chats or channels, using native forwarding and keyword filters.
-
True Forwarding
Leverages Telethon’sforward_messagesmethod to preserve the original sender, timestamp, and “Forwarded” header for every message and media type. -
Keyword-Based Filtering
Forward only messages that match one or more case‑insensitive keywords of your choice. -
Multiple Jobs & Background Operation
Create and manage multiple “forwarding jobs” in a single session. Start them all at once—the script runs each job in the background while you retain menu control. -
Persistent Job History
Every forwarding session is logged (timestamp, sources, destination, keywords) toforward_history.txtfor audit or review. -
Interactive Menu
- List Chats – Export all your dialogs to a text file.
- Add Forwarding Job – Specify source chat(s), destination channel/chat, and optional keywords.
- List Forwarding Jobs – Review all configured jobs.
- Start Forwarding – Launch all jobs asynchronously; menu remains responsive.
- Stop Forwarding – Cancel all background tasks without exiting.
- Exit – Quit cleanly.
-
Authentication
On first run, enter your Telegram API ID, API Hash, and phone number (saved tocredentials.txt). Supports two‑step verification if enabled. -
Job Setup
Use the menu to add as many source→destination jobs as you need, with optional keyword filters. -
Background Forwarding
Each job polls its source chats for new messages, filters by keyword, and uses Telethon’sforward_messagesto relay content. -
Logging
Sessions are appended toforward_history.txtwith timestamp, source IDs, destination ID, and keywords.
Remember to edit the forwarding_config.txt, where the sources and destinations must be added.
sudo apt update && sudo apt upgrade
sudo apt install git -y
git clone https://github.com/Oliviertjeh/TelegramForwarder
cd TelegramForwarder
python3 -m venv .venv/TGforwarder
source .venv/TGforwarder/bin/activate
pip install -r requirements.txt
python TelegramForwarder.py
# (optional) You can run it in the background by:
sudo nano /etc/systemd/system/telegram_forwarder.service
and add the code of the telegram_forwarder.service file
# restart
sudo systemctl daemon-reload
sudo systemctl restart telegram_forwarder.service
#check the status
sudo systemctl status telegram_forwarder.service
journalctl -u telegram_forwarder.service -f
then you can press ctrl + c to stop live logs and close for example Putty