Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rojosinalma/webhook-relay
A simple relay to send webhooks asynchronously to backend services (or any other URL)
https://github.com/rojosinalma/webhook-relay
Last synced: about 1 month ago
JSON representation
A simple relay to send webhooks asynchronously to backend services (or any other URL)
- Host: GitHub
- URL: https://github.com/rojosinalma/webhook-relay
- Owner: rojosinalma
- License: mit
- Created: 2023-11-01T19:35:52.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-30T05:42:53.000Z (about 1 year ago)
- Last Synced: 2024-05-01T13:50:35.629Z (8 months ago)
- Language: Python
- Homepage:
- Size: 80.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Webhook Relay
---Simple app to relay any incoming requests asynchronously to a destination of your choice.
## Dependencies:
* Python3## Description
The app receives requests at the path `//` and relays asynchronously to `RELAY_DST_URL` using `` as the url path (without ``). The original requester will get a `200` response without waiting for the destination to respond.
`` is just an arbitrary id that needs to be prepended in order to send a notification and log internally whats being relayed.
Headers and any json payload that gets sent from the original request will be relayed untouched.
**NOTE: The relay supports redirecting to just one destination URL, if you need to route to more destinations, it's recommended to setup multiple instances of the relay.**
## Development
1. Duplicate the `.env.example` and fill the variables with their proper values.
2. Run the relay
```bash
pip install -r requirements.txt
python relay.py # For local usage
gunicorn -c gunicorn_config.py app:app # For production usage
```## Running with Docker
If you want to use the Docker image locally:```bash
docker build -t webhook-relay:latest -f Dockerfile .
docker run -it webhook-relay:latest
```Or with `docker-compose`
```bash
docker-compose -f docker-compose.yaml build
docker-compose -f docker-compose.yaml up -d
```With this you can easily have the app and the api test running without more setup.
## Mock the Relay Destination URL
There's also a simple app in `dst_api.py` that receives requests on any path available and responds with `200`, to use it:```bash
python dst_api.py
```This will give you a place to test the relay of webhooks, you can set the `RELAY_DST_URL` in your .env to localhost:50001. You can set a different port in the `dst_api.py` script.
If you're using `docker-compose` this has already been configured.## Development
1. Fork it
2. Change it
3. Make a PR
4. Ping me!