
webhook
A small Go server that turns HTTP requests into triggers for shell commands you configure.
- Stars
- 12.2k
- Forks
- 882
- Licence
- MIT
- Language
- Go
- Last update
- 2 months ago
- Type
- CLI
What it is
webhook is a lightweight tool written in Go that creates HTTP endpoints on your server. When a request hits an endpoint, it runs a command you have configured, and can pass along data from the request such as headers, payload, or query variables. You can also set rules that must be met before a hook fires, such as requiring a secret. It is often used to trigger redeploy scripts when code is pushed to a repository.
- Run a redeploy script on a staging server when changes are pushed to a branch
- Pass request headers or payload values to a script as arguments or environment variables
- Require a secret parameter before a hook is allowed to run
- Serve hooks over HTTPS with a certificate and key, or behind a reverse proxy
Great for
- Developers who want a repository push to trigger a deploy script on their own server
- Operators who need a simple, configurable endpoint that runs a local command
- Teams using Slack or Mattermost slash commands that run commands on a server
- People comfortable editing JSON or YAML config files and writing shell scripts
Not ideal for
- Users who want a hosted service with no server to maintain, since it runs on your own machine
- Anyone who would expose hooks without trigger rules, because the README warns anyone who knows the endpoint can run the command
- Users looking for a full event gateway with queuing or replay, since the README says it does only receive, parse, check rules, and run the command
How to get it
- 1
Install with a package manager
You'll need: Go 1.21 or newer (only if building from source)
Install on Ubuntu (community package)
sudo apt-get install webhookInstall on FreeBSD
pkg install webhookBuild from source
go build github.com/adnanh/webhook - 2
Run it
- Create a hooks.json file that defines a hook with an id and an execute-command
- Make sure the script it runs starts with a shebang line such as #!/bin/sh
- Start the server with: /path/to/webhook -hooks hooks.json -verbose
- Send an HTTP GET or POST to http://yourserver:9000/hooks/<hook-id>
- 3
Get the most out of it
- Add a trigger-rule so the hook only runs when it receives the correct secret
- Use the -template flag to parse the hooks config as a Go template
- Use -secure with -cert and -key to serve hooks over HTTPS
- Use systemd socket activation so webhook can use a systemd-managed socket
- Use the -header flag to set CORS headers on responses
Downloads
Strengths
- Simple, focused scope: receive the request, check rules, run the command
- Supports JSON or YAML configuration and Go templates
- Available as prebuilt binaries and in several package managers
Trade-offs
- The README says everything beyond running the command is the command author's responsibility, so you must write and secure your own scripts
- Trigger rules such as IP whitelisting do not work as expected behind a reverse proxy, so access control must be handled in the proxy
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| webhook (this) | 12.2k | CLI | intermediate | 2 months ago | Developers who want a repository push to trigger a deploy script on their own server |
| swr | 32.5k | Library | intermediate | 20 days ago | React developers who fetch data from APIs in components |
| linux-dash | 10.6k | App | beginner | 2.6 years ago | People who want a quick browser view of a Linux server's health |
| PowerShell | 56k | CLI | beginner | 4 days ago | Developers who script or automate tasks across Windows, Linux, and macOS |
| elysia | 19.3k | Framework | intermediate | 8 days ago | TypeScript developers building HTTP APIs or web servers |
| gping | 12.7k | CLI | beginner | 1 months ago | Engineers who want to watch network latency visually while troubleshooting |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.