In this article, I will show you how to send notification messages to your phone from your mikrotik router with telegram.
Configure the DNS for the mikrotik router
Go to "IP" > "DNS".
Put Google public DNS server IP: "188.8.131.52" and "184.108.40.206" in Servers input box.
Create a telegram bot
Open telegram messenger.
Enter "Botfather" in the search tab and choose this bot.
Choose or type the "/newbot" command and send it.
Choose a name for your bot. The username must be unique and end with the word "bot". Copy your token value to use in the next step.
create a new group from the menu
Find the bot, and add bot to new group. Click "Next" button, find a chat ID in Telegram.
Go to web.telegram.org
Open your group chat, and look at the URL at the top of the screen. The last digits are your chat ID, copy your chat ID value to use in the next step.
Go to "Tools" > "Netwatch".
Netwatch monitor state of hosts on the network. It does so by sending icmp pings to the list of specified IP addresses.
Host enter the IP address of the desired destination in this field. We will use net watch to send message every time the server changes state.
Next configure message sending in case the server is up or down, You add the token information and chat ID obtained in the previous step to configure netwatch. You can copy the code here:
:log info "send message to your phone"
/tool fetch url="https://api.telegram.org/bot<TOKEN>/sendMessage?chat_id=<CHAT_ID>&text=YourMessage"
After the configuration is complete, we will see the results.
Every time the server changes from up to down state or vice versa, it sends a notification to your phone.