New notification providers: Join & Telegram


29 posts in this topic Last Reply

Recommended Posts

Hello,

 

I think it would be awesome if Join and Telegram could be added to the notification providers.  I use Pushbullet, but they have been turning me off with their recent changes...

 

Join & Telegram are both free and should be easy to implement...

 

What do you think?

 

Thanks!

 

Sent from my Nexus 6P using Tapatalk

 

 

Link to post
  • 2 months later...

I have added the "Join" agent.

 

Need to figure out how telegram works, seems to be designed more for user message exchanges, not notifications.

 

Ps. Join is not free. You need to subscribe (+ fee) after the trial period.

 

 

Link to post

Telegram would require either:

 

1) User creates a bot under their own Telegram account, using a unique user name for the bot, and registers their API key with unRAID. unRAID uses bot to send notices to the user.

 

2) Lime Technology registers their own bot, under their own Telegram account, and generates their own API key, and runs a central bot on their own servers. Lime Technology requires unRAID users to:

2a) Verify with the official unRAID Telegram bot that they control the Telegram account they are electing as the target for the notifications. This stops maliciously or accidentally sending messages to arbitrary users without their permission.

2b) Verify with the Lime Technology bot service that they have a valid unRAID license, by the unRAID software identifying its trial or paid license serial to the service. This hopefully stops just anyone from uncovering the protocol of your server API and abusing it to flood users with notifications, or causing your bot to abuse the Telegram service.

2c) Official unRAID bot then sends them any notifications pushed with the semi-permanent session access keys granted to their unRAID instance.

 

 

I kind of like the latter, since while it is more work for Lime Technology, it requires little work or setup by the users who wish to employ it, and it should scale to hundreds or even thousands of users.

 

Technically, you could support both. The first in the interrim, the latter as a more permanent solution. Both methods would require a Telegram bot daemon, the former requires it to be run by the user, the latter requires you to run it yourselves.

Link to post

Approach (1) is what is done for every other notification agent. User needs to create his/her own account at the respective service to receive notifications.

 

Approach (2) requires Limetech to facilitate the service, not sure if they want to do that (Telegram is just one of the available options).

 

Link to post

Limetech will still need to create the service for (1), but the user will host it themselves. Or Limetech will need to support any one of a number of possible open source generic Telegram bots, as there are probably lots of them, and they're probably not compatible with each other.

 

Most of the time, people will acquire one or another bot, hand edit it to their needs, and employ it.

 

So I guess you can look to one of your many community developers, maybe the LinuxServer team would be interested in creating a Telegram bot Docker container specifically for this notification system, since it will likely be some Python or TCL or Go or even PHP concoction, and won't be able to run directly on the unRAID server.

Link to post

I have added the "Join" agent.

 

Need to figure out how telegram works, seems to be designed more for user message exchanges, not notifications.

 

Ps. Join is not free. You need to subscribe (+ fee) after the trial period.

Awesome... Thanks!!

 

Can't wait to try it out...

 

Join the service is free...the app is a one time purchase..from the play store:

 

30 day trial - one time $4.99 payment to unlock

Try the app for free for a month, then unlock it with a one time payment to continue using it

 

Sent from my Nexus 6P using Tapatalk

 

 

Link to post

I have added the "Join" agent.

 

Need to figure out how telegram works, seems to be designed more for user message exchanges, not notifications.

 

Ps. Join is not free. You need to subscribe (+ fee) after the trial period.

Awesome... Thanks!!

 

Can't wait to try it out...

 

Join the service is free...the app is a one time purchase..from the play store:

 

30 day trial - one time $4.99 payment to unlock

Try the app for free for a month, then unlock it with a one time payment to continue using it

 

Sent from my Nexus 6P using Tapatalk

 

You can install the Dynamix Bleeding Edge plugin and try the new agent.

 

Link to post

I have added the "Join" agent.

 

Need to figure out how telegram works, seems to be designed more for user message exchanges, not notifications.

 

Ps. Join is not free. You need to subscribe (+ fee) after the trial period.

Awesome... Thanks!!

 

Can't wait to try it out...

 

