hey zack, i’ve done something like this before. you’ll need to use the telegram bot api for sure. getUpdates method can grab messages from channel A, then sendMessage to post em in B. for the timing part, set up a cron job to run ur script every hour. make sure u got the right permissions for both channels tho!
I’ve implemented a similar bot for my company’s internal communication. Here’s what worked for me:
First, set up a webhook to receive updates from Telegram. This is more efficient than polling.
Use the getUpdates method to fetch messages from Channel A. Store the message IDs you’ve processed to avoid duplicates.
For sending to Channel B, I found sendMediaGroup useful for batching multiple messages, which is more efficient than individual sendMessage calls.
To handle the timing, I used a simple MySQL database to track when the last batch was sent. The script checks this timestamp and only proceeds if enough time has passed.
One gotcha: watch out for message types. Some, like polls, can’t be directly forwarded. You might need to recreate them.
Having created a similar Telegram bot using PHP, I can share my experience. The crucial step is using the Telegram Bot API to manage message transfers between channels. Begin by retrieving messages from the source channel using the getChatHistory method and follow this by replicating them in the destination channel with the sendMessage method. For continuous operation, implement a cron job to run your script at regular intervals—say, every 60 minutes. Ensure that messages are temporarily stored before sending, and pay attention to rate limits, error handling, and appropriate channel permissions.