Receiving devices notifications using Slack and Telegram messengers

2Smart Standalone users receive several types of notifications in the web application: system notifications, notifications from devices, notifications launched by a script, etc.

All notifications can also be received in Slack and Telegram messengers. In this case, the user can constantly monitor events occurring in his ecosystem of IoT devices.

Telegram

To configure a Telegram channel:

  1. Open Telegram bot.
  2. To create a new bot, enter: /newbot.
  3. Specify the bot's name and the bot's username (a name for users to refer to the bot).
  4. Save the received token (should start with "bot", for example, a valid token might look like this: bot1000000000:AAAAAA_aaaaaaaaa_abcdefghijklmnopq).
  5. Determine chat id:

  6. if the chat is private:

  7. if the chat is a group:

    • add a bot to the chat;
    • (а) open https://api.telegram.org/%BOT_TOKEN%/getUpdates?allowed_updates=[%22message%22];
    • find the last message in the result. If there are many messages in (a), you can find the last one by adding the offset and limit (1 from 100) parameters to the query;
    • find the field message.chat.id and save; By default, the bot does not see messages in the chat. For a message to appear in getUpdates - in the group add @%BOT_USERNAME% to the message.
  8. Enter the Name, Chat ID and Token in the Telegram channel configuration form.

Token Recovery

To restore the token:

  1. Open Telegram bot.
  2. Enter /mybots or /token.
  3. Select the bot for which the new token is generated.

Slack

To configure a Slack channel:

  1. Open https://api.slack.com/apps.
  2. Click on the "Create New App" button.
  3. Enter the App name and select Workspace.
  4. In Add features and functionality, click on Incoming Webhooks.
  5. Change the state of the switch to On.
  6. Click on "Add New Webhook to Workspace".
  7. Select a channel, and click on "Allow".
  8. Copy the generated link
  9. Enter the Name, and Webhook link in the Slack channel configuration form.

Webhook Recovery

To restore Webhook:

  1. Open https://api.slack.com/apps.
  2. Select the desired App.
  3. In Add features and functionality, click on Incoming Webhooks.

results matching ""

    No results matching ""