A really simple webhook receiver.
Go to file
2023-10-28 22:41:38 +01:00
config AppendHeaders 2023-10-28 21:48:54 +01:00
.gitignore update gitignore 2023-10-28 21:46:58 +01:00
config.json AppendHeaders 2023-10-28 21:48:54 +01:00
Dockerfile Add Dockerfile 2021-07-29 08:09:04 +01:00
example.sh AppendHeaders 2023-10-28 21:48:54 +01:00
go.mod update module path thingy 2022-01-21 21:08:05 +00:00
go.sum Initial commit 2021-07-28 16:20:06 +01:00
gohookr.service Update service file to restart on app crash 2021-07-29 09:46:33 +01:00
main.go AppendHeaders 2023-10-28 21:48:54 +01:00
Makefile update makefile 2023-10-28 21:46:15 +01:00
readme.md include appendheaders in readme example config 2023-10-28 22:41:38 +01:00


A really simple webhook receiver, which listens at /webhooks/<webhook-name>.


After you install go:



Default config path is /etc/gohookr.json. It can be overriden by setting environment variable CONFIG.

Check below for an example configuration, which should tell you most of the things you need to know to configure gohookr.

Currently gohookr must be restarted after config changes.

Signature Verification

Signature verificaiton is done using SHA256 HMACs. You must set which HTTP header gohookr will receive a signature from using the SignatureHeader key for each service. You should also specify a shared secret in the Secret key.

You may also need to specify a SignaturePrefix. For GitHub it would be sha256=.

Disable Signature Verification

You can disable signature verification by setting DisableSignatureVerification for a service to true.

You can disable signature verification for all services by setting environment variable NO_SIGNATURE_VERIFICATION to true.

Writing Commands

gohookr doesn't care what the command is as long as the Program is executable. You can specify extra arguments with the Arguments field. You can ask it to put the payload as the last (or second to last if AppendHeaders is set) argument by setting AppendPayload to true. You can ask it to put the request headers as the last argument by setting AppendHeaders to true.

Writing Tests

gohookr can run test before running your script. Tests must be in the form of bash scripts. A non-zero return code is considered a fail and gohookr will run no further tests and will not deploy.

Tests are run in the order they're listed so any actions that need to be done before tests are run can simply be put in this section before the tests.

Example Config

Required config keys are ListenAddress and Services.

Requried keys per service are Script.Program, Secret, SignatureHeader.

An example config file can be found here but also below:

  "ListenAddress": "",
  "Services": {
    "test": {
      "Script": {
          "Program": "./example.sh",
          "AppendPayload": true,
          "AppendHeaders": true
      "DisableSignatureVerification": true,
      "Tests": [
          "Program": "echo",
          "Arguments": [ "test" ]
    "fails_tests": {
      "Script": {
          "Program": "./example.sh",
          "AppendPayload": true
      "Secret": "who_cares",
      "SignatureHeader": "X-Hub-Signature-256",
      "SignaturePrefix": "sha256=",
      "Tests": [
          "Program": "false",
          "Arguments": []