🔥 Live offer: limited-time discount on the Pro plan Grab the deal
BotifyHost
Tutorials

How to Build & Host a Telegram Channel Auto-Forwarder Bot with 24/7 Uptime

Automatically copy or forward posts, images, and documents from source channels to destination channels in real time with keyword filtering.

#Auto Forwarder#Telethon#Channels#Python

Auto-forwarder bots are widely used by community managers, crypto signal trackers, news aggregators, and trading groups to synchronize updates across multiple Telegram channels automatically.

Telethon Auto-Forwarder Code with Filtering

# forwarder.py
import os
import asyncio
from telethon import TelegramClient, events

API_ID = int(os.environ.get("API_ID"))
API_HASH = os.environ.get("API_HASH")
SESSION_STRING = os.environ.get("SESSION_STRING")

SOURCE_CHANNELS = [-1001234567890]  # Source channel ID
DESTINATION_CHANNEL = -1009876543210 # Destination channel ID
BLOCKED_KEYWORDS = ["scam", "promotion", "http://spam"]

client = TelegramClient("forwarder_session", API_ID, API_HASH)

@client.on(events.NewMessage(chats=SOURCE_CHANNELS))
async def forward_handler(event):
    message_text = event.raw_text or ""
    
    # Check keyword blacklist
    if any(keyword in message_text.lower() for keyword in BLOCKED_KEYWORDS):
        print(f"Skipping post due to blacklisted keyword.")
        return

    try:
        # Re-send media or text to avoid "Forwarded from" header
        if event.media:
            await client.send_file(DESTINATION_CHANNEL, event.media, caption=message_text)
        else:
            await client.send_message(DESTINATION_CHANNEL, message_text)
        print(f"Successfully forwarded message ID: {event.id}")
    except Exception as e:
        print(f"Failed to forward message: {str(e)}")

with client:
    print("Auto-forwarder is actively monitoring channels...")
    client.run_until_disconnected()

Why Cloud Hosting is Critical for Forwarders

If your forwarder bot goes offline for even 5 minutes, you miss critical trading alerts or channel posts. BotifyHost's 24/7 background worker threads keep your socket open constantly with sub-10ms ping to Telegram's MTProto datacenters.

Ready to put this into practice? Upload your bot to BotifyHost and it stays online 24/7. Try the full dashboard free for 3 days, or host 1 bot free from our Android app.
BotifyHost
Written by the BotifyHost Team

We run Telegram and Discord bots for a living, and write up the fixes we use every day. Questions about this guide? Ask us on Telegram.

Your bot, online
while you sleep.

Deploy free in under a minute. Upgrade only when you need more power.

Need Help? Chat on Telegram