Repolode
adnanh

adnanh/webhook

A lightweight Go server that exposes HTTP webhook endpoints which run configured shell commands, passing request data as arguments or environment variables.

Stars
12,207
Forks
882
Open issues
128
Last commit
2 months ago

What is it?

webhook is a small Go program that turns incoming HTTP requests into shell command executions. You define hooks in a JSON or YAML file, each with an ID that becomes an endpoint such as /hooks/redeploy-webhook. When a request arrives, webhook parses its headers, payload and query variables, checks any trigger rules you configured, and passes the values to your script as command-line arguments or environment variables.

Trigger rules let you restrict when a hook fires, for example by requiring a secret, matching a value in the payload, or allowing only certain IP ranges. Hooks can be loaded from a template, served over HTTPS, run behind a reverse proxy on a TCP port or Unix socket, and started through systemd socket activation. Multipart form data is supported in a limited way.

webhook deliberately limits its scope to receiving requests and invoking commands; the behavior of the script itself is left to the user.

Key features

  • 01Defines hooks in JSON or YAML, each exposed as an HTTP endpoint.
  • 02Passes request headers, payload and query values to commands as arguments or environment variables.
  • 03Supports trigger rules such as secret matching and IP allowlists.
  • 04Can serve hooks over HTTPS and run behind a reverse proxy via TCP or Unix socket.
  • 05Supports systemd socket activation and Go template configuration files.

Use cases

  • Triggering a redeploy script when code is pushed to a GitHub or Bitbucket branch.
  • Running CI or build jobs from Slack or Mattermost slash commands.
  • Letting a chat integration run a server-side command and reply with its result.

Quick start

  1. 1

    Build from source with Go 1.21 or newer

    go build github.com/adnanh/webhook
  2. 2

    Create a hooks.json file defining your hooks

  3. 3

    Start webhook with your hooks file in verbose mode

    /path/to/webhook -hooks hooks.json -verbose

Things to know

  • Hooks run shell commands on your server, so trigger rules and secrets should be configured to prevent unauthorized execution.
  • IP whitelist rules do not work as expected behind a reverse proxy.

In collections

Topics

FAQ

What is webhook?
A lightweight Go server that exposes HTTP webhook endpoints which run configured shell commands, passing request data as arguments or environment variables. webhook is a small Go program that turns incoming HTTP requests into shell command executions. You define hooks in a JSON or YAML file, each with an ID that becomes an endpoint such as /hooks/redeploy-webhook. When a request arrives, webhook parses its headers, payload and query variables, checks any trigger rules you configured, and passes the values to your script as command-line arguments or environment variables.
Is webhook free to use? What license does it have?
webhook is open source under the MIT license. Check the license terms before using it in commercial products.
Is webhook still maintained?
Updated within 6 months. The last commit to webhook was on Sep 4, 2026.
What can I use webhook for?
Triggering a redeploy script when code is pushed to a GitHub or Bitbucket branch. Running CI or build jobs from Slack or Mattermost slash commands. Letting a chat integration run a server-side command and reply with its result.
How do I install webhook?
Build from source with Go 1.21 or newer: go build github.com/adnanh/webhook Create a hooks.json file defining your hooks Start webhook with your hooks file in verbose mode: /path/to/webhook -hooks hooks.json -verbose
Where can I get webhook?
The source code and installation instructions are on GitHub: https://github.com/adnanh/webhook

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects