DEV Community

Mohammad
Mohammad

Posted on

Telegram Forwarder: Automate Message Forwarding Between Telegram Chats Using Python & Telethon

Have you ever wished you could automatically forward messages from one Telegram chat, group, or channel to another? Whether you're managing multiple communities, archiving content, or syncing information across channels, manually copying and pasting messages is neither scalable nor efficient.

That’s where Telegram Forwarder comes in — a lightweight, powerful Python script that uses the Telethon library to automate Telegram message forwarding.

What is Telegram Forwarder?

Telegram Forwarder is a Python-based script designed to:

  • Automatically forward messages from one or more Telegram sources to one or more destinations
  • Support one-to-one, one-to-many, and many-to-one forwarding
  • Work with user accounts and bot accounts
  • Optionally remove the "Forwarded from..." signature
  • Handle Telegram API rate limits gracefully
  • Offer comprehensive logging and easy configuration via .env file

This script is ideal for admins, content curators, automation fans, and anyone working with Telegram as a core communication tool.

Key Features

  • Forward from any source: Private chats, public channels, or groups
  • Multi-source and multi-destination support
  • Bot or user login support
  • Clean forwards: Option to remove forward signatures
  • Quiet mode: Turn off console output for clean logging
  • Robust logging: Track everything in telegram_forwarder.log
  • .env configuration: No need to modify Python files

Installation Guide

Clone the repo and install dependencies:

git clone https://github.com/Linuxmaster14/TGForwarder.git
cd TGForwarder
pip install -r requirements.txt
Enter fullscreen mode Exit fullscreen mode

Set up your .env file:

cp .env.example .env
Enter fullscreen mode Exit fullscreen mode

Now, edit .env and add your credentials and chat IDs.

Prerequisites

Before you start, you’ll need:

  1. Telegram API Credentials: Get API_ID and API_HASH from my.telegram.org
  2. Bot Token (optional): Get it from @BotFather
  3. Chat IDs: Use @userinfobot or @get_id_bot to fetch them.

Read more ...

Author

Made with ❤️ by Linuxmaster14

Top comments (0)