Community discussions

MikroTik App
 
User avatar
PaulsMT
MikroTik Support
MikroTik Support
Topic Author
Posts: 282
Joined: Tue Feb 10, 2015 3:21 pm

Dude Telegram notification example

Mon Jan 09, 2017 10:59 am

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:Th ... am_Example

Suggestions / requests will be appreciated.
 
turnip
Frequent Visitor
Frequent Visitor
Posts: 89
Joined: Wed Sep 11, 2013 7:01 pm

Re: Dude Telegram notification example

Tue Jan 10, 2017 2:58 am

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
Frequent Visitor
Frequent Visitor
Posts: 89
Joined: Wed Sep 11, 2013 7:01 pm

Re: Dude Telegram notification example

Tue Jan 10, 2017 4:23 am

Never mind, just noticed this:
Changes in v6.39rc7:

*) Fixed - Tool fetch didn't work with notification - execute on server

Upgrading now
 
sparker
just joined
Posts: 23
Joined: Mon Jan 23, 2012 5:48 pm
Location: Russia / Chelyabinsk

Re: Dude Telegram notification example

Wed Jan 18, 2017 7:42 am

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
just joined
Posts: 15
Joined: Fri Jan 08, 2010 7:31 pm
Location: Embarcacion

Re: Dude Telegram notification example

Wed Feb 15, 2017 8:21 am

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
 
User avatar
amt
Long time Member
Long time Member
Posts: 529
Joined: Fri Jan 16, 2015 2:05 pm

Re: Dude Telegram notification example

Wed Feb 22, 2017 1:44 pm

Hi,

what should be the chat_id= ??

thanks
 
Shadeofspirit
Member Candidate
Member Candidate
Posts: 203
Joined: Fri May 27, 2016 12:15 am
Location: Minsk
Contact:

Re: Dude Telegram notification example

Wed Feb 22, 2017 2:02 pm

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/botXXXXXXXXXXX ... getUpdates )
You should find "«chat»:{«id»:YYYYYYY"
YYYYYYY - is your chat_id
 
User avatar
amt
Long time Member
Long time Member
Posts: 529
Joined: Fri Jan 16, 2015 2:05 pm

Re: Dude Telegram notification example

Wed Feb 22, 2017 3:35 pm

thank you verymuch... its work. I would like to ask another question, is possible to do this on viber also ?

Thanks.
 
Shadeofspirit
Member Candidate
Member Candidate
Posts: 203
Joined: Fri May 27, 2016 12:15 am
Location: Minsk
Contact:

Re: Dude Telegram notification example

Thu Feb 23, 2017 3:26 pm

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
 
User avatar
tamigi
just joined
Posts: 4
Joined: Thu Jan 26, 2017 10:39 am
Contact:

Re: Dude Telegram notification example

Mon Feb 27, 2017 7:57 pm

What's the problem in settings .

Image
 
User avatar
tomasi
Frequent Visitor
Frequent Visitor
Posts: 99
Joined: Fri Oct 03, 2014 6:40 pm
Location: Brazil
Contact:

Re: Dude Telegram notification example

Wed Mar 01, 2017 10:23 pm

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! :?
 
User avatar
FlavioCamacho
Trainer
Trainer
Posts: 33
Joined: Tue Jun 24, 2014 7:39 am
Location: Rio de Janeiro - Brasil
Contact:

Re: Dude Telegram notification example

Thu Mar 02, 2017 2:53 am

What do you think of adapting the dude to send messages through Whatsapp it is much more popular than the telegran.
 
User avatar
amt
Long time Member
Long time Member
Posts: 529
Joined: Fri Jan 16, 2015 2:05 pm

Re: Dude Telegram notification example

Thu Mar 02, 2017 10:24 am

What do you think of adapting the dude to send messages through Whatsapp it is much more popular than the telegran.
or viber...
 
User avatar
soonwai
Member Candidate
Member Candidate
Posts: 188
Joined: Mon Feb 06, 2012 10:50 pm
Location: Kuala Lumpur

Re: Dude Telegram notification example

Thu Mar 02, 2017 6:28 pm

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.
 
irghost
Member
Member
Posts: 308
Joined: Sun Feb 21, 2016 1:49 pm

Re: Dude Telegram notification example

Thu Mar 02, 2017 7:24 pm

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
just joined
Posts: 2
Joined: Fri Mar 03, 2017 6:09 pm

Re: Dude Telegram notification example

Fri Mar 03, 2017 6:13 pm

/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
 
vinu
newbie
Posts: 42
Joined: Sun Mar 05, 2017 8:09 pm
Location: India

Re: Dude Telegram notification example

Sun Apr 23, 2017 7:38 pm

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! :?

HI
issue fixed??
 
User avatar
tomasi
Frequent Visitor
Frequent Visitor
Posts: 99
Joined: Fri Oct 03, 2014 6:40 pm
Location: Brazil
Contact:

Re: Dude Telegram notification example

Tue Apr 25, 2017 9:16 pm

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
just joined
Posts: 2
Joined: Sun Aug 26, 2012 1:29 am

Re: Dude Telegram notification example

Thu May 04, 2017 3:25 pm

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
Frequent Visitor
Frequent Visitor
Posts: 60
Joined: Thu Dec 01, 2011 10:51 am

Re: Dude Telegram notification example

Thu Jul 27, 2017 7:29 pm

hi
how to send file ( backup file ) via Telegram ?
 
Morcegolas
just joined
Posts: 4
Joined: Sat Jul 29, 2017 4:29 am

Re: Dude Telegram notification example

Sun Jul 30, 2017 8:23 pm

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
I tried this with RouterOS and I receive the messages on telegram, but not the time, device name and status, maybe because in RouterOS its difrent from Dude, is there any chance to get this working also on RouterOS?
hi
how to send file ( backup file ) via Telegram ?
I have automated backups and also like the option to send send via telegram, automated or via command in telegram.

Thanks.
 
Morcegolas
just joined
Posts: 4
Joined: Sat Jul 29, 2017 4:29 am

Re: Dude Telegram notification example

Fri Aug 04, 2017 12:14 am

I already tried so send the file with the two following commands, but get the error code 404, I think the URL is wrong, no ones knows how to send the backup file to telegram?

/tool fetch url="https://api.telegram.org/bot<MyBotApi>/ ... day.backup” keep-result=no

/tool fetch url="https://api.telegram.org/bot<MyBotApi>/ ... day.backup” keep-result=no

Thanks.
 
gangz
just joined
Posts: 6
Joined: Mon Feb 13, 2017 9:53 am

Re: Dude Telegram notification example

Thu Aug 17, 2017 2:06 pm

Hi all!

May be it is offtopic, but i am using telegram notifications from my CCR (not Dude) whrough this URL:
/tool fetch url="https://api.telegram.org/bot<BotToken>/ ... id=<ChatId with "-">&text=Very_Impotant_Tunnel_Up"

Also, I wrote an article about this, but it is on russian...
https://www.1spla.ru/blog/telegram_bot_for_mikrotik
 
User avatar
indjov
just joined
Posts: 20
Joined: Fri Jun 03, 2016 12:23 pm

Re: Dude Telegram notification example

Tue Sep 12, 2017 4:07 pm

That script will work with NetWacht?
 
alisc
Frequent Visitor
Frequent Visitor
Posts: 60
Joined: Thu Dec 01, 2011 10:51 am

Re: Dude Telegram notification example

Tue Sep 12, 2017 9:10 pm

How to call admin number ?
 
alisc
Frequent Visitor
Frequent Visitor
Posts: 60
Joined: Thu Dec 01, 2011 10:51 am

Re: Dude Telegram notification example

Tue Sep 19, 2017 7:42 pm

Do you have a solution to call admins when it event?
 
User avatar
amt
Long time Member
Long time Member
Posts: 529
Joined: Fri Jan 16, 2015 2:05 pm

Re: Dude Telegram notification example

Wed Sep 20, 2017 12:24 am

