Fixed POST to webhook

This commit is contained in:
Felix Kleinekathöfer 2023-01-07 16:00:17 +01:00 committed by GitHub
parent b83841d253
commit b6b399a590
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -167,14 +167,13 @@ function notify_error() {
return 1 return 1
fi fi
WEBHOOK_BODY=$(echo ${WATCHDOG_NOTIFY_WEBHOOK_BODY} | sed "s/\$SUBJECT\|\${SUBJECT}/$SUBJECT/g" | sed "s/\$BODY\|\${BODY}/$BODY/" | sed "s/\"/\\\\\"/g") # Replace subject and body placeholders
WEBHOOK_BODY=$(echo ${WATCHDOG_NOTIFY_WEBHOOK_BODY} | sed "s/\$SUBJECT\|\${SUBJECT}/$SUBJECT/g" | sed "s/\$BODY\|\${BODY}/$BODY/")
curl -X POST \ # POST to webhook
-H "Content-Type: application/json" \ curl -X POST -H "Content-Type: application/json" -d "${WEBHOOK_BODY}" ${WATCHDOG_NOTIFY_WEBHOOK}
-d ${WEBHOOK_BODY} \
${WATCHDOG_NOTIFY_WEBHOOK}
log_msg "Posted notification to webhook" log_msg "Sent notification using webhook"
fi fi
} }