Files
webgui/plugins/dynamix/include/NotificationAgents.xml

255 lines
9.9 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Agents>
<Agent>
<Name>Boxcar</Name>
<Variables>
<Variable Help="Get your access token as explained [a href='http://help.boxcar.io/knowledgebase/articles/314474-how-to-get-my-boxcar-access-token' target='_blank'][u]here[/u].[/a]" Desc="Access Token" Default="">ACCESS_TOKEN</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}
############
MESSAGE=$(echo -e "$MESSAGE")
curl -s -k \
-d "user_credentials=$ACCESS_TOKEN" \
-d "notification[title]=$TITLE" \
-d "notification[long_message]=$MESSAGE" \
-d "notification[source_name]=Unraid" \
-d "notification[sound]=bird-1" \
-d "notification[icon_url]=http://i.imgur.com/u63iSL1.png" \
https://new.boxcar.io/api/notifications 2>&1
]]>
</Script>
</Agent>
<Agent>
<Name>Gotify</Name>
<Variables>
<Variable Help="The full server base URL including protocol and port. eg: https://example.com:8888/" Desc="Full Server Base URL" Default="">SERVER_URL</Variable>
<Variable Help="The App Token to use." Desc="App Token" Default="">APP_TOKEN</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}
############
MESSAGE=$(echo -e "$MESSAGE")
case "$IMPORTANCE" in
'normal' )
PRIORITY="3"
;;
'warning' )
PRIORITY="5"
;;
'alert' )
PRIORITY="7"
;;
esac
# Remove any trailing slash
SERVER_URL=${SERVER_URL%/}
curl -s -k -X POST \
-F "title=$TITLE" \
-F "message=$MESSAGE" \
-F "priority=$PRIORITY" \
${SERVER_URL}/message?token=$APP_TOKEN 2>&1
]]>
</Script>
</Agent>
<Agent>
<Name>Join</Name>
<Variables>
<Variable Help="The API key can be found [a href='https://joinjoaomgcd.appspot.com' target='_blank'] [u]here[/u].[/a]" Desc="API key" Default="">API_KEY</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 -s -k -G \
-d "apikey=$API_KEY" \
--data-urlencode "title=$TITLE" \
--data-urlencode "text=$MESSAGE" \
-d "deviceId=group.all" \
https://joinjoaomgcd.appspot.com/_ah/api/messaging/v1/sendPush 2>&1
]]>
</Script>
</Agent>
<Agent>
<Name>Prowl</Name>
<Variables>
<Variable Help="Get your api key as explained [a href='https://www.prowlapp.com/api_settings.php' target='_blank'][u]here[/u].[/a]" Desc="Api Key" Default="">API_KEY</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")
case "$IMPORTANCE" in
'normal' )
PRIORITY="0"
;;
'warning' )
PRIORITY="1"
;;
'alert' )
PRIORITY="2"
;;
esac
curl -s -k \
-F "apikey=$API_KEY" \
-F "application=$APP_NAME" \
-F "event=$TITLE" \
-F "description=$MESSAGE" \
-F "priority=$PRIORITY" \
https://api.prowlapp.com/publicapi/add 2>&1
]]>
</Script>
</Agent>
<Agent>
<Name>Pushbullet</Name>
<Variables>
<Variable Help="The Access Token can be found [a href='https://www.pushbullet.com/account' target='_blank'] [u]here[/u].[/a]" Desc="Access Token" Default="">TOKEN</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}
##########
MESSAGE=$(echo "$MESSAGE" | sed -e 's:<br[ /]*>:\\n:gI' -e 's/<[^>]*>//g')
curl -s -k \
-X POST --header "Authorization: Bearer $TOKEN" \
--header 'Content-Type: application/json' \
-d "{\"type\": \"note\", \"title\": \"$TITLE\", \"body\": \"$MESSAGE\"}" \
https://api.pushbullet.com/v2/pushes 2>&1
]]>
</Script>
</Agent>
<Agent>
<Name>Pushover</Name>
<Variables>
<Variable Help="The User Key can be found [a href='https://pushover.net/' target='_blank'][u]here[/u].[/a]" Desc="User Key" Default="">USER_KEY</Variable>
<Variable Help="The App Token can be found [a href='https://pushover.net/apps' target='_blank'][u]here[/u][/a]." Desc="App Token" Default="">APP_TOKEN</Variable>
<Variable Help="Specify the fields which are included in the message body of the notification." Desc="Notification Message" Default="$SUBJECT,$DESCRIPTION">MESSAGE</Variable>
</Variables>
<Script>
<![CDATA[
#!/bin/bash
############
{0}
############
MESSAGE=$(echo -e "$MESSAGE")
case "$IMPORTANCE" in
'normal' )
PRIORITY="-1"
;;
'warning' )
PRIORITY="0"
;;
'alert' )
PRIORITY="1"
;;
esac
curl -s -k \
-F "token=$APP_TOKEN" \
-F "user=$USER_KEY" \
-F "message=$MESSAGE" \
-F "timestamp=$TIMESTAMP" \
-F "priority=$PRIORITY" \
-F "html=1" \
https://api.pushover.net/1/messages.json 2>&1
]]>
</Script>
</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 --header 'Content-Type: application/json' \
-d "{\"username\": \"$APP_NAME\", \"text\": \"*$TITLE* \n $MESSAGE\"}" $WEBH_URL 2>&1
]]>
</Script>
</Agent>
<Agent>
<Name>Telegram</Name>
<Variables>
<Variable Help="[a href='https://telegram.me/botfather' target='_blank'][u]BotFather[/u][/a] is the one bot to rule them all.[br][br]
1. Make a bot using BotFather[br]
2. Paste the bot token in this field[br]
3. Message the bot via Telegram (either via a direct message or a message via a group)[br]
4. Test the bot[br][br]
* To reset the notifications receiving user or group, run [i]rm /boot/config/plugins/dynamix/telegram/chatid[/i] in the terminal and re-run steps 3. and 4.[/a]" Desc="Bot Access Token" Default="">BOT_TOKEN</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}
############
LEGACY=/boot/config/telegram
TELEGRAM=/boot/config/plugins/dynamix/telegram
STORED_TOKEN=$(< $TELEGRAM/token) || "";
# move legacy folder (if existing)
[[ -d $LEGACY && ! -d $TELEGRAM ]] && mv $LEGACY $TELEGRAM
if [[ ! -f $TELEGRAM/token || "$STORED_TOKEN" != "$BOT_TOKEN" ]]; then
mkdir -p $TELEGRAM;
echo $BOT_TOKEN > $TELEGRAM/token;
fi
if [[ ! -f $TELEGRAM/chatid || "$STORED_TOKEN" != "$BOT_TOKEN" ]]; then
mkdir -p $TELEGRAM;
LASTCHATID=$(curl -s https://api.telegram.org/bot$BOT_TOKEN/getUpdates | jq ".result | last .message .chat .id");
[[ $LASTCHATID =~ ^-*[0-9]+$ ]] && echo $LASTCHATID > $TELEGRAM/chatid || exit 1
fi
CHATID=$(< $TELEGRAM/chatid);
MESSAGE=$(echo -e "$(hostname): $TITLE\n$MESSAGE");
curl -G -s "https://api.telegram.org/bot$BOT_TOKEN/sendMessage" --data-urlencode "chat_id=$CHATID" --data-urlencode "text=$MESSAGE" 2>&1;
]]>
</Script>
</Agent>
</Agents>