That script will work with NetWacht?
Yes.. you can use it at netwatch
 
benjamimgois
Frequent Visitor
Frequent Visitor
Posts: 80
Joined: Fri May 18, 2012 10:36 pm

Re: Dude Telegram notification example

Tue Oct 10, 2017 9:56 pm

I have followed the instructions but it doesn´t work. To see what´s happening i tried the fetch command on the command line but i always receive the following error:
[admin@Dude_x86] > /tool fetch url="https://api.telegram.org/bot<TOKEN_BOT>\?chat_id=348399094&text=HelloWorld!" keep-result=no
  status: failed

failure: closing connection: <502 Bad Gateway> 149.154.167.200:443 (4)
Any ideas ???
 
Shadeofspirit
Member Candidate
Member Candidate
Posts: 203
Joined: Fri May 27, 2016 12:15 am
Location: Minsk
Contact:

Re: Dude Telegram notification example

Tue Oct 10, 2017 10:03 pm

I have followed the instructions but it doesn´t work. To see what´s happening i tried the fetch command on the command line but i always receive the following error:
[admin@Dude_x86] > /tool fetch url="https://api.telegram.org/bot<TOKEN_BOT>\?chat_id=348399094&text=HelloWorld!" keep-result=no
  status: failed

failure: closing connection: <502 Bad Gateway> 149.154.167.200:443 (4)
Any ideas ???
it looks like you had made a mistake in token)
 
Shadeofspirit
Member Candidate
Member Candidate
Posts: 203
Joined: Fri May 27, 2016 12:15 am
Location: Minsk
Contact:

Re: Dude Telegram notification example

Tue Oct 10, 2017 10:07 pm

I have followed the instructions but it doesn´t work. To see what´s happening i tried the fetch command on the command line but i always receive the following error:
[admin@Dude_x86] > /tool fetch url="https://api.telegram.org/bot<TOKEN_BOT>\?chat_id=348399094&text=HelloWorld!" keep-result=no
  status: failed

failure: closing connection: <502 Bad Gateway> 149.154.167.200:443 (4)
Any ideas ???
the command to send is:
/tool fetch url="https://api.telegram.org/botXXXXX:YYYYY ... text=Hello World" keep-result=no
where XXXXX is your bot id
YYYYY bot token
ZZZZZ chat id
 
benjamimgois
Frequent Visitor
Frequent Visitor
Posts: 80
Joined: Fri May 18, 2012 10:36 pm

Re: Dude Telegram notification example

Tue Oct 10, 2017 10:50 pm

the command to send is:
/tool fetch url="https://api.telegram.org/botXXXXX:YYYYY ... text=Hello World" keep-result=no
where XXXXX is your bot id
YYYYY bot token
ZZZZZ chat id
Sorry man, i didn´t write it right on the last post, but that´s exactly what i typed... I was calling token the entire <BOT_ID>:<BOT_TOKEN> ... my mistake. I created the bot using botfather and followed the tutorial, i still got the 502 bad gateway error.
/tool fetch url="https://api.telegram.org/bot<BOT_ID>:<BOT_TOKEN>\?chat_id=348399094&text=Hello World !" keep-result=no
What am i doing wrong ?
 
Shadeofspirit
Member Candidate
Member Candidate
Posts: 203
Joined: Fri May 27, 2016 12:15 am
Location: Minsk
Contact:

Re: Dude Telegram notification example

Tue Oct 10, 2017 10:54 pm

the command to send is:
/tool fetch url="https://api.telegram.org/botXXXXX:YYYYY ... text=Hello World" keep-result=no
where XXXXX is your bot id
YYYYY bot token
ZZZZZ chat id
Sorry man, i didn´t write it right on the last post, but that´s exactly what i typed... I was calling token the entire <BOT_ID>:<BOT_TOKEN> ... my mistake. I created the bot using botfather and followed the tutorial, i still got the 502 bad gateway error.
/tool fetch url="https://api.telegram.org/bot<BOT_ID>:<BOT_TOKEN>\?chat_id=348399094&text=Hello World !" keep-result=no
What am i doing wrong ?
first of all:
/sendMessage? before chat_id
the second is, that you can use it in script (create test scrip with only command to send message), because from command line on mikrotik it wouldn't work
 
