A simple webhook receiver that filters, transforms and forwards webhooks.
pip install webhooks-bridge
WEBHOOKS_BRIDGE_CONFIG_PATH=$PWD uvicorn webhooks_bridge.main:app --port 8080
export DATA_DIR=<YOUR_CONFIG_DIR>
docker run -p 8888:80 \
--name webhooks-bridge \
-e WEBHOOKS_BRIDGE_LOG_LEVEL=DEBUG \
--mount type=bind,source=$DATA_DIR,target=/config \
sebastiannoelluebke/webhooks-bridge:latest
By default the webhooks get forwarded with the original body and the same Content-Type.
# webhooks.yml
my-cool-webhook: # POST http://localhost:8000/my-cool-webhook
- url: "https://webhook-receiver-1/"
- url: "https://webhook-receiver-2/" # Forward to multiple receivers
Use jinja2 templates to filter the incoming webhooks. If any of the conditions fails the webhook will not be forwarded. You can access the following data from the incoming request: json, headers, form, content(body), query
.
# webhooks.yml
my-cool-webhook: # POST http://localhost:8000/my-cool-webhook
- url: "https://webhook-receiver-3/api/webhook/SAHASDLITZENLXLHS"
conditions:
- "{% if json.NotificationUrl.object.Payment.alias.iban == 'DE123123123123213' %}True{% else %}False{% endif %}"
- "{% if json.NotificationUrl.object.Payment.amount.value|float > 0 %}True{% else %}False{% endif %}"
# webhooks.yml
my-cool-webhook: # POST http://localhost:8000/my-cool-webhook
- url: "https://webhook-receiver-1/"
json:
amount: "{{ json.NotificationUrl.object.Payment.amount.value }}"
receiver: "{{ json.NotificationUrl.object.Payment.alias.iban }}"
sender: "{{ json.NotificationUrl.object.Payment.counterparty_alias.iban }}"
description: "{{ json.NotificationUrl.object.Payment.description }}"
# webhooks.yml
my-cool-webhook: # POST http://localhost:8000/my-cool-webhook
- url: "https://webhook-receiver-1/"
headers:
x-customer-header: "my-header-value"
# webhooks.yml
my-cool-webhook: # POST http://localhost:8000/my-cool-webhook
- url: "https://webhook-receiver-1/"
headers:
x-customer-header: "my-header-value"
json:
amount: "{{ json.NotificationUrl.object.Payment.amount.value }}"
receiver: "{{ json.NotificationUrl.object.Payment.alias.iban }}"
sender: "{{ json.NotificationUrl.object.Payment.counterparty_alias.iban }}"
description: "{{ json.NotificationUrl.object.Payment.description }}"
original_header: "{{ headers.x_my_header }}"
query_param_1: "{{ query.param1 }}"
Currently it is not possible to forward webhooks with attached files