No project description provided
Project description
Webhooks Bridge
A simple webhook receiver that filters, transforms and forwards webhooks.
Install
pip
pip install webhooks-bridge
WEBHOOKS_BRIDGE_CONFIG_PATH=$PWD uvicorn webhooks_bridge.main:app --port 8080
Docker
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
Usage
Forward
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
Filter
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 %}"
Transform
# 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 }}"
Custom headers
# webhooks.yml
my-cool-webhook: # POST http://localhost:8000/my-cool-webhook
- url: "https://webhook-receiver-1/"
headers:
x-customer-header: "my-header-value"
All in one
# 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 }}"
Forward files
Currently it is not possible to forward webhooks with attached files
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
webhooks_bridge-0.1.1.tar.gz
(3.5 kB
view details)
Built Distribution
File details
Details for the file webhooks_bridge-0.1.1.tar.gz
.
File metadata
- Download URL: webhooks_bridge-0.1.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.11.1 Linux/5.15.0-1031-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d14b410bf1d65fd8d12dd34cce6a90ecc0d44b33d215cf4fffbe98070acc018c |
|
MD5 | 8bba61fc569718f5813692f83cdce723 |
|
BLAKE2b-256 | 45074919346960165295b0f28a71c85d052ef9a3a476471977f21fceb1750563 |
File details
Details for the file webhooks_bridge-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: webhooks_bridge-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.11.1 Linux/5.15.0-1031-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 903232ef917500ea32131c93befb78be5d8df2419a8a7848f3e0234c6ac1916d |
|
MD5 | 06e2a085fc8b0ff7cbe9c57ff4d48a1f |
|
BLAKE2b-256 | 3e79cd2dd4d09b6e3e83648597a1bef85f7c802062077cbde5175c7aa7e898c8 |