mirror of
https://git.eworm.de/cgit/routeros-scripts
synced 2025-07-22 03:44:59 +02:00
global-functions: add identity tag in $SendNotification
... and send subject in telegram message.
This commit is contained in:
parent
c4f8c1ad52
commit
6e4d715937
9 changed files with 13 additions and 11 deletions
|
@ -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!";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue