I would like to make a telegram bot that sends error messages from a software. This software would run on 20 different pcs. Each log would be like this:
"pc name – Date time – error text".
The bot does not accept any comands.
The idea would be to run the same exe on multiple pc’s having multiple insances of the same bot, and they all write in the same bot-chat. since there is no command being sent, there is no risk that one instance steals the command from the others.
Is this possible? or is there a smarter way to do it using telegram? I do not want to have a new bot for each machine, as it would become a mess to handle quickly and would require setup for each machine.
thank you
2
Answers
I did a quick test by running two instances of a node app with telegraf, sending messages to me every 5 seconds using
bot.telegram.sendMessage
.It worked properly, but I also got this error
About which I found this. Anyway, both the instances kept sending me messages without any problem.
I would say that this depends on the library, which besides sending these messages is also polling the telegram API for updates, even if I didn’t set up any callback to manage them.
Indeed if you check the sendMessage documentation of Telegram Bot API, it doesn’t mention such an error.
This means that you should be able to send such
sendMessage
calls from multiple instances of the same bot without any problem, just pay attention to the library you are using and what it’s doing under the hood. You may even want to implement your own calls instead of relying on existing apps if they don’t suit your use case.update
I tried to send messages without launching the bot (which makes it fetch updates i guess) and i didn’t get the errors
at this point, I’m quite confident you can do it.
Yes, multiple instances of your ‘bot’ can use the same bot token to send a message. The issue you can run into is a rate limit if your machines start sending too many messages at the same time.