Join the service is free...the app is a one time purchase..from the play store:

 

30 day trial - one time $4.99 payment to unlock

Try the app for free for a month, then unlock it with a one time payment to continue using it

 

Sent from my Nexus 6P using Tapatalk

 

You can install the Dynamix Bleeding Edge plugin and try the new agent.

Installed and working perfectly!!

 

Thank you!!!

 

Sent from my Nexus 6P using Tapatalk

 

 

Link to post
  • 8 months later...
  • 2 months later...

Adding the following to NotificationAgents.xml allows Telegram to work for notifications.  Not the easiest process to setup though.  First you have to send @BotFather a message '/newbot', after a few steps it sends you back your HTTP API.  Then you need to start a conversation with your bot in order to get the Chat ID to send to.  Not sure there is an easy way to integrate this into the settings page, I manually queried the API to get the chat ID.

  <Agent>
    <Name>Telegram</Name>
    <Variables>
      <Variable Help="The API key can be found [a href='https://core.telegram.org/bots/api' target='_blank'] [u]here[/u].[/a]" Desc="API key" Default="">API_KEY</Variable>
      <Variable Help="Chat ID [a href='https://core.telegram.org/bots/api' target='_blank'] [u]here[/u].[/a]" Desc="Chat ID" Default="">CHAT_ID</Variable>
      <Variable Help="Specify the fields which are included in the message body of the notification." Desc="Notification Message" Default="$DESCRIPTION">MESSAGE</Variable>
    </Variables>
    <Script>
      <![CDATA[
      #!/bin/bash
      ##########
      {0}  
      ##########
      MESSAGE=$(echo -e "$MESSAGE")
      URL=https://api.telegram.org/bot$(echo -e "$API_KEY")
      CHATID=$(echo -e "$CHAT_ID")

      curl -s -k -G \
      --data-urlencode "text=$MESSAGE" \
      $URL/sendMessage?chat_id=$CHATID
      ]]>
    </Script>
  </Agent>

Edit: While looking for something else I noticed theres another way to get the chatid.  Send '/getid' to IDBot @myidbot (https://telegram.me/myidbot) and it will reply with your chat id

 

Edited by Bokonon
Link to post
  • 5 months later...

Any chance this is being considered to add in Telegram? While it's aimed at message communication, if it's bene figured out (as Bokonon has indicated) it shouldn't be much difficulty in adding into the notification agents? I personally have centralized on Telegram as it's lightweight and easy enough to get notifications and be used for secure messaging. 

Link to post
  • 1 month later...

I also want to push this topic. I´m using Telegram for multiple notification purposes (my webserver, FHEM, ...) as well as my personal communication. It would be great to integrate my unRAID server into this environment. The solution provided by Bokonon above (thanks a lot!) is ready to run, so it should be no effort at all for you to integrate this into the unRAID release.

 

Here a step-by-step description on how to get this running (user perspective):

  1. Log into your unRAID server´s shell (e.g. using Putty, the IP address and the credentials of your root user).
  2. Add Bokonon´s code to "/usr/local/emhttp/webGui/include/NotificationAgents.xml" (just above the last line  "<Agents>"), e.g. using the commandline editor "vi".
    Unfortunately, this file seems to be replaced during updates (at least it was replaced by version 6.5), so this manual step can be necessary repeatedly.
    So it would be really awesome if this could be integrated in the next unRAID release.
  3. Contact @Botfather in Telegram and create a new bot with the command "/newbot". You cann access / edit your bot(s) with the command "/mybots". Copy the bot´s API key.
  4. Contact @myidbot in Telegram and request your chat id with the command "/getid". Copy your chat id.
  5. Reload the notification app and add API key and chat id to the Telegram settings at the bottom of the page.
    These will still be saved even if the NotificationAgents.xml was replaced and will be available again after you restored the code.
  6. Select which information should be sent by agents.

Thats it, you´re done. It really is as easy as this.

So please, developers, add these few lines of code as a standard to unRAID.

 

Thanks a lot!

Joachim

Link to post
7 hours ago, Trasrik said:

Unfortunately, this file seems to be replaced during updates

Not just updates, reboots. The unRAID OS is loaded into RAMfs clean and fresh from the archives on the flash drive at each boot, then settings saved from the webUI are applied. Changes to any of the usual linux folders such as /usr do not persist after reboot. Only files on /boot (the flash drive) and things mounted in /mnt (actual storage) are persistent. To automatically reapply changes after reboot, see the User Scripts plugin.

Link to post
  • 1 month later...
  • 4 weeks later...
  • 8 months later...

I realize this is an old post, but this is the first Google result for "unRAID Telegram", and I found @Bokonon's post above remarkably helpful, and I'd like to contribute a bit more. As noted above, upon restart, the changes made to NotificationAgents.xml are erased. To get around that, we can use a brittle, but functioning shell script:

# Rename current NotificationAgents.xml.
mv /usr/local/emhttp/webGui/include/NotificationAgents.xml /usr/local/emhttp/webGui/include/NotificationAgents.old

# Insert Telegram chunk and redirect out to new NotificationAgents.xml file.

sed '/<\/Agents>/{ 
    r /boot/customAgents/telegram.xml
    a \</Agents>
    d 
}' /usr/local/emhttp/webGui/include/NotificationAgents.old > /usr/local/emhttp/webGui/include/NotificationAgents.xml

