Forward the webhook request.
I suppose your webhook request body looks like this:
{
"alerts":[
{
"status":"resolved",
"labels":{
"alertname":"325i alert"
}
}
]
}
And your backend wanted:
{
"body":"Test Bark Server",
"title":"bleem"
}
Now you can use webhook-forwarder
to receive and redirect and modify the webhook request like this:
// ~/.config/webhook-forwarder/test.js
function convert(origin) {
alert = origin.alerts[0];
return {
target: ["https://api.day.app/asd/"],
payload: {
title: alert.labels.alertname,
body: "",
}
}
};
Finally your backend will got correct body.
version: '3'
services:
webhook-forwarder:
image: ghcr.io/bpazy/webhook-forwarder:master
environment:
- PORT=:8080
restart: always
ports:
- "8080:8080"
volumes:
- /home/ubuntu/webhook-forwarder/templates:/root/.config/webhook-forwarder/templates