Integrating Telegram with Applications Manager using Webhook
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 Applications Manager and receive instant alerts on networks faults in your Telegram Group.
Follow the steps given below to integrate Telegram through Webhook:
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 Applications Manager 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 following request:
- Check if the <<custom_message>> is delivered to your Telegram Group.
Step 4: Configuring Webhook in Applications Manager
- In Applications Manager web client, go to Actions > Webhook / REST API action.
- In HTTP(s) URL textbox, enter the following Webhook URL:
- Choose the Form Submission Method as POST.
- Choose the PayLoad Type as FORM.
- In the Custom Parameters box, enter the following details:
- Enter the key chat_id and its corresponding value <<chat_id>>.
- Add another custom parameter using the [+] button.
- Enter the key text and select the required variable such as Message of the alarm.
- Enter the remaining fields such as Request Headers, User Agent, Authentication Method, etc., if required.
- Select the email ID in Notify after action execution for both success and failure conditions to receive notifications, if required.
- Finally, enter the Timeout value and click on Create Action.