Telegram Bot Notifications


Recommended Posts

I've just started playing with this, and am trying to get notifications on 2 devices for a server (there are two of us admins for it).

I created the Bot, and the other person has added the bot.

My telegram gets the notifications without issue, but the second person is not getting any notifications. Am I doing something wrong?

Link to comment
  • 2 weeks later...
  • 1 month later...

So, i tried to set up my telegram for notificartion, i created the bot and got the "token to access HTTP API.
Configured in Unrad notifications:
image.png.3f8ef8b2bf28dd358202806c8afade23.png
 

Disabled it, re-enabled it.
Test.

Nothing.

Any clue?

Thanks.

EDIT: some hour after it started working.

Edited by dhstsw
Link to comment
On 11/26/2019 at 6:01 AM, Ashe said:

cd /boot/config/telegram
Nano chatid
Add chatid number to file
Ctrl-x
Save

Hi,

in my /boot/config there's no telegram folder.
I made it nonetheless and did the chatid file inside with the group chat id (of course) but with no avail.

 

found this:

/boot/config/plugins/dynamix/telegram

 

Inside there's the chatid, with a 9 digits number.

The chatid for the group is a 9 digits too but with a "g" at the start (10 characters in total).

Modified with both the "g" and without, no results.


Any hints?

Thanks.

EDIT: solved by myself. It needs the "-" symbol before the number, something like:

-123456789

 

Cheers.

Edited by dhstsw
Link to comment
Hi,
in my /boot/config there's no telegram folder.
I made it nonetheless and did the chatid file inside with the group chat id (of course) but with no avail.
 
found this:

/boot/config/plugins/dynamix/telegram
 
Inside there's the chatid, with a 9 digits number.
The chatid for the group is a 9 digits too but with a "g" at the start (10 characters in total).
Modified with both the "g" and without, no results.

Any hints?

Thanks.

EDIT: solved by myself. It needs the "-" symbol before the number, something like:

-123456789
 
Cheers.

Glad it's working. My chat Id is in the config/telegram folder and works with just the number. But if it works it works


Sent from my iPhone using Tapatalk
Link to comment
Hi,
in my /boot/config there's no telegram folder.
I made it nonetheless and did the chatid file inside with the group chat id (of course) but with no avail.
 
found this:

/boot/config/plugins/dynamix/telegram
 
Inside there's the chatid, with a 9 digits number.
The chatid for the group is a 9 digits too but with a "g" at the start (10 characters in total).
Modified with both the "g" and without, no results.

Any hints?

Thanks.

EDIT: solved by myself. It needs the "-" symbol before the number, something like:

-123456789
 
Cheers.

Glad it's working. My chat Id is in the config/telegram folder and works with just the number. But if it works it works


Sent from my iPhone using Tapatalk
Link to comment
  • 4 weeks later...

The telegram folder should have been created automatically when you set it up in the notification settings. Can you check if the is a Telegram folder under boot/config/plugins/dynamix/notifications?

 

 

 

 

Edit

 

/boot/config/plugins/dynamix/notifications/agents

 

This should have a Telegram.sh file in there

Link to comment
7 minutes ago, Ashe said:

The telegram folder should have been created automatically when you set it up in the notification settings. Can you check if the is a Telegram folder under boot/config/plugins/dynamix/notifications?

 

 

 

 

Edit

 

/boot/config/plugins/dynamix/notifications/agents

 

This should have a Telegram.sh file in there.

Yes. The file exist.

 

And it has inside info like my bot id.

Link to comment
On 1/25/2020 at 9:01 AM, Ashe said:


Glad it's working. My chat Id is in the config/telegram folder and works with just the number. But if it works it works


Sent from my iPhone using Tapatalk

dang chatid, i needed to know where to find it, I finally got mine working.

 

thanks

 

Edited by ijuarez
engrish
Link to comment
  • 2 weeks later...

Hello,

 

Telegram Notification doesnt work:

I've copy the bot token & APPLY but with pressing TEST nothing happened....

 

Also i've try these (posted before), but no working more....

 

  On 11/26/2019 at 5:01 AM, Ashe said:

cd /boot/config/telegram
Nano chatid
Add chatid number to file
Ctrl-x
Save

 

dhstsw Posted January 25 (edited)

It needs the "-" symbol before the number, something like:
-123456789

 

 

Edited by DavKBe
Link to comment

Ah yes the Telegram API requires both chat id and message text to function:

https://core.telegram.org/bots/api#sendmessage

 

The chat_id parameter is part of the test script in Telegram.sh, but in my case (and I guess I'm not alone) the 'chatid' file that is referenced does not exist. If you create it like DavKBe mentions, it is read and the test script works immediately.


What I did was create my own Telegram channel, so I can have multiple bots in there. Applications report to their own bot, and by setting the 'Sign messages' option, the bot name is shown. That way I know where the message is coming from.

 

When the channel is there, add @get_id_bot to it. This bot will respond to each message with the chat ID. Once you have it, remove the bot. That is the chat ID you need to add to the 'chatid' file (including the - prefix).

 

Creating you own bot is easy using @BotFather. Just send that bot a message and start the conversation with /newbot. After naming your shiny new companion, the process will end with the BotFather confirming your bot creation and the access api you need.

 

You can test your bot manually by simply using a HTTP call (replace <bot_access_api> and <chat_id> with your values):

https://api.telegram.org/bot<bot_access_api>/sendMessage?chat_id=<chat_id>&text=test

Link to comment
On 11/27/2019 at 6:27 AM, BackupAddict said:

Easy once one know how but that said a simple chatid field in the UnRAID notification agent GUI for Telegram would sure be more user friendly than having to use terminal :)

 