benjamimgois
Frequent Visitor
Frequent Visitor
Posts: 80
Joined: Fri May 18, 2012 10:36 pm

Re: Dude Telegram notification example

Wed Oct 11, 2017 2:49 pm

first of all:
/sendMessage? before chat_id
the second is, that you can use it in script (create test scrip with only command to send message), because from command line on mikrotik it wouldn't work
So the line should look like this ?
/tool fetch url="https://api.telegram.org/bot<BOT_ID>:<BOT_TOKEN>/sendMessage?=Hello World\?chat_id=348399094" keep-result=no
 
Shadeofspirit
Member Candidate
Member Candidate
Posts: 203
Joined: Fri May 27, 2016 12:15 am
Location: Minsk
Contact:

Re: Dude Telegram notification example

Wed Oct 11, 2017 2:58 pm

first of all:
/sendMessage? before chat_id
the second is, that you can use it in script (create test scrip with only command to send message), because from command line on mikrotik it wouldn't work
So the line should look like this ?
/tool fetch url="https://api.telegram.org/bot<BOT_ID>:<BOT_TOKEN>/sendMessage?=Hello World\?chat_id=348399094" keep-result=no
no, as i had posted:
/tool fetch url="https://api.telegram.org/botXXXXX:YYYYY/sendMessage?chat_id=ZZZZZ&text=Hello World" keep-result=no
 
benjamimgois
Frequent Visitor
Frequent Visitor
Posts: 80
Joined: Fri May 18, 2012 10:36 pm

Re: Dude Telegram notification example

Wed Oct 11, 2017 4:55 pm

first of all:
/sendMessage? before chat_id
the second is, that you can use it in script (create test scrip with only command to send message), because from command line on mikrotik it wouldn't work
So the line should look like this ?
/tool fetch url="https://api.telegram.org/bot<BOT_ID>:<BOT_TOKEN>/sendMessage?=Hello World\?chat_id=348399094" keep-result=no
no, as i had posted:
/tool fetch url="https://api.telegram.org/botXXXXX:YYYYY/sendMessage?chat_id=ZZZZZ&text=Hello World" keep-result=no
Well, i tried as you said and now i receive a 404 not found error message. Now i´m posting my bot ID and TOKEN.
[admin@Dude_x86] > /tool fetch url="https://api.telegram.org/bot<BOT_ID>:<BOT_TOKEN=Hello World" keep-result=no
  status: failed

failure: closing connection: <404 Not Found> 149.154.167.198:443 (4)
When i type the URL https://api.telegram.org/bot<BOT_ID>:<BOT_TOKEN/getme on the browser followed by the "getme " i got the following statement
{"ok":true,"result":{"id":BOT_ID,"is_bot":true,"first_name":"xxxx","username":"xxxxxxx"}}
What am i missing here ?
Last edited by benjamimgois on Wed Oct 11, 2017 6:14 pm, edited 1 time in total.
 
Shadeofspirit
Member Candidate
Member Candidate
Posts: 203
Joined: Fri May 27, 2016 12:15 am
Location: Minsk
Contact:

Re: Dude Telegram notification example

Wed Oct 11, 2017 5:17 pm


What am i missing here ?
Please, write there if you get message in telegram.
If you get - all is correct in your config.
read my previous message - this command can be used in script, but not in command line
 
benjamimgois
Frequent Visitor
Frequent Visitor
Posts: 80
Joined: Fri May 18, 2012 10:36 pm

Re: Dude Telegram notification example

Wed Oct 11, 2017 5:29 pm


What am i missing here ?
Please, write there if you get message in telegram.
If you get - all is correct in your config.
read my previous message - this command can be used in script, but not in command line
Shadeofspirit, i receive your message. Thanks for the help man, i´ll try it on a script as you said.

