Add Slack notifications agent

This commit is contained in:
bergware
2017-06-04 19:24:46 +02:00
parent c7af22c6cc
commit c7293c139d
2 changed files with 21 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -188,5 +188,25 @@
https://joinjoaomgcd.appspot.com/_ah/api/messaging/v1/sendPush 2>&1
]]>
</Script>
</Agent>
</Agent>
<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="USE YOUR OWN WEBHOOK VALUE HERE">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>
</Agents>