Skip to content

colpari/webhook-forwarder

 
 

Repository files navigation

webhook-forwarder

Build Test Docker Quality Gate Status Go Report Card

Forward the webhook request.

webhook-forwarder (2)

Usage

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.

Docker Deploy

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

About

Forward the webhook request

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Go 89.6%
  • Makefile 4.8%
  • Dockerfile 4.3%
  • Shell 1.3%