To be able to use the integration between Unit Platform and Telegram, it’s required to create a bot that will be responsible to send the messages and a contact group to receive them.
How to create a Telegram token?
When a bot is created, Telegram will provide a token. To generate this token, follow these steps:
1) Log in to your Telegram account at https://web.telegram.org/.
Note for On-premises users: every company should have its own bot, to protect the privacy of the messages being sent.
2) Search for a user called @BotFather. The BotFather is an assistant to create bots. Click on it to start a conversation.
3) When starting a conversation, the following screen will be shown. Click START.
4) Type /newbot in the message box.
5) During the conversation, BotFather will ask a name and a username for the new bot.
The image below shows an example of a conversation. In this example, the chosen name was “MyCompanyTelegram” and the username “MyCompanyTelegramBot”. Note that the username is required to end in “bot”.
Unit Platform can only send messages to groups of contacts. To create a group, follow these steps:
Note: if you already have a group, its only needed to follow the steps 4-5.
1) Open Telegram’s main menu and click New Group.
2) Select the users that will be part of the group and click NEXT.
3) Give a name to the group and click CREATE GROUP.
4) Open the group’s properties and add the bot to the group by clicking Add member. This step is important, because the bot will not be able to send messages if it’s not a member of the group.
5) Send a message to the bot to confirm it was added to the group.
Telegram configuration on Unit Platform
First, go to the Telegram configuration page at Options > Notification configuration > Telegram Configuration.
Under Step 1 – Telegram Tokens, click “Add token”, inform the previously created token and click Save:
On the same page, under Step 2 – Telegram Groups, click “Add group”.
A popup will open and Unit will try to detect the groups the bot is a part of. In case of success, a list of groups will be available to select.
Unit Platform tries to detect the group ID using /getUpdates from the Telegram API. This detection method doesn’t always work, and in these cases the ID will have to be informed manually.
To discover the ID of your group, go to Telegram, click on the group name in the conversation list. The group URL will contain the group ID:
This ID should be placed in the “Group ID” field a name for the group should also be provided. The group name doesn’t necessarily need to match the name in Telegram.
This popup also allows to test the configuration, when clicking Test, Unit will try to send a message like this to the group:
After finishing the the steps above, you also need to activate a notification rule on Multisite Monitoring. To learn how to do that, see this post.