Telegram Bot Notifications


Recommended Posts

hi guys, I've followed the right steps to setup Telegram but this has never worked for me for some reason. I can't get the test notice to work.

Fyi: I've also looked in token and made sure that's the correct token too.

I can't think/find out what else to try.

 

Strangely when I try: https://api.telegram.org/bot8********:**********************************s/getMe in the browser, I get back

{"ok":true,"result":{"id":8******,"is_bot":true,"first_name":"******Bot","username":"********Bot","can_join_groups":true,"can_read_all_group_messages":false,"supports_inline_queries":false}}

The ID is different to that of the one I requested using the @my_id_bot within the app. I've also tried this one in my chatid file making sure it had a dash '-' at the start.

 

I've also made sure all lines are clean with no spaces etc within these files/entries.

 

I've even tried turning my keyboard up-side-down and spinning around on my chair 3 times... yep, at that stage now

telegram-settings.jpg

Edited by Dal1980
Context
Link to comment

Hi @Dal1980

 

take a look at the following three things:

  • Get Channel-ID (This is how I got mine. This was the only way for me to get the correct channel ID)
  • https://github.com/limetech/webgui/pull/512(i.e. change ID from user id to group id in file /boot/config/plugins/dynamix/telegram/chatid ; mine is -100XXXXXXXXX)
  • My Unraid Telegram notification settings contain the telegram bot token though

 

This is how I got Telegram notifications working.

Edited by T0a
Link to comment

Thanks T0a

 

Unfortunately the Get Channel ID method didn't work as it just revealed the @botname instead of an id.

 

I've since tried to just delete this all and start again but now Telegram just seems all screwed up as I get "Username @my_bot_id not found" when I try to get the bot ID.

 

 

unRAIDBot.jpg

Edited by Dal1980
Link to comment
  • 1 month later...

I thought I'd bump this one last time before it end up in the boneyard :)

(there was recent activity on another post so hoping someone has an answer *cough* :D 😛

 

Just asked BotFather to show my /mybots again and the response was

Here is the token for bot unRAIDBOT @Z*******Bot:

1*******02:A******-******-*******************Q

 

Just tried

https://api.telegram.org/bot1*******02:A******-******-*******************Q/getUpdates
and got back the following response:

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

Simply amazing stuff

 

(obviously everything that is a * is blanked out data and not actual data)

I'm not sure what I'm supposed to hide and what I can safely show so it may have been excessive to hide my bot chat name or whatever that @Z***... name was for my bot (been around in so many circles I'm confused with the whole thing to be honest)

 

Link to comment
  • 1 month later...

Hi @Dal1980,

 

got this working just today. Here are the steps I took:

1.) create Telegram bot in the BotFather chat

2.) configure the relevant Bot access token via the Unraid web UI

3.) in the BotFather chat type: /mybots

4.) this will show a list of all your bots

5.) click on the button for the relevant bot (it says something like @botname)

6.) this should open the relevant chat in Telegram

7.) click the Test button in the Unraid UI

8.) set the "Available notifications" and "Notification entity" as required

 

Hope this works for you as well.

  • Like 1
Link to comment
  • 5 months later...
On 7/25/2020 at 11:51 AM, josch said:

Hi @Dal1980,

 

got this working just today. Here are the steps I took:

1.) create Telegram bot in the BotFather chat

2.) configure the relevant Bot access token via the Unraid web UI

3.) in the BotFather chat type: /mybots

4.) this will show a list of all your bots

5.) click on the button for the relevant bot (it says something like @botname)

6.) this should open the relevant chat in Telegram

7.) click the Test button in the Unraid UI

8.) set the "Available notifications" and "Notification entity" as required

 

Hope this works for you as well.

Ditto, with one note for step 7.)

 

When you click "Test", you may not get the test notification in Telegram. However, when the server starts generating notifications such as "Warning" and "Alerts" (e.g. Warning, your UNRAID temperature is over 50C), then these are correctly pushed to Telegram!

 

