jedimstr

Slack Notifications

18 posts in this topic

It would be great to have Slack support for notifications.

Either using the tokenized App Web API or the Incoming Webhooks feature of Slack would be great!

I'm already using plexPy, couchpotato, and sonarr Slack Notification integration, but it would great to have unRAID join the party.

0

Share this post


Link to post
Share on other sites

+1 on this. Slack is slowly becoming a centralized place for not only my work communications, but personal as well. unRAID would be great to have in there.

0

Share this post


Link to post
Share on other sites

And a bump... anyone have any word on this request?  This is the one notifying thing I use that hasn't added Slack Notifications yet.

 

If not an official method, what's the best way to hack the existing notifications system to feed to Slack via one of the other notification agent options?

0

Share this post


Link to post
Share on other sites

If you want to be adventurous and support your own notification agent, look at the file /usr/local/emhttp/webGui/include/NotificationAgents.xml

 

This file is used as an API between unRAID and agents. Any new entries can be simply added here and agents become instantly available to unRAID.

 

0

Share this post


Link to post
Share on other sites

If you want to be adventurous and support your own notification agent, look at the file /usr/local/emhttp/webGui/include/NotificationAgents.xml

 

This file is used as an API between unRAID and agents. Any new entries can be simply added here and agents become instantly available to unRAID.

 

Challenge Accepted:

 

<Agent>
    <Name>Slack</Name>
    <Variables>
      <Variable Help="Get your WebHook as explained [a href='https://api.slack.com/incoming-webhooks' target='_blank'][u]here[/u].[/a]" Desc="WebHook URL" Default="FILL WITH YOUR OWN">WEBH_URL</Variable>
      <Variable Help="Application name, e.g., unRAID Server." Desc="Application Name" Default="unRAID Server">APP_NAME</Variable>
      <Variable Help="Specify the fields which are included in the title of the notification." Desc="Notification Title" Default="$SUBJECT">TITLE</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}
      ############
      TITLE=$(echo -e "$TITLE")
      MESSAGE=$(echo -e "$MESSAGE")

      curl -X POST -d "payload={\"username\": \"$APP_NAME\", \"text\": \"*$TITLE* \n $MESSAGE\"}" $WEBH_URL 2>&1

      ]]>
    </Script>
  </Agent>

 

This seems to work for Test, but has two issues:

[*]No Icon and I don't see where to specify in the XML.

[*]Won't save the variables for the WebHook URL and channel

 

My assumption is that some handling code that ingests/transforms this XML defines the available variables and the icon. 

For the variables, next step is to reuse some of the unused ones like maybe APP_TOKEN and USER_KEY, but I'd rather use something that makes sense.  But at least the Proof of Concept works.

 

Ideal of course would be if LimeTech took this and ran with it.

 

ADDENDUM:

Nope, changing the new variables to reuse older unused variable names from other notifications doesn't let it save the settings.  All works fine in test.  I guess for now I'll have to either hardcode it or set the default values to my values (setting default to personal settings works).

0

Share this post


Link to post
Share on other sites

1. The icon image needs to be stored in folder /usr/local/emhttp/webGui/icons. The name of the icon is the name of the agent in lowercase and spaces removed. In your case "slack.png". The icon size is preferably 48x48.

 

2. It is not possible to store or reuse your own variables.

 

0

Share this post


Link to post
Share on other sites

1. The icon image needs to be stored in folder /usr/local/emhttp/webGui/icons. The name of the icon is the name of the agent in lowercase and spaces removed. In your case "slack.png". The icon size is preferably 48x48.

 

2. It is not possible to store or reuse your own variables.

 

1. Thanks that worked nicely:

TWFNDPD.png

 

2. Some variables work if you hardcode in your values as "default".  Just can't save different values.

 

Also I took out the channel field since you can set that up on the Slack WebHook Custom Integration side.

 

 

With default hardcoded values for the webhook URL, it's working nicely:

 

iJTcMdo.png

0

Share this post


Link to post
Share on other sites

1. The icon image needs to be stored in folder /usr/local/emhttp/webGui/icons. The name of the icon is the name of the agent in lowercase and spaces removed. In your case "slack.png". The icon size is preferably 48x48.

 

2. It is not possible to store or reuse your own variables.

 

1. Thanks that worked nicely:

TWFNDPD.png

 

2. Some variables work if you hardcode in your values as "default".  Just can't save different values.

 

Also I took out the channel field since you can set that up on the Slack WebHook Custom Integration side.

 

 

With default hardcoded values for the webhook URL, it's working nicely:

 

iJTcMdo.png

 

1.) I wonder where unraid keeps info that notification agent was enabled.

2.) Where do i have to copy unraid logo to see it in my slack, similar you have on your pic

0

Share this post


Link to post
Share on other sites

1.) I wonder where unraid keeps info that notification agent was enabled.

2.) Where do i have to copy unraid logo to see it in my slack, similar you have on your pic

 

1) ¯\_( )_/¯

 

2) Drop a PNG logo here: /usr/local/emhttp/webGui/icons

0

Share this post


Link to post
Share on other sites

1.) I wonder where unraid keeps info that notification agent was enabled.

 

This is stored on your flash device under folder /config/plugins/dynamix/notifications/agents

0

Share this post


Link to post
Share on other sites

PM'd them :)

 

On 3/15/2017 at 10:52 PM, jrdnlc said:

@jedimstr Do you mind sharing the icons you used? 

 

1

Share this post


Link to post
Share on other sites

You should contact @Squid and make a plugin for this for the Community Applications

1

Share this post


Link to post
Share on other sites
On 3/22/2017 at 11:45 AM, kizer said:

You should contact @Squid and make a plugin for this for the Community Applications

 

+1

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

Copyright © 2005-2017 Lime Technology, Inc. unRAID® is a registered trademark of Lime Technology, Inc.