that is correct:) There is a way to make a small update for this settings?

Because this is not working for me: 

cd /boot/config/telegram
Nano chatid
Add chatid number to file
Ctrl-x
Save

 

Thank you!

Link to comment

 

6 hours ago, norbertt said:

"Because this is not working for me"

Have you tried to send a message to your bot using the HTTP call? Simply from a browser.

As long as your bot token is correct, the chat id is correct and the bot is in the chat... should work.

Then at least you know technically it could work and the error is on unRAID side.

Link to comment
  • 3 weeks later...

For those coming here, I figured it out!

 

It's not working because it's missing the "chatid" file in "/boot/config/plugins/dynamix/telegram"

 

Steps:

  1. Follow this guide until you have created the bot
  2. Go to Unraid => Settings => Notification settings and scroll all the way down to Telegram.
  3. Fill in the HTTP API of the bot
    1. Ex: 1216098989:AAGRnTFAKElG1v8pPKuN_RTGW4RTHDxo
    2. NO "-" at the start!
  4. Open the terminal, first of five icons at the top right of the screen.
  5. Once in the terminal do the following:
    1. cd ../
    2. cd /boot/config/plugins/dynamix/telegram
    3. nano chatid
    4. *paste in the channel id where the bot should post, or your own Telegram ID*
      1. Ex: -1001444111222
      2. MAKE SURE TO HAVE A "-" AT THE START HERE!
    5. *CTRL + S to save*
    6. *CTRL + X to close editor*
    7. ls *to check if the file has been made*
  6. No go back to the notification settings, press test underneath the Telegram form and it should work now!

 

Let me know if you have questions!

Link to comment
On 4/1/2020 at 9:43 PM, Unmax said:

For those coming here, I figured it out!

 

It's not working because it's missing the "chatid" file in "/boot/config/plugins/dynamix/telegram"

 

Steps:

  1. Follow this guide until you have created the bot
  2. Go to Unraid => Settings => Notification settings and scroll all the way down to Telegram.
  3. Fill in the HTTP API of the bot
    1. Ex: 1216098989:AAGRnTFAKElG1v8pPKuN_RTGW4RTHDxo
    2. NO "-" at the start!
  4. Open the terminal, first of five icons at the top right of the screen.
  5. Once in the terminal do the following:
    1. cd ../
    2. cd /boot/config/plugins/dynamix/telegram
    3. nano chatid
    4. *paste in the channel id where the bot should post, or your own Telegram ID*
      1. Ex: -1001444111222
      2. MAKE SURE TO HAVE A "-" AT THE START HERE!
    5. *CTRL + S to save*
    6. *CTRL + X to close editor*
    7. ls *to check if the file has been made*
  6. No go back to the notification settings, press test underneath the Telegram form and it should work now!

 

Let me know if you have questions!

This is the easiest way to get your chat ID with 1 click

 

Link to comment
  • 2 months later...

Still broken, even in beta v6.9.  I can't imagine it's that difficult to add the chat id as a field to populate under the bot token?  Or at a minimum, add help text to indicate which files need to be populated on the USB stick.  Looking at this thread, it seems this has been broken for a long time.

Link to comment
On 6/9/2020 at 6:29 AM, ssn760 said:

Still broken, even in beta v6.9.  I can't imagine it's that difficult to add the chat id as a field to populate under the bot token?  Or at a minimum, add help text to indicate which files need to be populated on the USB stick.  Looking at this thread, it seems this has been broken for a long time.

It's not broken mine has been working without hiccup for over a year now. 

 

You need to create a chatid file under /boot/config/telegram.

From the command line run the following;

touch /boot/config/telegram/chatid

In that file you need to input the chatid of your user not your bot. 

You can obtain this by going to the following url;

https://api.telegram.org/bot{bot token}/getUpdates

Or running a curl command from the command line;

curl https://api.telegram.org/bot{bot token}/getUpdates

Where {bot token} is your bot api token... in the format of 1111111111:AAasdflakjhsflaskdhalskdjyYo

You will see json formated text spit out.

Look for the first instance of a chat id that belongs to your user name and not the bot.

"chat":{"id":206646491,"first_name":"Max","last_name":"Power","username":"MPower"

The above is the chat id you insert into your chatid file on the server. 

Just the number nothing else.

Run this in command line;

echo "206646491" > /boot/config/telegram/chatid

 

Edited by exist2resist
Link to comment
  • 2 months later...
On 6/9/2020 at 5:29 AM, ssn760 said:

Still broken, even in beta v6.9.  I can't imagine it's that difficult to add the chat id as a field to populate under the bot token?  Or at a minimum, add help text to indicate which files need to be populated on the USB stick.  Looking at this thread, it seems this has been broken for a long time.

If you're trying to use a channel ID you need to add '-100' to the front of it in your chatid file for it to function.

 

Ex: Channel ID is 1234567899, you would provide -1001234567899 to the file

Link to comment
  • 7 months 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.