Using Telebot to Send Telegram Messages in Bulk
1 About the Bulk Telegram Messaging Feature
2 Fill in the Message List File
3 Import the Message List File to Telebot and Initiating Sending Job
4 Monitoring Message Sending Progress
1 About the Bulk Telegram Messaging Feature
Telebot provides you with a bulk messaging feature. You can enter the messages you want to send in an Excel spreadsheet, and then use Telebot's bulk messaging feature to send these messages to specified contacts, groups, or channels.
You can use formulas in the Excel spreadsheet to send different messages to each person. Below is an example of sending each customer's points for the month individually via Telegram:
In this example, we use the following formula in column H (MessageText) to generate personalized messages for each customer:
="Hi "&A2&",
Your total reward points for this month are: ["&B2&"] points.
Thank you for being with us! Let us know if you’d like help redeeming them."
Note: This feature requires the recipients to have added your Telegram Bot as a contact and to be willing to receive messages sent through this Bot.
2 Fill in the Message List File
Before starting to send bulk messages, you need to first fill in the messages to be sent in the message list spreadsheet. The message list spreadsheet is an Excel file, and you can click here to download the template for this file.
The message list must be placed in the first sheet of the Excel file. The first row is the header row, and the second row and below are the data rows.
Message List
Below are the necessary fields and descriptions for the message list spreadsheet:
BotUsername |
Fill in the Telegram Bot username used to send this message. Note: You only need to fill in either "BotUsername" or "BotID." If you have filled in the BotUsername, you do not need to fill in the BotID. The bot must be one that has already been added to the "Bot Configuration" in Telebot. The BotUsername can be found in the "Bot Configuration." |
BotID |
Fill in the BotID of the Telegram Bot used to send this message. Note: You only need to fill in either "BotUsername" or "BotID." If you have filled in the BotUsername, you do not need to fill in the BotID. The bot must be one that has already been added to the "Bot Configuration" in Telebot. The BotID can be found in the "Bot Configuration." |
SendToUsername |
If the message is sent to a "private" type chat (one-on-one chat), you can fill in the recipient's username here (without the "@" symbol before the username). Note: You only need to fill in either "SendToChatID" or "SendToUsername." If you have filled in "SendToUsername," you do not need to fill in "SendToChatID." The username you fill in must already exist in the "Chat List Manager." If the username does not exist in the "Chat List Manager," ask the recipient to send a message to your bot, then you can find the corresponding ChatID in the "Chat List Manager" (you need to enable the bot's "Automatically fetch messages and save to local database" option). |
SendToChatID |
Fill in the ChatID of the chat where the message will be sent. If you want to send the message to a Channel, you can directly fill in "'@channel_username" in the "SendToChatID" field (note the single quotation mark before the @). Click here for detailed instructions. Note: If you want to send a message to a group, fill in the group’s ChatID in the "SendToChatID" field. If you want to send a message to a channel, fill in the channel's ChatID or "'@channel_username" (note the single quotation mark before the @) in the "SendToChatID" field. When sending a message to a "private" type chat, you only need to fill in either "SendToChatID" or "SendToUsername." If you have filled in "SendToUsername," you do not need to fill in "SendToChatID." |
MessageType |
Optional. Specify the message type. It can be: text: Send a text message. The content of the message is set in the "MessageText" field. document: Send a document message. The file to be sent is specified in the "AttachFileName" field. You can also add some description for the file in the "MessageText" field. photo: Send a photo message. The image file to be sent is specified in the "AttachFileName" field. You can also add some description for the file in the "MessageText" field. If this field is empty, the system will treat the message as a text type. |
MessageText |
Specifies the text content of the message to be sent. The Telegram API requires that the length of this field cannot exceed 4096 characters. Note: For "text" messages, this field is mandatory. For "document" and "photo" type messages, this field is optional and will be sent as the caption for the file. |
AttachFileName |
If the message type is "document" or "photo," specify the name of the file to be sent here. Note that you need to provide the full path of the file. For example: C:\Users\andy\Desktop\New Folder\invoice-andy.pdf |
ParseMode |
Optional. Specify how Telegram should display the text in MessageText. It can be "text", "MarkdownV2" or "HTML." For detailed explanations, please refer to the Telegram API documentation: Formatting options |
If you want to send a message to a channel, the SendToChatID field can be filled with "@channel_username."
Note: The sending Bot must be an administrator of the channel (it only needs the "Manage messages" -> "Post Messages" permission).
(1) In Telegram, click the "View Channel Info" menu item:
(2) In the "Channel Info," right-click the "link" and click "Copy username":
(3) In the message list table, paste the copied username into the "SendToChatID" cell, preceded by a single quote ('):
3 Import the Message List File to Telebot and Initiating Sending Job
After preparing the message list, click the "Send Messages in Bulk" button in Telebot Manager.
Then click "Send Messages in Bulk."
Click the "..." button next to "Message List File," select the Excel file, and then click the "OK" button.
At this point, Telebot will check the data in the list and import it into the message queue.
After verifying the message content on the interface, click the "OK, Start to Send the Messages" button, and the system will start sending the messages in the list.
You can monitor the sending progress in Job List.
4 Monitoring Message Sending Progress
You can monitor the sending progress of each job in Job List.
5 Abort a Bulk Message Sending Job
Once the bulk message sending has started, you can abort the sending by deleting the corresponding job in the Job List. After the job is deleted, any unsent messages will be canceled.
Q: Can I add other columns to the message list?
A: Yes, but the message list must include these required columns: BotUsername, BotID, SendToChatID, SendToUsername, MessageType, MessageText, AttachFileName, ParseMode.