Send telegram messages from Mikrotik RouterOS

If you are here you probably already know what telegram is. If not you can read about it here.

I created a simple script (SendToTelegram) that allows you to send messages to telegram:

:global telegramMessage
:local botid
:local chatid

set botid "sdfzgasf7126jwsd7a8s12>" # <- change this
set chatid "21156423187"            # <- change this

if ($telegramMessage != "") do={
   /tool fetch url="https://api.telegram.org/bot$botid/sendMessage\?chat_id=$chatid&text=$telegramMessage" keep-result=no
   set telegramMessage ""
}

Usage:

set your message to telegramMessage global variable

global telegramMessage "Wolfy was here"

run script

/system script run SendToTelegram

You can use this in combination with netwach:

you should recieve a message to your telegram :)

No Comments Yet.

Leave a Comment