Global script (go to /system script) name - SendTelegram
:global telegramMessage
:local botid
:local chatid
set botid "TOKEN"
set chatid "USERID"
if ($telegramMessage != "") do={
/tool fetch url="https://api.telegram.org/bot$botid/sendMessage\?chat_id=$chatid&text=$telegramMessage" keep-result=no
set telegramMessage ""
}
:local botid
:local chatid
set botid "TOKEN"
set chatid "USERID"
if ($telegramMessage != "") do={
/tool fetch url="https://api.telegram.org/bot$botid/sendMessage\?chat_id=$chatid&text=$telegramMessage" keep-result=no
set telegramMessage ""
}
Up script in the ppp profile
global telegramMessage
:local conTime [:tostr [/system clock get time]]
:local conDate [:tostr [/system clock get date]]
:local remoteAddr
:local callerId
:set remoteAddr $"remote-address"
:set callerId $"caller-id"
:set telegramMessage "Connected $user from $callerId with ip $remoteAddr at $conDate $conTime"
/system script run SendTelegram
Down script in the ppp profile
global telegramMessage
:local conTime [:tostr [/system clock get time]]
:local conDate [:tostr [/system clock get date]]
:local remoteAddr
:local callerId
:set remoteAddr $"remote-address"
:set callerId $"caller-id"
:set telegramMessage "Disconnected $user from $callerId with ip $remoteAddr at $conDate $conTime"
/system script run SendTelegram