I worked !!! Thanks for the help Shade !
Last edited by benjamimgois on Wed Oct 11, 2017 6:12 pm, edited 1 time in total.
 
Shadeofspirit
Member Candidate
Member Candidate
Posts: 203
Joined: Fri May 27, 2016 12:15 am
Location: Minsk
Contact:

Re: Dude Telegram notification example

Wed Oct 11, 2017 5:34 pm


Shadeofspirit, i receive your message. Thanks for the help man, i´ll try it on a script as you said.
if you want, i can send you script that i used for sending message by skype, telegram, viber, e-mail
and i suggest you to delete your message on forum with your bot token
 
benjamimgois
Frequent Visitor
Frequent Visitor
Posts: 80
Joined: Fri May 18, 2012 10:36 pm

Re: Dude Telegram notification example

Wed Oct 11, 2017 6:15 pm


Shadeofspirit, i receive your message. Thanks for the help man, i´ll try it on a script as you said.
if you want, i can send you script that i used for sending message by skype, telegram, viber, e-mail
and i suggest you to delete your message on forum with your bot token
Yes, could you send me please ? you can post it here on the forum or by gmail if you prefer

benjamim.gois@gmail.com
 
icecybe
just joined
Posts: 23
Joined: Thu Nov 26, 2009 1:13 am

Re: Dude Telegram notification example

Tue Oct 24, 2017 1:45 pm

Hi hi, team.
I'm stuck on same problem, or similar to this one.
When i test dude notification all working ok, but when some switch in dude lost , the chat bot is silent.
And i dont know where can be the mistake, because all is working but bot in the chat sleeping :)
Any information needed ?
 
Shadeofspirit
Member Candidate
Member Candidate
Posts: 203
Joined: Fri May 27, 2016 12:15 am
Location: Minsk
Contact:

Re: Dude Telegram notification example

Tue Oct 24, 2017 2:00 pm

Hi hi, team.
I'm stuck on same problem, or similar to this one.
When i test dude notification all working ok, but when some switch in dude lost , the chat bot is silent.
And i dont know where can be the mistake, because all is working but bot in the chat sleeping :)
Any information needed ?
did you select this type of notification for this device?
 
icecybe
just joined
Posts: 23
Joined: Thu Nov 26, 2009 1:13 am

Re: Dude Telegram notification example

Tue Oct 24, 2017 2:37 pm

You mean in : Notification > Advanced tab ? Yes click them all. Is there anywhere else i can check them ?
 
icecybe
just joined
Posts: 23
Joined: Thu Nov 26, 2009 1:13 am

Re: Dude Telegram notification example

Tue Oct 24, 2017 2:39 pm

/tool fetch url="https://api.telegram.org/botxxxxxxxxx:y ... 1212&text=[Probe.Name] on [Device.Name] now [Service.Status] ([Service.ProblemDescription])"
It work's when i try test, it send's message in chat, but when swich drop nothing happens
 
Shadeofspirit
Member Candidate
Member Candidate
Posts: 203
Joined: Fri May 27, 2016 12:15 am
Location: Minsk
Contact:

Re: Dude Telegram notification example

Tue Oct 24, 2017 2:56 pm

/tool fetch url="https://api.telegram.org/botxxxxxxxxx:y ... 1212&text=[Probe.Name] on [Device.Name] now [Service.Status] ([Service.ProblemDescription])"
It work's when i try test, it send's message in chat, but when swich drop nothing happens
so, if you had created it notifications for all status changing you want(for example with name "telegram"), than, if you want to have it for all devices. go to settings-polling. make sure that "enabled" is marked and that in the list of notifications there is mark near "telegram"
if you want to have it only for particular device: open this device, polling. make sure that there are marks near "polling", 'use notifications' and 'telegram'
 
icecybe
just joined
Posts: 23
Joined: Thu Nov 26, 2009 1:13 am

Re: Dude Telegram notification example

Tue Oct 24, 2017 3:18 pm

Damn Dude !!! You are a genious.
Thank's a lot for this small but HUGE help. It work's
 
