A python script for listening for webhooks then executing local scripts.
Find a file
2025-09-13 20:11:42 -05:00
hooks.example.json Use a config file. 2025-09-11 04:26:15 -05:00
LICENSE Add GPL3.0 License. 2025-09-13 20:11:42 -05:00
main.py Use a config file. 2025-09-11 04:26:15 -05:00
README.md Add GPL3.0 License. 2025-09-13 20:11:42 -05:00
requirements.txt Initial Commit 2025-09-11 00:25:32 -05:00

Webhook Listener

Webhook Listener is a quick and dirty tool for executing local scripts when a request is made to a specific url.

Usage

Install by cloning this repository and install flask with pip. Deploy it like any flask project, or run it using flask --app main run.

Before you can run Webhook Listener, you need to copy the example config hooks.example.json to hooks.json. Open hooks.json and update the hooks object.The hook name is the key, and the access token is the value. While you are there, may you want to update the hooks_dir object as well. This is the directory where your hooks are stored. The hook files are executable files names the same as your hook.

To use the webhooks, set a POST request to http[s]://servername[:port]:/hooks/<hookname> with a webhook-token header using the access token as the value. The body of the HTTP request will be passed to the stdin of the hook.

Example:

curl -X POST 'http://localhost:5000/hook/webdeploy' -H 'webhook-token: accesstoken'

Security

Don't assume this is secure. While it is probably safe enough to be public facing, you should definitely use a reverse proxy for HTTPS termination. This script only very very basic security checks. Definitely do additional checks in your script or application.

License

Copyright (C) 2025  Minecraftchest1

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

Donate

If you find this project useful, feel free to leave me a tip with Ko-Fi.