Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Telegram is a messaging service for iOS, Android and other devices. A great advantage of Telegram is that it provides an open web service which can be used to send Telegram messages via software. More information about Telegram can be found here – the API documentation is available here

To send Telegram messages for the NETx BMS Server, the so called Bot API can be used. This is used to communicate with so called Telegram bots. Bots are special accounts that do not require a phone number. This tutorial explains how a Telegram Bot can be created and how the NETx BMS Server can send messages to this bot.

Info

In order to use this functionality, it is assumed that you have installed the Telegram app on your smart phone. The Telegram app can be download from Apple iTunes or Google Play Store. In addition, it is assumed to you have created a Telegram account. More information about Telegram can be found here.

...

Configuring the HTTP module

To a message to your bot via the HTTP API of telegram, the following HTTP POST request has to be used (<your bot token> has to be replaced by the authentication token of your bot):

Code Block
https://api.telegram.org/bot<your bot token>/sendMessage

As body the following JSON object has to be sent:

Code Block
{
	"text":"<your message>",
	"chat_id":<your chat id>
}
<your message> has to be replaced by text that you would like to send and <your chat id> with the chat_id that you determined within the previous step of this tutorial.

To configure this within the HTTP module, open the "Resouce definitions" within the menu "HTTP" of the NETx BMS Studio. Enter the following definition:

Image Added

The HTTP module will replace the placeholder "@value@" by the value of ther Server Item which will be used to send a message. The placeholder "{0}" will be replaced by the first parameter within the "Datapoint definitions" (for more information see the HTTP tutorial).