
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.
- Manufacturer: Telegram
- Product name: Telegram Messenger
- Website: Telegram website
- Manual: Telegram API manual
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).