Source
4.3. Copy returned group id save it in the "Telegram Webhook" media for the user you created for group notifications
zabbix_export
version'7.0'
media_types
-
name Telegram
type WEBHOOK
parameters
-
name Message
value'{ALERT.MESSAGE}'
-
name ParseMode
value''
-
name Subject
value'{ALERT.SUBJECT}'
-
name To
value'{ALERT.SENDTO}'
-
name Token
value'<PLACE YOUR TOKEN>'
script
var Telegram = {
token: null,
to: null,
message: null,
proxy: null,
parse_mode: null,
escapeMarkup: function (str, mode) {
switch (mode) {
case 'markdown':
return str.replace(/([_*\[`])/g, '\\$&');
case 'markdownv2':
return str.replace(/([_*\[\]()~`>#+\-=|{}.!])/g, '\\$&');
case 'html':
return str.replace(/<(\s|[^a-z\/])/g, '<$1');
default:
return str;
}
},
sendMessage: function () {
var params = {
chat_id: Telegram.to,
text: Telegram.message,
disable_web_page_preview: true,
disable_notification: false
},
data,
response,
request = new HttpRequest(),
url = 'https://api.telegram.org/bot' + Telegram.token + '/sendMessage';
if (Telegram.parse_mode !== null) {
params['parse_mode'] = Telegram.parse_mode;
}
if (Telegram.proxy) {