This service allows you to send mass messages by your bots in telegram. Also supports multiple bots to use for a single message.
By default, there's a limit of 25 messages per second.
You can change it in the internal/config/settings.go file.
- Create new
.envfile (you can use the.env.exampletemplate)
cp .env.example .env- Install docker (https://www.docker.com/products/docker-desktop/)
- Build docker
sudo docker compose build- Run docker
sudo docker compose upFirst of all, you need to create your bots. This service can handle multiple bots.
To add your bot you need to obtain your bot token at https://t.me/BotFather
After you obtained a token you need to create new row in the database.
Connect to the database in any way you want and insert your bot settings:
insert into telegram_bots(bot_token, bot_host, enabled)
values ('<YOUR TOKEN HERE>', '<BOT HOST KEY>', True);Explanation:
bot_token - is the token you obtained from the BotFather
bot_host - is the filter key for this bot. Every message settings will contain host key to determine which bot should process that message.
Invoke an AddNotificationsToQueue method of the gRPC with this structure:
{
"message_settings": [
{"telegram_user_id": 0, "telegram_bot_host": "string"},
{"telegram_user_id": 0, "telegram_bot_host": "string"}
],
"text": "string"
}message_settings - is the list of the users to receive message, provided in text field.
telegram_bot_host - is the key of the bot, that would send message to user, provided in telegram_user_id field.
This method will add all of the message_settings objects to the global message queue. Message processor will try to process 25 messages per second by default.