Page 1 of 1

Dude Telegram notification example

Posted: Mon Jan 09, 2017 10:59 am
by PaulsMT
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.

Re: Dude Telegram notification example

Posted: Tue Jan 10, 2017 2:58 am
by turnip
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?

Re: Dude Telegram notification example

Posted: Tue Jan 10, 2017 4:23 am
by turnip
Never mind, just noticed this:
Changes in v6.39rc7:

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

Upgrading now

Re: Dude Telegram notification example

Posted: Wed Jan 18, 2017 7:42 am
by sparker
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

Re: Dude Telegram notification example

Posted: Wed Feb 15, 2017 8:21 am
by dricks
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

Re: Dude Telegram notification example

Posted: Wed Feb 22, 2017 1:44 pm
by amt
Hi,

what should be the chat_id= ??

thanks

Re: Dude Telegram notification example

Posted: Wed Feb 22, 2017 2:02 pm
by Shadeofspirit
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

Re: Dude Telegram notification example

Posted: Wed Feb 22, 2017 3:35 pm
by amt
thank you verymuch... its work. I would like to ask another question, is possible to do this on viber also ?

Thanks.

Re: Dude Telegram notification example

Posted: Thu Feb 23, 2017 3:26 pm
by Shadeofspirit
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

Re: Dude Telegram notification example

Posted: Mon Feb 27, 2017 7:57 pm
by tamigi
What's the problem in settings .

Image

Re: Dude Telegram notification example

Posted: Wed Mar 01, 2017 10:23 pm
by 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! :?

Re: Dude Telegram notification example

Posted: Thu Mar 02, 2017 2:53 am
by FlavioCamacho
What do you think of adapting the dude to send messages through Whatsapp it is much more popular than the telegran.

Re: Dude Telegram notification example

Posted: Thu Mar 02, 2017 10:24 am
by amt
What do you think of adapting the dude to send messages through Whatsapp it is much more popular than the telegran.
or viber...

Re: Dude Telegram notification example

Posted: Thu Mar 02, 2017 6:28 pm
by soonwai
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.

Re: Dude Telegram notification example

Posted: Thu Mar 02, 2017 7:24 pm
by irghost
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

Re: Dude Telegram notification example

Posted: Fri Mar 03, 2017 6:13 pm
by marnem
/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

Re: Dude Telegram notification example

Posted: Sun Apr 23, 2017 7:38 pm
by vinu
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??

Re: Dude Telegram notification example

Posted: Tue Apr 25, 2017 9:16 pm
by 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
:)

Re: Dude Telegram notification example

Posted: Thu May 04, 2017 3:25 pm
by joca
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="

Re: Dude Telegram notification example

Posted: Thu Jul 27, 2017 7:29 pm
by alisc
hi
how to send file ( backup file ) via Telegram ?

Re: Dude Telegram notification example

Posted: Sun Jul 30, 2017 8:23 pm
by Morcegolas
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.

Re: Dude Telegram notification example

Posted: Fri Aug 04, 2017 12:14 am
by Morcegolas
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.

Re: Dude Telegram notification example

Posted: Thu Aug 17, 2017 2:06 pm
by gangz
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

Re: Dude Telegram notification example

Posted: Tue Sep 12, 2017 4:07 pm
by indjov
That script will work with NetWacht?

Re: Dude Telegram notification example

Posted: Tue Sep 12, 2017 9:10 pm
by alisc
How to call admin number ?

Re: Dude Telegram notification example

Posted: Tue Sep 19, 2017 7:42 pm
by alisc
Do you have a solution to call admins when it event?

Re: Dude Telegram notification example

Posted: Wed Sep 20, 2017 12:24 am
by amt
That script will work with NetWacht?
Yes.. you can use it at netwatch

Re: Dude Telegram notification example

Posted: Tue Oct 10, 2017 9:56 pm
by benjamimgois
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 ???

Re: Dude Telegram notification example

Posted: Tue Oct 10, 2017 10:03 pm
by Shadeofspirit
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)

Re: Dude Telegram notification example

Posted: Tue Oct 10, 2017 10:07 pm
by Shadeofspirit
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

Re: Dude Telegram notification example

Posted: Tue Oct 10, 2017 10:50 pm
by benjamimgois
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 ?

Re: Dude Telegram notification example

Posted: Tue Oct 10, 2017 10:54 pm
by Shadeofspirit
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