The point is, when "Test" does not work, leave the service "on" in UNRAID->settings->Notifications, and wait for an actual working notification by UNRAID, such as "Warning,...your array is getting hot" or similar.

 

When I tried "Slack" (a far more complicated set up because of how Slack works), "test" message was immediately pushed to Slack. Same happened with "Pushover" service.

 

I concluded that there must be something wrong with Telegram "Test" function, likely on UNRAID side (because real-life notifications DID get pushed immediately to Telegram, while "test" did not).

 

Link to comment
  • 2 months later...

i think you are missing a step.

 

my Guide:

1.) Telegram App:  open chat "BotFather"

2.) Telegram App: write /newbot

3.) Telegram App: name Bot

4.) Telegram App: name username for the Bot

5.) Telegram App: now you should recieve a long text mssage in "BotFather" with access token.

6.) UNRAID: paste access token into Settings -> Notification -> Telegram -> access token field

7.) Telegram App:  click on top link in chat that looks like t.me/<botname>
8.) Telegram App: click start in the new chat.  and write /start to start the Bot.

9.) UNRAID: click the Test button in the Unraid UI

10.) UNRAID: set the "Available notifications" and "Notification entity" as required

Edited by LOOPMDS
few more changes needed to better clarify guide
  • Like 3
  • Thanks 1
Link to comment
  • 4 weeks later...

Hi,
Looks like there is a missing step and a missing field in the Unraid UI in order to fully configure the Telegram agent.
I think we need to put the telegram chatid somewhere.
When you read the /boot/config/plugins/dynamix/notifications/agents/Telegram.sh script, you see that it references a /boot/config/plugins/dynamix/telegram/chatid file containing the chatid number.
But in the Unraid telegram agent configuration UI, there is no chatid field (I'm using 6.9.2)

In order for the Telegram agent to work, I had to create the file with my bot chatid:
echo "MyChatIDnumber" > /boot/config/plugins/dynamix/telegram/chatid
(Just replace MyChatIDnumber by your chat ID number including the minus (-) sign if any)

Then clicked the test button in the Telegram agent configuration page and it worked.

How to retrieve chatid How to obtain Telegram chat_id for a specific user? - Stack Overflow

How to retrieve token : https://core.telegram.org/bots#generating-an-authorization-token

Edited by prune
added link to chatid and token retrieval howto
  • Like 3
  • Thanks 4
Link to comment
  • 3 months later...

i have these problems on different telegrammbots i use...

my solution that works for me is:

 

after entering the chat in the telegramm client, i sent theses commands:

 

1.) /start

2.) /get_messages_stats

 

after these two commands i receive the testmessage from unraid2075132648_Screenshot2021-07-18102654.thumb.png.7cd748677d6409a3f04fd2355b925d15.png

Edited by MadJoe74
  • Like 5
Link to comment
  • 10 months later...
On 4/14/2021 at 12:20 AM, prune said:

Hi,
Looks like there is a missing step and a missing field in the Unraid UI in order to fully configure the Telegram agent.
I think we need to put the telegram chatid somewhere.
When you read the /boot/config/plugins/dynamix/notifications/agents/Telegram.sh script, you see that it references a /boot/config/plugins/dynamix/telegram/chatid file containing the chatid number.
But in the Unraid telegram agent configuration UI, there is no chatid field (I'm using 6.9.2)

In order for the Telegram agent to work, I had to create the file with my bot chatid:
echo "MyChatIDnumber" > /boot/config/plugins/dynamix/telegram/chatid
(Just replace MyChatIDnumber by your chat ID number including the minus (-) sign if any)

Then clicked the test button in the Telegram agent configuration page and it worked.

How to retrieve chatid How to obtain Telegram chat_id for a specific user? - Stack Overflow

How to retrieve token : https://core.telegram.org/bots#generating-an-authorization-token

 

This is the one. Wish I had seen this before :)

 