tangram
Member Candidate
Member Candidate
Posts: 132
Joined: Wed Nov 16, 2016 9:55 pm

Re: Dude Telegram notification example

Sun Mar 04, 2018 9:55 am

Why does the ? disappear when you paste in terminal ?

/tool fetch "https://api.telegram.org/botblablabla/s ... thissatest" keep-result=no
turns to /tool fetch "https://api.telegram.org/botblablabla/s ... thissatest" keep-result=no ..can't even write it manually.

This command in terminal fails. I had to make a script just to make it work - don't know yet if you can use this as a global variable.
 
Bc234
just joined
Posts: 1
Joined: Fri May 11, 2018 11:45 pm

Re: Dude Telegram notification example

Sun May 13, 2018 10:10 pm

Hai all.. i have ros 6.41.2 on ccr.. notif from netwatch run.. but when notif from dude.. nothing happen.. any sugestion ?

Thanks

Sent from my HTC One_E8 dual sim using Tapatalk

 
User avatar
blackhold
just joined
Posts: 11
Joined: Tue Apr 15, 2014 3:12 am
Location: Catalonia
Contact:

Re: Dude Telegram notification example

Mon May 14, 2018 9:29 pm

Hi,
I have configured telegram notifications on dude and the manual have an error

https://wiki.mikrotik.com/wiki/Manual:T ... am_Example

the correct example would be

/tool fetch url="https://api.telegram.org/bot309683994:A ... pleMessage" keep-result=no

instead of:

/tool fetch url="https://api.telegram.org/bot309683994:A ... pleMessage" keep-result=no

you have to add "-" sign before chat_id number.
 
jessequijano
newbie
Posts: 28
Joined: Sat Nov 13, 2010 10:14 pm

Re: Dude Telegram notification example

Sat Jun 09, 2018 3:38 am

Any chance to refine this example to include some way for it to check the previous state of the device? or maybe suggestions on increasing my tiggers to avoid getting repetitive "up" status messages when I have never received any down messages on that device? dont get me wrong... I get correct down messages when things actually go down (I only probe with ping and routeros management(when it is an RB)) but I get repetitive up messages.

honestly if there was a way to ONLY get down messages id be fine with that also

edit: duh!!!!! just looked at dude and i can remove "up" messages.
 
vitorbessa
just joined
Posts: 1
Joined: Mon Sep 24, 2018 1:55 am

Re: Dude Telegram notification example

Mon Sep 24, 2018 2:01 am

The problem is at the moment of entering the interrogation (?), Mikrotik exchanges "sendMessage? Chat_id" with "sendMessagechat_id".

Forgive me for my English.
 
3rcom
just joined
Posts: 5
Joined: Tue Jul 28, 2015 3:48 am

Re: Dude Telegram notification example

Sun Dec 02, 2018 3:41 pm

i'm running the dude 6.42.10 on ccr1016 .. but the notification for down device not show up .. only up notification in telegram
i use the script from the wiki .. any suggestion ?
 
Onlineallthetime
just joined
Posts: 12
Joined: Fri Apr 20, 2018 3:52 am

Re: Dude Telegram notification example

Thu Jan 24, 2019 1:03 am

I had the same problem in my dude server (6.43.8). The fetch tool didn't works when i pressed the "test" button, but you need to execute that command on a terminal in your dude's winbox to see a result or another possible ideas. The link must be in quotes! Don't forget that!

/tool fetch url="https://api.telegram.org/botXXXXX/sendM ... xt=HiThere"
 
ComNet
just joined
Posts: 3
Joined: Wed Mar 06, 2019 3:05 pm

Re: Dude Telegram notification example

Wed Apr 24, 2019 5:01 pm

I had the same problem in my dude server (6.43.8). The fetch tool didn't works when i pressed the "test" button, but you need to execute that command on a terminal in your dude's winbox to see a result or another possible ideas. The link must be in quotes! Don't forget that!

/tool fetch url="https://api.telegram.org/botXXXXX/sendM ... xt=HiThere"
I tested with 6.44.3 (cannot use other version because incompatible of any devices) and dont work!! Help!!!
 
