Some time ago, my colleague Giuseppe Di Garbo published this article on the NetEye Blog, where he explained how to integrate NetEye notifications with Telegram.
It was a great starting point, and in fact many of us used it to enable NetEye’s notification system to send alerts directly to the Telegram app for many customers.
Later on, Telegram introduced the possibility to use threads (topics) within groups, so something more structured and easier to manage was needed both in terms of installation and configuration.
Well, today we can say it: we have a NEP for Telegram notifications!
Obviously, installation follows what has been the standard procedure for NEP packages for a few years now.
Once the NEP package list has been updated, you can run:
nep-setup list
nep-setup install nep-notification-telegram
Now comes the slightly more complex part: creating the bot and retrieving the following values: bot_token
, thread_id
, and chat_id
.
As already described in Giuseppe’s article, the basic configuration is essentially unchanged:
@BotFather
/newbot
and follow the instructionsmyname_bot
, NOTE: it must end with _bot
)123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11
Save it, we’ll need it later.
Now:
curl
After sending a message in the group, run:
curl -s "https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates"
Check the response. You should see something like this:
{
"message": {
"chat": {
"id": -1001234567890,
"title": "NetEye Notifications"
},
"message_thread_id": 33,
"text": "test"
}
}
Take note of the following:
chat.id
= this is your chat ID, to use as telegram_chat_id
message_thread_id
= this is your thread ID (optional, but very useful if you’re using topics), to use as telegram_thread_id
Before configuring NetEye, you can test if everything works with:
curl -s -X POST "https://api.telegram.org/bot<YOUR_TOKEN>/sendMessage" \
-d "chat_id=-1001234567890" \
-d "message_thread_id=33" \
-d "text=Test notification from NetEye" \
-d "parse_mode=HTML"
Now take all the IDs and tokens you’ve collected so far and insert them into the User Notification Template in NetEye.