Skip to content

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
Step-by-step guide: how to use webhookInstall, first run, examples, tips and FAQs

How to get it

  1. 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 webhook

    Install on FreeBSD

    pkg install webhook

    Build from source

    go build github.com/adnanh/webhook
  2. 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. 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

ProjectStarsTypeLevelUpdatedBest for
webhook (this)12.2kCLIintermediate2 months agoDevelopers who want a repository push to trigger a deploy script on their own server
swr32.5kLibraryintermediate20 days agoReact developers who fetch data from APIs in components
linux-dash10.6kAppbeginner2.6 years agoPeople who want a quick browser view of a Linux server's health
PowerShell56kCLIbeginner4 days agoDevelopers who script or automate tasks across Windows, Linux, and macOS
elysia19.3kFrameworkintermediate8 days agoTypeScript developers building HTTP APIs or web servers
gping12.7kCLIbeginner1 months agoEngineers 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.