jfoster1
just joined
Posts: 2
Joined: Fri Apr 26, 2019 12:25 am

Re: Dude Telegram notification example

Tue Apr 30, 2019 7:03 pm

Here is my experience with telegram notifications.

My Setup:

I have two Dude servers, hex (mmimps) and CCR1009-8g-1S-1S+ (tile) both on 6.44.2

I can get the telegram bot to work perfect on the hex except if I enter the command via CLI Terminal. I get

status: failed

failure: closing connection: <404 Not Found> 149.154.167.220:443 (4)

But I setup a notification and the test button and real world alerts works.

The second dude server on the CCR should be identical the setup as the hex but I get this message if I type the same command via CLI Terminal

status: failed

failure: ssl connection error: internal error (6)

But I setup the notification tool identical to the hex and the test button or the real alerts don't work.

From both routers I can ping external IP's and DNS names no problem so I'm not totally sure what could cause a ssl connection error.
 
jfoster1
just joined
Posts: 2
Joined: Fri Apr 26, 2019 12:25 am

Re: Dude Telegram notification example

Sat May 11, 2019 12:31 am

I would like to send an update on how I fixed my issues.

My firewall had telegram.com blocked through the content filter. One dude server was exempt and the other dude server wasnt.
 
sri2007
Member Candidate
Member Candidate
Posts: 209
Joined: Wed May 20, 2015 10:14 pm
Location: Lake Grove, NY

Re: Dude Telegram notification example

Mon Sep 16, 2019 7:46 am

Hello everyone, the code is actually working in RouterOS 6.43.16; but if you want to add a biggest message, you'll need to add %20 instead of a space; so please update the Wiki.

New code from text:
text=Time:%20[Time];%20Device:%20[Device.FirstAddress];%20Status:%20[Service.Status]"
 
algisr
newbie
Posts: 27
Joined: Sat Apr 28, 2018 11:30 am

Re: Dude Telegram notification example

Fri Dec 06, 2019 3:10 am

Can anyone post a VIBER fetch command?

Got working Slack fetch command, got working Microsoft Teams command, read that it's easy with telegram and WhatsApp... To bad that I need one for the Viber but cannot crack that one out.
 
lucasimo88
just joined
Posts: 10
Joined: Fri Apr 06, 2018 8:43 pm

Re: Dude Telegram notification example

Wed Jan 01, 2020 9:05 pm

Hello everyone, the code is actually working in RouterOS 6.43.16; but if you want to add a biggest message, you'll need to add %20 instead of a space; so please update the Wiki.

New code from text:
text=Time:%20[Time];%20Device:%20[Device.FirstAddress];%20Status:%20[Service.Status]"
Try this
&text=🖥 Device: [Device.FirstAddress] - <b>[Device.Name]</b>;%0A⏰ Time: [Time];%0Aℹ Status: <b>[Service.Status]</b>&parse_mode=HTML" keep-result=no
 
ipaulponce
just joined
Posts: 1
Joined: Mon Feb 03, 2020 2:57 pm

Re: Dude Telegram notification example

Mon Feb 03, 2020 5:58 pm

Hello everyone, the code is actually working in RouterOS 6.43.16; but if you want to add a biggest message, you'll need to add %20 instead of a space; so please update the Wiki.

New code from text:
text=Time:%20[Time];%20Device:%20[Device.FirstAddress];%20Status:%20[Service.Status]"
Hello!! im using the same version! can you share the command you are using in notifications?

Regards!
 
mh6562086
just joined
Posts: 1
Joined: Fri Feb 28, 2020 3:10 am

Re: Dude Telegram notification example

Sun Mar 01, 2020 12:00 pm

Notifications in telegrams are of interest only for notifications to come not in private messages but in general chat. Configured as indicated above in private messages come and if in the chat then gives an error. Maybe someone came across this?
 
company
just joined
Posts: 2
Joined: Sun Jun 01, 2014 4:29 pm

