This guide describes how to send notifications from Zabbix 6.2 to the Telegram messenger using Telegram Bot API and Zabbix webhook feature.
- Personal and group notifications
- Markdown/HTML support
- Graphs sending - waiting for ZBXNEXT-5611
- Emoji support
2. If you want to send personal notifications, you need to obtain chat ID of the user the bot should send messages to.
Send "/getid" to "@myidbot" in Telegram messenger.
Ask the user to send "/start" to the bot, created in step 1. If you skip this step, Telegram bot won't be able to send messages to the user.
3.If you want to send group notifications, you need to obtain group ID of the group the bot should send messages to. To do so:
Add "@myidbot" and "@your_bot_name_here" to your group. Send "/getgroupid@myidbot" message in the group. In the group chat send "/start@your_bot_name_here". If you skip this step, Telegram bot won't be able to send messages to the group.
1. In the "Administration > Media types" section, import the media_telegram.yaml. 2. Configure the added media type: Copy and paste your Telegram bot token into the "telegramToken" field.
ParseMode parameter set required option according to the Telegram's documentation.
Read the Telegram Bot API documentation to learn how to format action notification messages: Markdown / HTML / MarkdownV2.
Note: in this case, your Telegram-related actions should be separated from other notification actions (for example, SMS), otherwise you may get plain text alert with raw Markdown/HTML tags.
Test the media type using chat ID or group ID you've got.
If you have forgotten to send '/start' to the bot from Telegram, you will get the following error:
3.To receive notifications in Telegram, you need to create a Zabbix user and add Media with the Telegram type. In the "Send to" field enter Telegram user chat ID or group ID obtained during Telegram setup.
Make sure the user has access to all hosts for which you would like to receive Telegram notifications.
Great, you can now start receiving Zabbix notifications in Telegram!