Library

We have an extensive library of various bOS configuration examples. Select your heating pump, AC, TV or almost any other device and import it to your smart building configuration. We also encourage all system integrators and DIYs to add their own examples to ComfortClick library.

Telegram messenger icon

Telegram messenger

Sending messages via Telegram

Author: Artem Kuteynikov

DOWNLOAD

Telegram Messenger, commonly known as Telegram, is a cloud-based, cross-platform, instant messaging service. Telegram API enables bOS server to send messages and transfer string or numerical values of variables to Telegram users who subscribed on a chat-bot created. A control of devices and setpoint adjustment is also possible.

Device preparation

Create your bot via conversation with botFather (botFather guides you to create your bot). Acquire API token (once bot is created, API token is generated) Activate created bot (to activate your newly created bot, in the chat search option, type in the name of your current bot and send the bot "/start" message. This will activate the bot. Respond message will provide you with API token, which you can then copy under Token value in bOS. This token value is used in every API command for the communication.

Configuration

Download the example from our website and import it into your configuration. Step by step instructions on how to import are available in our instructional video.

To acquire Chat ID start a new chat and start chat with another bot. Use the bot called @getmyid_bot and start conversation with /start. The bot will respond with your Chat ID. Paste this chat ID under chat ID value in bOS. This ID value is used in every API command for the communication.

To receive messages from users one of two methods may be used: getUptades or Webhooks. getUpdates method utilized in this example. For multiple users messaging group-chat ID should be used instead of single chat ID. Bot should be an administrator of this group. sendMessage method serves to send messages to chat. Any trigger to activate command that fits project requirements can be used (temperatures, consumption, movement, alarm..).

Sender and Receiver devices let parse data from incoming messages thus enabling device control. To avoid typing frequently used tasks a set of commands can be created. A user then can choose a command from a list making server to perform required action (sensor polling in example).

Comments

Please login to post a comment.

This website uses cookies

We use cookies to personalize content, use live chat, provide social media features and to analyze our traffic. We also share information about your use of our site with analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.