gitmyhub

webhook

Go ★ 12k updated 4mo ago

webhook is a lightweight incoming webhook server to run shell commands

A lightweight Go server that listens for HTTP requests and runs shell commands in response, commonly used to trigger auto-deployment scripts when code is pushed to GitHub or when Slack slash commands arrive.

Gosetup: moderatecomplexity 3/5

Webhook is a small server program written in Go that listens for incoming HTTP requests and runs shell commands in response. You configure it with a list of hooks in a JSON or YAML file, where each hook has a URL endpoint, a command to execute, and optional rules that must be satisfied before the command runs. When a matching request arrives, the tool executes the command and optionally passes values from the request (headers, query parameters, or payload fields) into the command as arguments or environment variables.

A common use for this is automatic deployment: you tell your code hosting service (such as GitHub or Bitbucket) to send an HTTP request to your server whenever new code is pushed, and webhook receives that request and runs your deploy script. Another use is accepting slash commands from chat tools like Slack or Mattermost and having those commands trigger scripts on your server.

The rules system lets you restrict when a hook fires. You can require a specific secret token, check that a request comes from a particular IP range, or verify a cryptographic signature in the request headers. Without at least one rule, any HTTP request to the endpoint would trigger the command, which would be a security risk.

The server starts on port 9000 by default and can run over HTTPS if you provide a certificate and key. It can also run behind a reverse proxy like Nginx. Installation options include package managers on Ubuntu, Debian, and FreeBSD, prebuilt binary downloads from the releases page, or building from the Go source directly.

The tool is intentionally minimal: it receives requests, checks rules, and calls commands. Anything beyond that is handled by the scripts or programs you point it at.

Where it fits