Telegram, one of the largest instant messaging applications, introduces bot support some time ago. Their main purpose, it seems, is to have a sort of interactive communications with users. However, you can use the API for much more prosaic, but constructive purposes.

For example, bots are perfect for sending notifications for your DevOps/admin activities, or for your automation scripts. Of course, you can utilize email for the same purpose, but there are a few pros to using bots, and we will look at them in a minute. First, let's see how one can use a bot for non-interactive notifications.

  • Install Telegram for each team member
  • Register a bot - read Telegram docs on how to do it, but in practice you simply "talk" to @BotFather
  • Create a Telegram group and add everyone who needs to see these notifications there
  • Add the new bot to the group as well
  • Find out the chat id of the group, for example as mentioned here

Note, that you need to perform these steps only once per notification group / robot. See it as setting up a new email and email distribution list. Also worth mentioning that all these actions are free, since, as opposed to slack and similar services, Telegram is totally gratis.

Once you have everything set up, you can use Telegram Bot API to send messages. You can simply utilize their web based API, but I prefer the python wrapper.

Telegram bots have a few advantages over that means of communications:

  • There is a general trend towards moving to IM from email
  • It is free! Slack and some other corporate-oriented IM solutions cost you an arm and a leg, while providing just a bit more functionality (and sometimes not even that). Email is still mostly free, however for larger organisations it is usually a paid service. On top of that, managing mailing lists can also be a commercial service
  • Telegram is extremely security oriented. There is a reason why various governments, including Russian, Chinese and Iranian among others, try to ban it. Email on the other hand is notoriously insecure, both in transit and in terms of forging messages
  • It is very easy to create a new bot / new group in Telegram - probably easier than to set up a new email address and mailing list
  • It is definitely much easier to maintain the target audience of the intended recipients - those are the members of the Telegram group you set up earlier. Adding/removing members is done directly in Telegram app
  • In the script/on server the config for the bot consists of only two items - the secret token and the chat id. For email that would be email, password, SMPT server, possibly port, possibly SSL flag etc. Sometimes your system admin has already set up local sendmail, in which case you only need email, but then someone needs to set up sendmail!

There are a few disadvantages for these kind of notification. Telegram allows rather limited formatting in the instant messages (on purpose). If you would like to send reports with complicated layouts and graphics, you are out of luck. Of course, an alternative is to store this report on the web somehow and simply share the link. Telegram can even show a decent preview of it! Thus, you don't need to send the same PDF to 5 thousand people, but only a simple link. However, if this is not an option, you might want to stick to the old crusty but trusty SMTP. And, of course, Telegram is not yet fully embrased by large organisations, but there are no surprises there, are there? :)

Conclusion: consider using Telegram bots for short notifications for DevOps activities and various automation scripts.

Tags: computers
Categories: None |

0 comments have been posted.

Your email: we will send you a confirmation link to this address to confirm your identity and to prevent robot posting
Get in touch
Follow updates

Join our social networks and RSS feed to keep up to date with latest news and publications