mirror of
https://github.com/mag37/dockcheck.git
synced 2026-02-14 23:38:15 +01:00
Sanitize message for Matrix notifications
This commit is contained in:
parent
8ee5575081
commit
7e6aca581b
1 changed files with 2 additions and 2 deletions
|
|
@ -29,7 +29,7 @@ trigger_matrix_notification() {
|
|||
AccessToken="${!AccessTokenVar}" # e.g. MATRIX_ACCESS_TOKEN=token-value
|
||||
RoomId="${!RoomIdVar}" # e.g. MATRIX_ROOM_ID=myroom
|
||||
MatrixServer="${!MatrixServerVar}" # e.g. MATRIX_SERVER_URL=http://matrix.yourdomain.tld
|
||||
MsgBody="{\"msgtype\":\"m.text\",\"body\":\"$MessageBody\"}"
|
||||
MsgBody=$(jq -Rn --arg body "$MessageBody" '{msgtype:"m.text", body:$body}')
|
||||
|
||||
# URL Example: https://matrix.org/_matrix/client/r0/rooms/!xxxxxx:example.com/send/m.room.message?access_token=xxxxxxxx
|
||||
curl -S -o /dev/null ${CurlArgs} -X POST "$MatrixServer/_matrix/client/r0/rooms/$RoomId/send/m.room.message?access_token=$AccessToken" -H 'Content-Type: application/json' -d "$MsgBody"
|
||||
|
|
@ -37,4 +37,4 @@ trigger_matrix_notification() {
|
|||
if [[ $? -gt 0 ]]; then
|
||||
NotifyError=true
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue