📜 ⬆️ ⬇️

Simple and convenient notifications

Hello! Quite often, developers and system administrators are faced with the need to send notifications, such as errors or task reports, and someone has a financial report for the day. Everything is limited by imagination and tasks. Everyone chooses a handy tool or writes something different.

I am faced with a similar task in almost all projects with which I have been working in recent years. I decided to simplify my life - to find or make a convenient notification tool.

Defined requirements:
')


The first thing that came to mind was an SMS, but this is not free, but on large volumes it is very expensive. The second is pushover, but it is also paid, although pleasant enough. And then I decided to look in the direction of something ready, which is already on modern phones, namely, instant messengers. Telegram bots completely covered my tasks!

This is how the Alarmer bot appeared .

The principle of operation is extremely simple:

  1. add it to the contact list or chat
  2. get the key
  3. send a message and a key using a normal https request
  4. Receive this message in your Telegram

If the bot is added to the chat, then all participants in this chat will be notified. Let's look at a simple example:

image

Key received: 21dd13-b6486d-8ba16b

We send request (CURL, wget, file_get_contents, ...):

alarmerbot.ru/?key=21dd13-b6486d-8ba16b&message=Habrahabr

And we get a notification:



That's how simple it is! You yourself can implement something like this, but if you just need a tool and do not want to rewrite what is already ready, then use an alarm.

Important : the bot only accepts messages beginning with the symbol "/". It will be interesting to those who added a bot to the chat and discusses something secret there. And yes, requests are not logged, neither on the NGINX side, nor by the script itself.

Have a nice day and I hope the article was helpful!

Source: https://habr.com/ru/post/314072/


All Articles