From 6e4d7159378259a521e467504509de871381d078 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Tue, 27 Nov 2018 14:08:14 +0100 Subject: global-functions: add identity tag in $SendNotification ... and send subject in telegram message. --- global-functions | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'global-functions') diff --git a/global-functions b/global-functions index 5f38150..ff689d8 100644 --- a/global-functions +++ b/global-functions @@ -61,6 +61,7 @@ :local message [ :tostr $2 ]; :local attach [ :tostr $3 ]; + :global "identity"; :global "email-general-to"; :global "email-general-cc"; :global "telegram-tokenid"; @@ -72,7 +73,7 @@ :if ([ :len $"email-general-to" ] > 0) do={ :do { / tool e-mail send to=$"email-general-to" cc=$"email-general-cc" \ - subject=$subject body=$message file=$attach; + subject=("[" . $"identity" . "] " . $subject) body=$message file=$attach; } on-error={ :log warning "Failed sending notification mail!"; } @@ -83,7 +84,8 @@ :do { / tool fetch check-certificate=yes-without-crl keep-result=no http-method=post \ ("https://api.telegram.org/bot" . $"telegram-tokenid" . "/sendMessage") \ - http-data=("chat_id=" . $"telegram-chatid" . "&text=" . [ $UrlEncode $message ]); + http-data=("chat_id=" . $"telegram-chatid" . "&text=" . \ + [ $UrlEncode ("[" . $"identity" . "] " . $subject . "\n\n" . $message) ]); } on-error={ :log warning "Failed sending telegram notification!"; } -- cgit v1.2.3-54-g00ecf