Telegram bot to copy messages
Use Junction Bot to automatically copy or forward Telegram messages from different sources to your Telegram channel or group. We call it forwarding.
Possible sources of messages:
- public and private channels and groups
- closed private channels and groups (without an invitation link)
- other bots
- private chats with other users
Some of these sources are available only with Direct Connection. Please check here to see which type of account you need. Views of a forwarded message are counted separately and do not change the views count of the original message.
Creating a new forward
To create a forwarding rule to copy messages from Telegram use the command /new. It will guide you through the setup process.
After the setup is complete you can see your new list of rules with the command /forwards (former /list). Also, this command will show you buttons to control your forwarding rules (disable, delete, etc).
You can adjust different settings of all your rules or of every particular rule. Please see here for more details.
Copy Telegram channel with or without invitation link
The bot can copy messages from Telegram private channels and groups if they have an invitation link and also if they don’t have it.
If you are using an Economy account, please remember that private telegram channels are guaranteed to work only until the invitation link is active.
If you need to copy from private channels without an invitation link or you want to get messages from other bots, you need to use the direct connection.
Copying from one Telegram source to several destinations
Usually, when you adjust the settings of your forwarding rules you use a link to a source channel. But how to identify exact rule if you have several forwarding rules to different channels from one source. How to set up different settings/filters/replacements for different destination channels?
Add the following construction to the source name: ->-1001251642436
Where -1001251642436
is the identifier of the destination channel in the Telegram system plus prefix “-100” (it’s the way how Telegram distinguishes numbers of channels from numbers of other objects). To find this number just use the command /filter
source_channel_reference
You’ll see all the possible destination identifiers based on your current forwarding rules.
For example, the commands to add two different filters to different destinations from the same source might look like this:/filter source_channel_reference->-1001251642436 mustHave green
/filter source_channel_reference->-1001459676332 mustHave red
The commands to add two different feedback buttons to different destinations from the same source might look like this:/settingchannel source_channel_reference->-1001251642436 like 👍🏻
/settingchannel
source_channel_reference->-1001459676332 like
❤️
Grouping sources into folders
A very convenient feature of the bot is the ability to group sources and keep one set of settings applicable to all sources in the group. For this purpose, Telegram folders are used, thus, the function is available only when using a direct connection.
Keep in mind that the bot only uses sources that are explicitly specified as part of the folder. That is, when you see the name of this source in the folder settings, it will be used. If, for example, you have specified in the folder settings that it should contain all channels, the bot will ignore this setting.
To use grouping, create a folder and add the desired sources – channels, chats, bots – to it. Next, create a new forwarding rule and select the desired folder as the source (if the folder is not in the list yet, wait a couple of minutes and refresh the list). Please note that after the folder name you will see its composition – the number of channels, groups and private chats. That’s it, it’s done!
This forwarding rule will now display the selected folder as the source. Any messages appeared in one of the sources in the folder will be forwarded to the destination. If you change the composition of the folder, this forwarding rule will automatically be affected.
If you have one forwarding rule from a folder containing source A and another forwarding rule directly from source A, the message from A will only be forwarded once, and the settings of the second forwarding rule (the one where A is specified as the source) will be used.
Status “Pending”
If your source channel is completely new to the system and we have a high load it can take a while for the bot to start receiving messages from it.
If using the command /forwards (or former /list) you see channels marked by PENDING, it means these channels are waiting for being connected to the bot. Please wait for 10-30 minutes’ time and messages will start coming.
Please let us know if it takes more than one day.
Reducing delays
With the command /support
you can run a wizard to help you figure out why the message didn’t reach the destination or arrived with a delay. This feature is currently only available for direct connections.
If the delay in message delivery happened once, then most likely at this moment there was just an update of the bot. You can use a command /status
to check when was the last update and whether it is going at the moment. Also, this command shows an estimated maximum delay for Economy accounts (direct connections work instantly).
If you have a Free or Economy account
For public channels on Free and Economy accounts, message delivery can take up to a few hours. Delivery from private channels usually happens instantly, but rarely, once in a while, it can jump up as well. If your source channel is completely new to the system and we have a high load it can take a while for the bot to start receiving messages from it. Please let us know if it takes more than 24 hours. If such delays are not acceptable, then you should use a Direct Connection. Direct Connection guarantees instant delivery times.
We are providing a service for speeding up delivery from a public channel so it will take several seconds. This service costs €1.20 per channel per month. You can enable/disable speeding up whenever you want with the command /express.
/express source_channel_reference
For example, to speed up @slow-channel use /express @slow-channel
To change the channel being sped up, first, disable the express for the previous channel with the same command and then enable it for a new one. You can see the list of your express channels by the command /express
without arguments.
Another way to make the delivery instant is to use Direct Connection. All messages from a direct connection come instantly. Please note that if you are using a direct connection, you don’t need to use /express
. Delivery from a direct connection is happening instantly already.
If you are interested in one of these services please see here more about how to buy them.
If you have a Direct Connection
Then the message delivery is instantaneous. If you constantly have a noticeable delay on the direct connection, it means that the connection needs additional configuration. Please use a command /support
for that. Also, it may be caused by too many subscriptions on your account. You can read more about it here.
Is “instantaneous” really instantaneous?
“Instantaneous” is from milliseconds to several seconds. The bot itself works without delay, but delays may occur when messages are delivered by Telegram.
Also, after Telegram introduced copy protection when sending media messages from protected channels, the bot needs to process these messages in a special way. This can lead to additional delays depending on the file size. For an ordinary photo, for example, this delay will not be noticeable, which cannot be said for heavy video.
Sometimes we do a system update. This may once in a while cause a noticeable delay if the update occurs precisely at the time the message appears. You can check whether the system update is currently taking place with the command /status
Nuances of working with protected Telegram channels
If the source has copy protection, the bot has to process the protected media file completely. That’s why heavy media messages take more time to be delivered.
Telegram Premium features
Premium account holders can use premium smileys and long media captions in their messages. Bots are not allowed to use either. Therefore the only way to send such messages as they are is to enable delivery on behalf of your account. To do this, the account must be connected via a direct connection and have an active Telegram Premium.
Also, the bot is able to send the caption as a separate message, If there is a picture with a caption in the source, then there will be two messages in the destination: a picture and a text. This way the caption will not be trimmed.
In order to add premium emojis to a message, you need to use the tag corresponding to the specific emoji. To find out this tag, enable explain-report in the channel (setting explain
) and send there a message with the desired emoji.
Webhooks or calls to your API
Sometimes there is a need to receive Telegram messages to your API. The first idea that developers have is to use a REST-style HTTP endpoint and receive requests from our bot in some JSON-type format.
We strongly discourage this approach and deliberately do not add this functionality to the bot. Such requests tend to fail to arrive or arrive multiple times due to various network issues. As your system evolves, you will need to “replay” call history, look at call logs on our side in order to debug problems on your side, etc. Such functionality will require the creation of a separate product on our side.
So, for such tasks, we recommend you to use а message queue architecture. And, since we already have a ready-made messenger in front of us, why not use it? Just create your own simplest bot, it takes 15 minutes, and set up forwarding from the desired source directly to that bot. With this approach you will get an extremely reliable future-proof system.
How can I figure out why not all messages are coming?
Use the command /support
This function is available for direct connections only. With the command /support
you can run a wizard which will help you figure out why the message didn’t reach the destination or came with a delay. We suggest that you try this method before you try the others.
Turn on the explain-report
The first thing you should do is enable the explain-report (setting explain
or the command /settingchannel source_channel_reference explain on
).
For every new message it will send a report explaining in detail why the message didn’t get through. If you don’t understand how to read the report or correct the filter, contact the support chat.
It could be that the message was edited shortly after publication. If the original message didn’t go through your filters, the bot won’t be able to pass the edit either.
If there is no report for a new message in the source, then look further.
If you have a economy account
The problem is most likely a delay or a too large message from a protected channel.
If you have a direct connection
Check if your connected account is a member of the source channel or group.
Check if the problem is related to a too large message from a protected channel.
If that’s not the case, please send our assistant the phone number of your connected account and the number of the source channel or group. In very rare cases additional fine-tuning on our part is required.
Copying of the old Telegram messages
You can copy a history of a Telegram channel using the command /history
.
If you want to use advanced settings for a copying process like filters and replaces, you need to create a usual forwarding rule first using the command /new
. Then apply the required setting to this forwarding rule. After that start a history copying process and it will use the settings from an existing rule. Easy!
Why delivered messages may look different than in the source?
Sometimes the message in the source is edited after publication. Then it may happen that the bot will copy the message before the admin edits it. In this case, the first version of the message will be delivered. Sometimes the edited messages are not even marked as edited.
In the direct connection mode it is possible to pass the editing of the message to the destination (the function is enabled by default). This will solve this problem. If you already have a direct connection and are confronted with unsent edits, see the possible solution here.
It could also be that the original message went through your filters and the edit didn’t go through. Then the message will not be changed.
It happens that a channel mistakenly publishes a message twice and then deletes one message. If you have a duplicate filter, only the first message gets through. If the admin then deletes the first message and edits the second one, the edit fails.
Why can duplicates come?
Sometimes in the source a post is posted twice, by mistake, and a bit later one of the doubles is removed. But the bot may have already managed to copy both messages by that time. The most direct way to solve this problem is to enable delete transmission. This setting is only available for Direct connections. If you have an Economy account, you can use a duplicate filter.
If you have enabled the duplicate filter and the duplicates still pass, then it is possible that the messages are not the same. Enable an explain-report (setting explain
or the command /settingchannel source_channel_reference explain on
).
For every new message it will send a report explaining in detail why the message did or didn’t get through. Compare the contents of the messages in the reports that come in. If you don’t understand how to read the report, feel free to contact the support.
If you still don’t see the difference, please refer to more detailed instructions here.