Re: Dude Telegram notification example

Posted: Wed Oct 11, 2017 2:49 pm
by benjamimgois
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

Re: Dude Telegram notification example

Posted: Wed Oct 11, 2017 2:58 pm
by Shadeofspirit
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

Re: Dude Telegram notification example

Posted: Wed Oct 11, 2017 4:55 pm
by benjamimgois
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 ?

Re: Dude Telegram notification example

Posted: Wed Oct 11, 2017 5:17 pm
by Shadeofspirit

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

Re: Dude Telegram notification example

Posted: Wed Oct 11, 2017 5:29 pm
by benjamimgois

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 !

Re: Dude Telegram notification example

Posted: Wed Oct 11, 2017 5:34 pm
by Shadeofspirit

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

Re: Dude Telegram notification example

Posted: Wed Oct 11, 2017 6:15 pm
by benjamimgois

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

Re: Dude Telegram notification example

Posted: Tue Oct 24, 2017 1:45 pm
by icecybe
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 ?

Re: Dude Telegram notification example

Posted: Tue Oct 24, 2017 2:00 pm
by Shadeofspirit
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?

Re: Dude Telegram notification example

Posted: Tue Oct 24, 2017 2:37 pm
by icecybe
You mean in : Notification > Advanced tab ? Yes click them all. Is there anywhere else i can check them ?

Re: Dude Telegram notification example

Posted: Tue Oct 24, 2017 2:39 pm
by icecybe
/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

Re: Dude Telegram notification example

Posted: Tue Oct 24, 2017 2:56 pm
by Shadeofspirit
/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'

Re: Dude Telegram notification example

Posted: Tue Oct 24, 2017 3:18 pm
by icecybe
Damn Dude !!! You are a genious.
Thank's a lot for this small but HUGE help. It work's

Re: Dude Telegram notification example

Posted: Sun Mar 04, 2018 9:55 am
by tangram
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.

Re: Dude Telegram notification example

Posted: Sun May 13, 2018 10:10 pm
by Bc234
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


Re: Dude Telegram notification example

Posted: Mon May 14, 2018 9:29 pm
by blackhold
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.

Re: Dude Telegram notification example

Posted: Sat Jun 09, 2018 3:38 am
by jessequijano
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.

Re: Dude Telegram notification example

Posted: Mon Sep 24, 2018 2:01 am
by vitorbessa
The problem is at the moment of entering the interrogation (?), Mikrotik exchanges "sendMessage? Chat_id" with "sendMessagechat_id".

Forgive me for my English.

Re: Dude Telegram notification example

Posted: Sun Dec 02, 2018 3:41 pm
by 3rcom
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 ?

Re: Dude Telegram notification example

Posted: Thu Jan 24, 2019 1:03 am
by Onlineallthetime
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"

Re: Dude Telegram notification example

Posted: Wed Apr 24, 2019 5:01 pm
by ComNet
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!!!

Re: Dude Telegram notification example

Posted: Tue Apr 30, 2019 7:03 pm
by jfoster1
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.

Re: Dude Telegram notification example

Posted: Sat May 11, 2019 12:31 am
by jfoster1
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.

Re: Dude Telegram notification example

Posted: Mon Sep 16, 2019 7:46 am
by sri2007
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]"

Re: Dude Telegram notification example

Posted: Fri Dec 06, 2019 3:10 am
by algisr
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.

Re: Dude Telegram notification example

Posted: Wed Jan 01, 2020 9:05 pm
by lucasimo88
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

Re: Dude Telegram notification example

Posted: Mon Feb 03, 2020 5:58 pm
by ipaulponce
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!

Re: Dude Telegram notification example

Posted: Sun Mar 01, 2020 12:00 pm
by mh6562086
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?

Re: Dude Telegram notification example

Posted: Mon May 04, 2020 9:12 am
by company
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

Re: Dude Telegram notification example

Posted: Wed May 06, 2020 10:59 am
by lucasimo88
/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

Re: Dude Telegram notification example

Posted: Thu Sep 10, 2020 11:50 am
by nikc
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)

Re: Dude Telegram notification example

Posted: Sun Sep 04, 2022 10:08 pm
by danielcs
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.

Re: Dude Telegram notification example

Posted: Tue Jan 03, 2023 6:43 pm
by wirelessadweb
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?