Integrating Telegram with Applications Manager using Webhook

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

  1. In Telegram, search for BotFather. BotFather is a program that helps you create custom bots for your preferences.
  2. Enter the command /start.
  3. In the response, click on /newbot.
  4. Follow the responses and provide a custom name and a unique username for your bot.
  5. 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

  1. Add the newly created bot to the Group to which Applications Manager alerts have to be notified.
  2. Provide Admin privileges to the bot.

Step 3: Retrieving the <<chat_id>> and verifying the <<token>>

  1. Hit the request https://api.telegram.org/bot<<token>>/getUpdates in your browser.
  2. In the response, verify the name of your Group and copy the <<chat_id>>
  3. To check the <<token>>, hit the following request:
    https://api.telegram.org/bot<<token>>/sendMessage?chat_id=<<chat_id>>&text=<<custom_message>>
  4. Check if the <<custom_message>> is delivered to your Telegram Group.

Step 4: Configuring Webhook in Applications Manager

  1. In Applications Manager web client, go to Actions > Webhook / REST API action.
  2. In HTTP(s) URL textbox, enter the following Webhook URL:
    https://api.telegram.org/bot<<token>>/sendMessage
  3. Choose the Form Submission Method as POST. 
  4. Choose the PayLoad Type as FORM.
  5. In the Custom Parameters box, enter the following details:
    1. Enter the key chat_id and its corresponding value <<chat_id>>.
    2. Add another custom parameter using the [+] button.
    3. Enter the key text and select the required variable such as Message of the alarm.
  6. Enter the remaining fields such as Request Headers, User Agent, Authentication Method, etc., if required.
  7. Select the email ID in Notify after action execution for both success and failure conditions to receive notifications, if required.
  8. Finally, enter the Timeout value and click on Create Action.