Telegram Plugin

Plugin Telegram is designed to send messages from the intraHouse system to the Telegram messenger using a bot.

Plugin installation

The plugin installation procedure is shown here

For the plug-in to work, you need to create a telegram-bot. This procedure is performed in the Telegram application.

Creating a Telegram bot

Telegram bot is created with the help of another bot called BotFather

Press the START button to start communicating with the BotFather

Send the command / newbot

The bot will offer to enter a name that will be displayed in the contact list:

The bot will offer to enter the name of the bot, in the end it should end in “bot”:

If the name is not taken, BotFather will reply with a message with a token – a “key” to access the bot created:

Plugin setup

Double click on the plugin line to open the plugin properties window.
On the Parameters tab, complete the following fields:

  1. Token – the key to the created bot
  2. Proxy – select the desired mode (Auto / Manual Setup / Off)

If the Auto mode is set in the Proxy settings, the plugin automatically selects the address of the Proxy server.

Click the Save button.

Getting user ID

After setting up the plugin, you can write any message (/ start) to the bot. If everything is done correctly, a message with the user ID will be received in response:

Information setting

To add an address for information, follow these steps

Go to the Access section, then Accounts. Select the required account and click the button to display the information addresses.
Click the add button.

Fill in the fields:

  1. Information channel – select the necessary information plug-in.
  2. Group – assign the necessary information group.
  3. Address (number) – enter the previously received user ID

Click the Save button.

Note. After adding a user, you need to restart the plugin.

Using

Telegram plugin can be used in scripts to send messages.

For example, this script will send a message to Telegram when water leaks

/** 
* @name Water leak
* @desc Shut off the water valve and report the water leakage.
*/

const actor  = Device("ActorD", "Water valve"); 
  
const sensor = Device("SensorD", "Leakage sensor");  

const script = {
    check() {
      return sensor.dval;
    },
    
    start() {
     this.startTimer("T1", 3, "close");       
    },
    
    close() {
     this.do(actor,"off");  

     this.info('telegram', 'OWNER', 'Water leak! The water valve is shut off!');
    }
    
};

Close Menu