Category5.TV Community Forum

Full Version: Error in commands notify-service-by-telegram and notify-host-by-telegram
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I wondered why I did not receive any notifications (neither email nor telegram).

As far as email is concerned, there is already a report on an error regarding the "from" field.

As I did also not receive any telegrams, I first tested the telegram_nems.lua script and that worked.
Looking at the command line in NConf however showed that both notify-service-by-telegram and notify-host-by-telegram refer to the old command:


Obviously the command line arguments are not complete either.
Hi Robbie,

Could you have a look at this?
This should be an easy fix.


Hmm, thanks baggins. I could actually really use your assistance with this one because I couldn't figure out how Telegram works. I'm looking for someone who uses it to test and even assist with writing the documentation for this feature.

Please see this message I'd posted to you a long time ago which went unanswered:

Let me know what needs changing, specifically (eg., what NConf should have the commands set to) and I'll get working on it.

Hi Robbie,

You have in fact already done most of the work, but probably forgotten about it!

To start with: in /usr/local/bin you have now a script called telegram_nems.lua which is a modified version of my original script called telegram_nagios.lua.
The new script takes two additional arguments: the bot (arg[1] and the chat_id arg[2]. 
The bot and the chat_id are now stored in the resource.cfg as $USER11$ and $USER12$.

In Nconf however you have still the old command line: (This is for notify-host-by telegram, notify-service-by telegram is similar)


so this should be changed to:


That should do it.

Sorry about not responding to the previous message, I must have overlooked it.

Easy peasy, thanks baggins. :) Yeah, I snuck this feature in at the last minute of 1.3 feature freeze... so I'll get it fixed and ready for the next release (perhaps 1.3.1).

There's such an overlap right now between 1.3 and 1.4 so I'll decide how best to do this.

Thanks again!
Posting this here in case it helps someone since I couldn't find a straight forward explanation.  There may be a simpler way of doing this, but this is how I made it work.  None of this is my original work, so I've included links to where I found the answers.  

First create a bot: 

Within the Telegram app, send a message to @BotFather
/newbot <botname>

Make note of the Token you receive in return.  This is what you'll use for the "Your Bot" field in NEMS System Settings Tool (must add 'bot' before the token).

Allow your bot to join groups: 
send a message to @BotFather

The Chat ID seems to be a bit tricky to obtain.  
Compose a new message in Telegram, choosing the new group option.   
Add <botname> to the group.

Message your bot. 
/my_id <botname><Token>/getUpdates

Look for 'chat":{"id":'.   The id will be something like -12345678910. This is what you'll use for the Chat ID.

Hit save and hopefully you'll be in business.
That's wonderful, thank you lonehorse.

I'll add a link to your post in the docs for now, and inevitably write it in to the docs.

Hi @lonehorse first of all thanks for your help

I have 2 questions regarding what you have written.

Quote:Make note of the Token you receive in return.  This is what you'll use for the "Your Bot" field in NEMS System Settings Tool (must add 'bot' before the token). 

If i understand this right i have to fill into the Field "Your Bot" my API key and in front of it "bot" so combined it looks something like this "bot12345:xyz54321xxxXXXxxx" is this correct?

Quote:Look for 'chat":{"id":'.   The id will be something like -12345678910. This is what you'll use for the Chat ID.  

Do i have to fill in this ID with or without the minus "-" in the beginning? For example should i fill into the "Telegram Chat ID" field, this "-123454321" or this "123454321"?

Sorry for those stupid questions but so far i tried it in different ways and i could not getting it to work so im trying to find the where i made a mistake but so far i had no luck :-/
Same question from my side, adding "bot" in front of the token is not working for me
The official documentation is now complete and should help clarify how to setup your Telegram bot.