Skip to main content

Telegram notification script for Mikrotik

Sometimes the simpliest thing could offer a lot of advantages.

To use this script you will need a Telegram Bot. It’s very simple and you dont need to do anything special to create a bot by yourself. Here you will find all that you need to create your first bot.

To get the Chat ID you need to send a message to your bot in a group and access this address with your Bot Token:

https://api.telegram.org/bot<YourBOTToken>/getUpdates

You will see a JSON object… look for the CHAT object.

Now, let’s talk about the script…

You can just download this script into your files and use it to send all kind of notifications directly to you via Telegram or to some specific group.

This script is pretty simple. All you need to do is set a global variable with your Bot Token (provided by BotFather) and another global var with your Chat ID. Every time that you call the script, you just need to set a global variable with the message.

Here an example:

:set TelegramMessage "Here is my message"; /import "scripts/telegram.rsc"

Pretty simple right? Now imagine all kind of scenarios that you can use this… the sky’s the limit.

This script is on my GitHub, so you can copy or donload it directly to your Mikrotik.

/tool fetch url=https://raw.githubusercontent.com/rz3n/mikrotik-scripts/master/telegram-notifications.rsc

After use the script, you just need to set those two global variables:

:global TelegramBotToken
:global TelegramChatID

I hope this script could be useful for your projects.