Telegram is a cloud-based instant messaging, video telephony and VoIP service with end-to-end encryption. Users can send messages and exchange photos, videos, stickers, audio and files of any type in Telegram. Using webhook, you can now integrate Telegram with OpManager and receive instant alerts on networks faults in your Telegram Group.
Supported Version: OpManager 12.5.192 & above
Step 1: Creating a new bot in Telegram
- In Telegram, search for BotFather. BotFather is a program that helps you create custom bots for your preferences.
- Enter the command /start.
- In the response, click on /newbot.
- Follow the responses and provide a custom name and a unique username for your bot.
- Once the bot is created, a unique <<token>> is generated which helps you control the bot.
Step 2: Providing Admin privileges to the newly created bot
- Add the newly created bot to the Group to which OpManager alerts have to be notified.
- Provide Admin privileges to the bot.
Step 3: Retrieving the <<chat_id>> and verifying the <<token>>
- Hit the request https://api.telegram.org/bot<<token>>/getUpdates in your browser.
- In the response, verify the name of your Group and copy the <<chat_id>>
- To check the <<token>>, hit the request
https://api.telegram.org/bot<<token>>/sendMessage?chat_id=<<chat_id>>&text=<<custom_message>>
- Check if the <<custom_message>> is delivered to your Telegram Group.
Step 4: Configuring webhook in OpManager
- In OpManager webclient, go to Settings > Notifications > Add Profile.
- Choose Invoke a Webhook.
- After selecting HTTP Method POST, paste the webhook URL
https://api.telegram.org/bot<<token>>/sendMessage
- Choose form_urlencoded as the DataType.
- In the Custom Parameters box,
- Type chat_id and enter its corresponding value <<chat_id>>
- Add another field text and select the required variable such as Message of the alarm.
- Click on Next.
- Select the criteria, filter the devices, and choose your Time Window for which the alerts need to be communicated to the Telegram Group.
- Finally, provide a name for the webhook notification, and click on Save.