Send message to your Phone from Mikrotik with Telegram

NC

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".

Send message to your Phone from Mikrotik with Telegram

Put Google public DNS server IP: "8.8.8.8" and "8.8.4.4" in Servers input box.

Send message to your Phone from Mikrotik with Telegram

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.

Send message to your Phone from Mikrotik with Telegram

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.

Send message to your Phone from Mikrotik with Telegram

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.

Send message to your Phone from Mikrotik with Telegram

Configure netwatch

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.

Send message to your Phone from Mikrotik with Telegram

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.

Send message to your Phone from Mikrotik with Telegram

Every time the server changes from up to down state or vice versa, it sends a notification to your phone.

Facebook: https://www.facebook.com/routerbest

Twitter: https://twitter.com/routerbestcom

Tags: Mikrotik Telegram