Instructions:

  • Add the above script to the bottom of your /boot/config/go file.
  • Create a directory called "customAgents" in the /boot folder (flash drive).
  • Create a file in customAgents called "telegram.xml" and put the contents of @Bokonon's post into that new file.

Then, upon restart, the Telegram agent xml stuff should get shoved into the NotificationAgents.xml. It's not the best solution, but it does work for now.

Edited by RoldGold
Wrong username
Link to post
  • 3 weeks later...
On 3/13/2019 at 10:55 PM, RoldGold said:

I realize this is an old post, but this is the first Google result for "unRAID Telegram", and I found @Bokonon's post above remarkably helpful, and I'd like to contribute a bit more. As noted above, upon restart, the changes made to NotificationAgents.xml are erased. To get around that, we can use a brittle, but functioning shell script:


# Rename current NotificationAgents.xml.
mv /usr/local/emhttp/webGui/include/NotificationAgents.xml /usr/local/emhttp/webGui/include/NotificationAgents.old

# Insert Telegram chunk and redirect out to new NotificationAgents.xml file.

sed '/<\/Agents>/{ 
    r /boot/customAgents/telegram.xml
    a \</Agents>
    d 
}' /usr/local/emhttp/webGui/include/NotificationAgents.old > /usr/local/emhttp/webGui/include/NotificationAgents.xml

Instructions:

  • Add the above script to the bottom of your /boot/config/go file.
  • Create a directory called "customAgents" in the /boot folder (flash drive).
  • Create a file in customAgents called "telegram.xml" and put the contents of @Bokonon's post into that new file.

Then, upon restart, the Telegram agent xml stuff should get shoved into the NotificationAgents.xml. It's not the best solution, but it does work for now.

I have done everything and again stuck on how to get my chat ID. I found a link https://api.telegram.org/bot**-token-here**/getUpdates

but it does now work for me, after bot goes the full token.

Also to be sure

 

<Variable Help="The API key can be found [a href='https://core.telegram.org/bots/api' target='_blank'] here.[/a]" Desc="API key" Default="">API_KEY</Variable> <Variable Help="Chat ID [a href='https://core.telegram.org/bots/api' target='_blank'] here.[/a]" Desc="Chat ID" Default="">CHAT_ID</Variable> <Variable Help="Specify the fields which are included in the message body of the notification." Desc="Notification Message" Default="$DESCRIPTION">MESSAGE</Variable>

 

What I need to enter on MESSAGE?

 

Thanks in advance!

Link to post
  • 2 weeks later...

@BRiT I'm interested in native Telegram notification agent support vice an SMTP workaround.  There is only one given SMTP setting for email in UnRaid and its already involved in a notification workflow and I'd rather not disturb that for the sake of enabling another agent that is already potentially inbound for support within UnRaid if what was said above is true by @Kewjoe.

Link to post
  • 2 weeks 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.