Telegram BOT

You are here:
< Back

Configure SGBox to use Telgram API in LCE Module and send alert messages

This articles explain how to configure SGBox to interact with Telegram API in order to send alert messages when a specific event occur.

Requirements:

  • SGBox version 4.2.4 with the LM and LCE modules.
  • A Telegram BOT.

There are many tutorial about how to configure a Telegram BOT. We choose @BotFather for our example.
First you need to create your bot and obtain your TOKEN:

A token is something like: 1148120703:AbIUGpERusdQDEEag_EL1KDtynRB9sIhbj1.
You need also a the chat_id, so: start and say “Hello” to your bot, than retrieve the chat id:

From your browser go to:
https://api.telegram.org/bot1148120703:AbIUGpERusdQDEEag_EL1KDtynRB9sIhbj1/getupdates

Find the ID in the response:

id: 124229696

Once created tbe bot, you can go on SGBOX > LCE > Rules > New Rule.
We choose the event [SGBox] Logon OK for our test, but you can choose every event you want. The related action is Call API.
Specify the Telegram API with your TOKEN:
https://api.telegram.org/bot1148120703:AbIUGpERusdQDEEag_EL1KDtynRB9sIhbj1/sendMessage -d chat_id=124229696 -d text="New SGBox Logon"

Click Save and give a name to your rule.

If you wan you can also specify a parameter in your message:
https://api.telegram.org/bot1148120703:AbIUGpERusdQDEEag_EL1KDtynRB9sIhbj1/sendMessage -d chat_id=124229696 -d text="SGBox Logon from "

When a logon occur, a message will sent from your bot: