notify: add example bash script
This commit is contained in:
parent
925041a5d8
commit
1ff1bed33d
1 changed files with 25 additions and 0 deletions
25
machines/gerd/services/notify/notify-matrix.sh
Executable file
25
machines/gerd/services/notify/notify-matrix.sh
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
BODY="$1"
|
||||||
|
TITLE=${2:-Notification}
|
||||||
|
JQ_EXPR=${3:-.}
|
||||||
|
TYPE=${4:-matrix}
|
||||||
|
# TOKEN="$(cat ~/.config/notify/token)"
|
||||||
|
# TOKEN="$(cat /run/agenix/notify-token)"
|
||||||
|
TOKEN="$(cat token)"
|
||||||
|
URL="https://notify.fricloud.dk/notify"
|
||||||
|
# URL="||URL||"
|
||||||
|
|
||||||
|
# get stdin if needed
|
||||||
|
if [ "$BODY" = "-" ]; then
|
||||||
|
BODY="$(cat -)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# make request
|
||||||
|
curl -H "Authorization: Bearer $TOKEN" "$URL" \
|
||||||
|
--get \
|
||||||
|
--data-urlencode "title=$TITLE" \
|
||||||
|
--data-urlencode "body=$BODY" \
|
||||||
|
--data-urlencode "jq=$JQ_EXPR" \
|
||||||
|
--data-urlencode "type=$TYPE"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue