# Semaphore Webhook Server A small Python webservice to extend the API of [Semaphore UI][semui] with a "webhook" enpoint to start tasks. ## Installation 1. Put the script onto your Semaphore server. 1. Run it e.g. as a systemd service. 1. Configure the reverse proxy to proxy a path of your choice to `http://localhost:3042/webhook` rather than Semaphore. - Apache example: ProxyPass /.well-known ! # Webhook server - must be before semaphre ProxyPass /webhook http://localhost:3042/webhook ProxyPassReverse /webhook http://localhost:3042/webhook # Semaphore ProxyPass /api/ws ws://localhost:3000/api/ws ProxyPass / http://localhost:3000/ ProxyPassReverse / http://localhost:3000/ ## Usage The easiest to use this webhook endpoint, simply GET or POST the `/webhook` endpoint with the `project_id` and `template_id` parameters: GET /webhook?project_id=1&template_id=1 HTTP/1.1 Host: semaphore.example.org Authorization: Bearer ... These two parameters are required. The total set of supporter parameters are: - `project_id` (**required**): int - `template_id` (**required**): int - `debug`: bool, `true` or `false` - `dry_run`: bool - `diff`: bool Each request to the webhook server is transformed into a request to the Semaphore API's [`POST /project/{project_id}/tasks` endpoint][endpoint]. The authorization header is passed on to Semaphore unmodified. [semui]: https://www.semui.co/ [endpoint]: https://www.semui.co/api-docs/#/project/post_project__project_id__tasks