What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

PRTG with telegram

Votes:

16

Today telegram launched a new service. Telegram BOT. You can HTTP trigger this bot to send messages / photo etc.

At a older article i created a telegram bot with Linux but now its much easyer to do this.

1. First you must create a telegram account and add BotFather to you list. To do this click on the following url: https://telegram.me/botfather

2. Genrate a new bot with the command "/newbot" BotFather is then asking for a username and a normal name. After that your bot is created and you get a HTTP token. (for more options for your bot type "/help")

3. Add your bot to telegram with the following url

http://telegram.me/<botname>

and send some text to the bot.

4. Now copy your token code and go to the following page in chrome:

https://api.telegram.org/bot<tokencode>/getUpdates

5. You see a json code with the message you sent to the bot. Copy the Chat id. In this example that is “-9787468”

"message":{"message_id":7,"from":{"id":656556,"first_name":"Joo","last_name":"Doo","username":"JohnDoo"},"chat":{"id":-9787468,"title":"Telegram Group"},"date":1435216924,"text":"Hi"}}]}

6. Now create a new notification (setup -> account settings -> notifications). Check the “Execute http action” and put the following url in the box:

URL:

https://api.telegram.org/bot<tokencode>/sendMessage

Postdata:

chat_id=<chatid>&text=PRTG: %status %shortname %device :: %probe -- %group -- %commentsdevice

Now save the config and test it 

bot custom-notification notification notifications telegram

Created on Jun 25, 2015 12:10:13 PM

Last change on Jun 25, 2015 12:23:44 PM by  Felix Saure [Paessler Support]



Best Answer

Accepted Answer

Votes:

1

We now have an official blog-post with a set-up guide for Telegram:

Let me know if you got it to work this way.


Stephan Linke, Tech Support Team

Created on Jun 26, 2018 9:37:53 AM by  Stephan Linke [Paessler Support]

Last change on Aug 6, 2018 7:21:47 AM by  Luciano Lingnau [Paessler]



24 Replies

Votes:

6

Hi there, thank you very much for sharing your guide with the community!

Created on Jun 25, 2015 12:25:39 PM by  Felix Saure [Paessler Support]



Votes:

0

I agree, this is really nice, especially since Telegram is available on mobile and desktop. Nice!

Created on Jun 26, 2015 7:23:46 AM by  Stephan Linke [Paessler Support]



Votes:

0

Work like a charm! Thank you so much.

Created on Jun 29, 2015 7:38:23 AM



Votes:

0

Super stuff. SMS modem won't eat up my credits. Thank You.

Created on Jan 17, 2016 8:21:33 AM



Votes:

1

It doesn't work! Because Telegram demands that link was in the UTF-8 format, and "%group" is a mistake because symbols in UTF-8 look just %XX.

Request:

https://api.telegram.org/bot111111111:QWERTYUIOP/sendMessage?chat_id=11111111&text=%device

Telegram answer error:

{"ok":false,"error_code":400,"description":"[Error]: Bad Request: Message text must be in utf-8"}

Created on Mar 25, 2016 7:35:08 AM

Last change on Aug 6, 2018 7:17:48 AM by  Luciano Lingnau [Paessler]



Votes:

1

I got an error of this type:

{"ok":true,"result":[]}

That was because privacy of the bot was set to Enabled. Go to the BotFather and type command

/setprivacy

to Disable privacy of the bot. In that way, the bot can receive messages.

After that, send a message to the bot.

Then run in Chrome

https://api.telegram.org/bot<tokencode>/getUpdates again

You will receive the correct json code.

Created on Aug 9, 2016 8:17:52 PM



Votes:

0

Thanks for sharing! :)

Created on Aug 10, 2016 6:05:44 AM by  Stephan Linke [Paessler Support]



Votes:

1

There is also a new way to get the ID.

Add the IDBot user to telegram and your group and type "/getidgroup" or if you want to send the messages to yourself use /getid

https://telegram.me/myidbot

Created on Aug 10, 2016 7:06:04 AM



Votes:

0

When I put in the post data I get the following error:

Fehler (Bad Request) Die Überprüfung der Eingaben schlug fehl: Post-Daten: Buchstabenfolgen (&apos;<...>&apos;) die ein HTML Tag darstellen können, sind hier nicht erlaubt in Benachrichtigung "HTTP"

Created on Feb 12, 2017 8:05:42 PM



Votes:

0

What exactly are you posting to the bot? Does "Hello World!" work fine?

Created on Mar 16, 2017 12:47:26 PM by  Stephan Linke [Paessler Support]



Votes:

0

When I try to save the notification screen in the Postdata field of the following error:

Error (Bad Request) The validation of the data provided failed due to the following: Postdata: Character sequences ('<...>') which can potentially form a tag are not allowed here in notify "HTTP"

Created on Apr 10, 2017 4:34:44 PM



Votes:

0

Could you post your entire post data field, minus the chat id? You probably have the pointy brackets within the post field somewhere, hence it's failing.

Created on Apr 11, 2017 8:16:23 AM by  Stephan Linke [Paessler Support]



Votes:

0

Hi

I configurated my notification with this parameters

URL: https://api.telegram.org/bot<tokenid>/sendMessage

Postdata: chat_id=xxxxxx&text=PRTG: %status %shortname %device %probe %group %commentsdevice

and works very well.

Thanks

Created on Apr 20, 2017 11:26:06 AM



Votes:

0

Hi Elvira,

Good to hear. I hope you enjoy this feature. :)

Best regards.

Created on Apr 20, 2017 11:41:04 AM by  Dariusz Gorka [Paessler Support]



Votes:

0

Hello, trying to get notifications from my bot, i tested it in browser and then in prtg. Browser test is ok, but PRTG isn't working.
My request in browser is: https://api.telegram.org/bot...:.../sendMessage?chat_id=-....&text=1
My request in PRTG Http action: url: https://api.telegram.org/bot...:.../sendMessage postdata: chat_id=-....&text=1 Please help me to solve this problem :)

Created on May 19, 2017 10:11:22 PM

Last change on May 22, 2017 8:57:34 AM by  Dariusz Gorka [Paessler Support]



Votes:

0

Hi there,

Please check what the logs are saying under "Logs > System Events > Notifications". There you should see either "Ok.." or an error next to the notifications name.

Best regards.

Created on May 22, 2017 8:58:28 AM by  Dariusz Gorka [Paessler Support]



Votes:

0

I do not see the notification message on the telegram bot. Checking logs on PRTG has the following error: HTTP/1.1 401 Unauthorized (Sensor/Source/ID: 11132/2462/3) Please help me!

Created on Jun 26, 2018 9:21:57 AM



Accepted Answer

Votes:

1

We now have an official blog-post with a set-up guide for Telegram:

Let me know if you got it to work this way.


Stephan Linke, Tech Support Team

Created on Jun 26, 2018 9:37:53 AM by  Stephan Linke [Paessler Support]

Last change on Aug 6, 2018 7:21:47 AM by  Luciano Lingnau [Paessler]



Votes:

0

Hi ...

I tested, but I get the following message "Bad Request: strings must be encoded in UTF-8"

I notice that using% device an error happens. I did a test removing% device, leaving DEVICE and I get the message on the telegram. But I only get the message device.

Do you have something to do /?

Created on Apr 19, 2020 6:55:36 AM



Votes:

0

Is there any special character within your device name? Does it work for actual notifications, i.e. simulated errors?

Created on Apr 20, 2020 6:11:51 AM by  Stephan Linke [Paessler Support]



Votes:

0

I follow up the guide but can't received notify on Telegram.

Testing with https://api.telegram.org/bot1439712538:AAHxxxxxxxxxxxxxxxxxxxxx9u7X08/sendMessage

and result is:

https://api.telegram.org/bot1439712538:AAH7Jxxxxxxxxxxxxxx7X08/sendMessage

ok false error_code 400 description "Bad Request: message text is empty"

Created on Nov 7, 2020 10:14:45 AM

Last change on Nov 9, 2020 2:53:20 PM by  Stephan Linke [Paessler Support]



Votes:

0

The guide usually works pretty fine. Are you passing any text or chat id in the post data?

Created on Nov 9, 2020 3:00:43 PM by  Stephan Linke [Paessler Support]



Votes:

0

Hello I do receive messages on telegram bot successfully but when i share the bot name with other people they didn't receive the messages even when i add the bot to a group the messages didn't appear in the group

Created on Dec 6, 2021 7:10:42 AM



Votes:

0

A group usually has a different chat ID - has this been accounted for, i.e. has it been updated in the parameters?

Created on Dec 6, 2021 12:47:35 PM by  Stephan Linke [Paessler Support]




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.