Re: Dude Telegram notification example

Mon May 04, 2020 9:12 am

Hi,

I read several times this topic, and checked my config several times too, but I can't find my fail. I have internet, the bot, the chat_id, the group in Tg, … but I have no response in Telegram.

In this picture, it is my configuration in The Dude, I have The Dude on a VM with free license, and I did the notification config in TheDude and in the devices:

Picture:
https://www.dropbox.com/s/9qnwxk703s8u2 ... a.JPG?dl=0

/tool fetch mode=https url="https://api.telegram.org/bottokenHTTPAPIreceived/sendMessage\?chat_id=-idreceived&text=TEST" keep-result=no

In the other hand, if I try from the terminal of the router I receive the message:
/tool fetch mode=https url="https://api.telegram.org/bottokenHTTPAPIreceived/sendMessage?chat_id=-idreceived&text=TEST" keep-result=no
status: failed
failure: closing connection: <404 Not Found> 149.154.167.220:443 (4)

Please , can you help me.
Thanks
 
lucasimo88
just joined
Posts: 10
Joined: Fri Apr 06, 2018 8:43 pm

Re: Dude Telegram notification example

Wed May 06, 2020 10:59 am

/tool fetch url="https://api.telegram.org/bot123456789:ABCD1efghiL2mnouPqRsT3uvZAB_4CdEFgh/sendMessage?chat_id=-123456789&text=asdasdasd&parse_mode=HTML" keep-result=no
check your link whith this...

in your first link and screenshoot there is an error here: sendMessage\?chat
 
nikc
Member Candidate
Member Candidate
Posts: 208
Joined: Wed Jul 13, 2016 6:05 pm

Re: Dude Telegram notification example

Thu Sep 10, 2020 11:50 am

I'm trying to get this going also ... I have a string that when i paste it into the browser it works a charm, but when i try with the below string I get a 404 - any ideas folks, thanks !

/tool fetch url="https://api.telegram.org/bot##57155671: ... _mode=HTML" keep-result=no

failure: closing connection: <404 Not Found> 149.154.167.220:443 (4)
 
User avatar
danielcs
just joined
Posts: 9
Joined: Tue Aug 30, 2022 2:19 am
Location: Argentina

Re: Dude Telegram notification example

Sun Sep 04, 2022 10:08 pm

The API indicates that there are several parsing methods: HTML, markdown and Markdownv2: https://core.telegram.org/bots/api#sendmessage

I recommend you to use Markdown classic style:
*bold text*
_italic text_
[inline URL](http://www.example.com/)
[inline mention of a user](tg://user?id=123456789)
`inline fixed-width code`
```
pre-formatted fixed-width code block
```
```python
pre-formatted fixed-width code block written in the Python programming language
```

Example:
/tool fetch url="https://api.telegram.org/bot  < BOT-TOKEN >  /sendMessage?chat_id=  < CHAT-ID >  &text=🔴%20%20[Device.Name]%20%20🔴%0A*IP:*%20[Device.FirstAddress]%0A*MAC:*%20[Device.MacAddressesCommaList]%0A*STATUS:*%20[Device.Status]%0A&parse_mode=markdown" keep-result=no

🔴 > You can use supported emojis
%20 > Indicates a empty space.
%0A > Indicates a line break.

ASCII Encoding Reference: https://www.w3schools.com/tags/ref_urlencode.ASP

There should be no spaces in the URL, nor should there be line breaks, there should be only one line. Use the test button in the notification to verify that it works correctly.
 
wirelessadweb
just joined
Posts: 14
Joined: Sat Dec 22, 2012 8:16 am

Re: Dude Telegram notification example

Tue Jan 03, 2023 6:43 pm

I realise this is a well established thread but I have read it a couple of times and can not see my issue highlighted. The Telegram message works well but I can not get the variables populated, I am, on 6.49.7, I am trying via Dude and in the terminal - they have the same results, it will send the message but variables will not populate in the message. can anyone point me in the right direction please?

Who is online

Users browsing this forum: No registered users and 6 guests