Currently it’s not possible to use HTTP POST method from Dude/RouterOS, so here is some workaround example how to use Telegram, to send messages using HTTP GET method:
http://wiki.mikrotik.com/wiki/Manual:The_Dude_v6/Dude_Telegram_Example
Suggestions / requests will be appreciated.
turnip
January 10, 2017, 12:58am
2
That’s a great solution… I’m having trouble though - I can run the /tool fetch command from the command line and it works fine, but nothing happens when I run it from The Dude. I’ve tried pressing Test, and I’ve tried unplugging a router to see what happens, and the command never executes. Can’t see anything in the logs. Any ideas?
turnip
January 10, 2017, 2:23am
3
Never mind, just noticed this:
Changes in v6.39rc7:
*) Fixed - Tool fetch didn’t work with notification - execute on server
Upgrading now
turnip:
Never mind, just noticed this:
Changes in v6.39rc7:
*) Fixed - Tool fetch didn’t work with notification - execute on server
Upgrading now
OR
:execute {/tool fetch url="https://api.telegram.org/botXXXXXX:AsG7sapGXDS1aHi_RllzgU9oJUm2wyKyHVw/sendMessage\?chat_id=1231231&text=[TimeAndDate] Service [Probe.Name] on [Device.Name] ([Device.CustomField1] - [Device.CustomField2]) is now [Service.Status] ([Service.ProblemDescription])" keep-result=no}
this option works for older versions
dricks
February 15, 2017, 6:21am
5
I configured all and is working!!!
Correct code for Version 6.38.1 - Please update de wiki
/tool fetch url="https://api.telegram.org/botXXXXXXX:AAFZJtaHT_of7tV9IPEyK9R9XXXXFtk9_Ap-Pvk/sendMessage\?chat_id=XXXXXX&text=[TimeAndDate] Nodo: [Device.Name], Status: [Service.Status]" keep-result=no
Gretting
Pablo
Sorry for my bad English
amt
February 22, 2017, 11:44am
6
Hi,
what should be the chat_id= ??
thanks
after creating the bot you can write to him. from browser you can see the id of this chat (you can use https://api.telegram.org/botXXXXXXXXXXXXXXXXXX/getUpdates )
You should find “«chat»:{«id»:YYYYYYY”
YYYYYYY - is your chat_id
amt
February 22, 2017, 1:35pm
8
thank you verymuch… its work. I would like to ask another question, is possible to do this on viber also ?
Thanks.
yes you can. +37544five44340five
tamigi
February 27, 2017, 5:57pm
10
What’s the problem in settings .
tomasi
March 1, 2017, 8:23pm
11
Hi,
I’ve tested the hyperlink, that it’s inside the fetch command:
https://api.telegram.org/bot123456789:AAQFb1byb3LEwMes_TQeCM1k5wsFb_VguhG/sendMessage\?chat_id=123456789&text=Hello
But It doesn’t even send the Hello message to the group the bot is participating.
The webpage says: “{“ok”:false,“error_code”:404,“description”:“Not Found: method not found”}”
In Mikrotik terminal, it says: failure: closing connection: <400 Bad Request> 149.154.167.200:443 (4)
Am I doing something wrong? Do I need any additional step to allow the bot start a message?
Thanks!
What do you think of adapting the dude to send messages through Whatsapp it is much more popular than the telegran.
amt:
or viber…
You can do the same with Viber. Use a Viber “Public Account”. I haven’t tried yet as it’s only available for selected countries.
Telegram is so far the easiest and most accessible.
tomasi:
Hi,
I’ve tested the hyperlink, that it’s inside the fetch command:
https://api.telegram.org/bot123456789:AAQFb1byb3LEwMes_TQeCM1k5wsFb_VguhG/sendMessage\?chat_id=123456789&text=Hello
But It doesn’t even send the Hello message to the group the bot is participating.
The webpage says: “{“ok”:false,“error_code”:404,“description”:“Not Found: method not found”}”
In Mikrotik terminal, it says: failure: closing connection: <400 Bad Request> 149.154.167.200:443 (4)
Am I doing something wrong? Do I need any additional step to allow the bot start a message?
Thanks!
/tool fetch url="https://api.telegram.org/botxxxxxxxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/sendmessage?chat_id=xxxxxx&text=Hi" keep-result=no
marnem
March 3, 2017, 4:13pm
16
/tool fetch url="https://api.telegram.org/bot<tokenbot>?chat_id=-1001099321185&text=[RECOVER] [TimeAndDate]; [Device.Name]: [Device.FirstAddress]; Status: [Service.Status] ([Service.ProblemDescription])" keep-result=no
for me this work… in my situation i’ve created a channel with other my coworker…this is a great solution for notification, very reactive!
and then you can evolute your bot with some scripts, notification db ecc.ecc.
great thing
tomasi
April 25, 2017, 6:16pm
18
The issue was fixed, adding a minus sign before the chat ID:
before:
https://api.telegram.org/bot123456789:AAQFb1byb3LEwMes_TQeCM1k5wsFb_VguhG/sendMessage\?chat_id=123456789&text=Hello
after:
https://api.telegram.org/bot123456789:AAQFb1byb3LEwMes_TQeCM1k5wsFb_VguhG/sendMessage\?chat_id=-123456789&text=Hello
joca
May 4, 2017, 12:25pm
19
tomasi:
The issue was fixed, adding a minus sign before the chat ID:
before:
https://api.telegram.org/bot123456789:AAQFb1byb3LEwMes_TQeCM1k5wsFb_VguhG/sendMessage\?chat_id=123456789&text=Hello
after:
https://api.telegram.org/bot123456789:AAQFb1byb3LEwMes_TQeCM1k5wsFb_VguhG/sendMessage\?chat_id=-123456789&text=Hello
remove \ from “sendMessage?chat_id=”
alisc
July 27, 2017, 4:29pm
20
hi
how to send file ( backup file ) via Telegram ?