Quote

In order for the Telegram agent to work, I had to create the file with my bot chatid:
echo "MyChatIDnumber" > /boot/config/plugins/dynamix/telegram/chatid
(Just replace MyChatIDnumber by your chat ID number including the minus (-) sign if any)

 

Link to comment
On 4/14/2021 at 1:20 AM, prune said:

Hi,
Looks like there is a missing step and a missing field in the Unraid UI in order to fully configure the Telegram agent.
I think we need to put the telegram chatid somewhere.
When you read the /boot/config/plugins/dynamix/notifications/agents/Telegram.sh script, you see that it references a /boot/config/plugins/dynamix/telegram/chatid file containing the chatid number.
But in the Unraid telegram agent configuration UI, there is no chatid field (I'm using 6.9.2)

In order for the Telegram agent to work, I had to create the file with my bot chatid:
echo "MyChatIDnumber" > /boot/config/plugins/dynamix/telegram/chatid
(Just replace MyChatIDnumber by your chat ID number including the minus (-) sign if any)

Then clicked the test button in the Telegram agent configuration page and it worked.

How to retrieve chatid How to obtain Telegram chat_id for a specific user? - Stack Overflow

How to retrieve token : https://core.telegram.org/bots#generating-an-authorization-token

Many thanks for this !

How Lime fix the problem ?

Link to comment
  • 1 month later...
  • 2 weeks later...
On 7/18/2021 at 9:41 AM, MadJoe74 said:

i have these problems on different telegrammbots i use...

my solution that works for me is:

 

after entering the chat in the telegramm client, i sent theses commands:

 

1.) /start

2.) /get_messages_stats

 

after these two commands i receive the testmessage from unraid2075132648_Screenshot2021-07-18102654.thumb.png.7cd748677d6409a3f04fd2355b925d15.png

Oh jeez, thank you for this! I was going to go through the whole chatid thing, but this worked absolutely fine.

Thank you!

  • Like 2
Link to comment
  • 3 months later...
On 4/13/2021 at 4:20 PM, prune said:

Hi,
Looks like there is a missing step and a missing field in the Unraid UI in order to fully configure the Telegram agent.
I think we need to put the telegram chatid somewhere.
When you read the /boot/config/plugins/dynamix/notifications/agents/Telegram.sh script, you see that it references a /boot/config/plugins/dynamix/telegram/chatid file containing the chatid number.
But in the Unraid telegram agent configuration UI, there is no chatid field (I'm using 6.9.2)

In order for the Telegram agent to work, I had to create the file with my bot chatid:
echo "MyChatIDnumber" > /boot/config/plugins/dynamix/telegram/chatid
(Just replace MyChatIDnumber by your chat ID number including the minus (-) sign if any)

Then clicked the test button in the Telegram agent configuration page and it worked.

How to retrieve chatid How to obtain Telegram chat_id for a specific user? - Stack Overflow

How to retrieve token : https://core.telegram.org/bots#generating-an-authorization-token

 

Genius thank you! It's Nov 2022 and this still is required.

Link to comment
  • 2 months later...

Just wanted to share I ran into this same problem but adding the chatid manually did not make sense to me as the telegram.sh script has logic to grab the chatid automatically.

 

What fixed the issue for me was running these two commands below on the Telegram bot itself and trying the TEST message again. I even removed the chatid file I had created manually and tried it again and the script populated the file.
 

1.) /start

2.) /get_messages_stats

  • Like 1
Link to comment
  • 5 months later...

I had to generate a new bot since I didn't realize none of my Telegram history would carry over after getting a new phone.

 

If changing to a different bot, you have to manually delete the chatid file (located at flash\config\plugins\dynamix\telegram\chatid) in addition to inputting the new bot token. It won't work if you leave the old file in place.

unRAID will automatically generate a new chatid when it sends a message.

Edited by Marc_G2
Link to comment
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.