{"id":19097555,"url":"https://github.com/codebrewery/web-node_webhook","last_synced_at":"2025-08-26T07:12:24.853Z","repository":{"id":239932715,"uuid":"89946347","full_name":"codebrewery/web-node_webhook","owner":"codebrewery","description":"Capture webhooks on a central server and run configured commands on the clients","archived":false,"fork":false,"pushed_at":"2017-11-21T13:40:25.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-21T16:26:03.518Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codebrewery.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-01T17:34:16.000Z","updated_at":"2017-05-10T20:18:15.000Z","dependencies_parsed_at":"2024-05-16T02:30:12.850Z","dependency_job_id":"36aba127-bb7f-4faf-97f2-48160ed3702a","html_url":"https://github.com/codebrewery/web-node_webhook","commit_stats":null,"previous_names":["codebrewery/web-node_webhook"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codebrewery/web-node_webhook","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebrewery%2Fweb-node_webhook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebrewery%2Fweb-node_webhook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebrewery%2Fweb-node_webhook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebrewery%2Fweb-node_webhook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codebrewery","download_url":"https://codeload.github.com/codebrewery/web-node_webhook/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codebrewery%2Fweb-node_webhook/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272187634,"owners_count":24888629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-26T02:00:07.904Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T03:41:31.574Z","updated_at":"2025-08-26T07:12:24.822Z","avatar_url":"https://github.com/codebrewery.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Webhook handler\n[![bitHound Overall Score](https://www.bithound.io/github/codebrewery/web-node_webhook/badges/score.svg)](https://www.bithound.io/github/codebrewery/web-node_webhook) [![bitHound Dependencies](https://www.bithound.io/github/codebrewery/web-node_webhook/badges/dependencies.svg)](https://www.bithound.io/github/codebrewery/web-node_webhook/master/dependencies/npm) [![bitHound Code](https://www.bithound.io/github/codebrewery/web-node_webhook/badges/code.svg)](https://www.bithound.io/github/codebrewery/web-node_webhook)\n\nThis is a lightweight server and client which will enable you to run shell commands on an instance via webhooks.\n\n[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/codebrewery/web-node_webhook)\n\n## Inspiration\n\nThis project was created as a hobby project for May 4th (StarWars day) which would enable a slack command in the office to have a cardboard r2d2 (with raspberry pi) to express it in r2-d2 speak. I used this python script https://github.com/hug33k/PyTalk-R2D2 for the r2-d2 sounds.\n\nAfter checking out this open-source project https://github.com/adnanh/webhook I'd decided the architecture was not actually what I wanted. I was looking for a central service which would consume the webhooks, and clients would be able to register and configure themselves and respond to the webhook requests. For communication between server and client I decided to go for socketio.\n\nSince it's actually a useful tool for automation and deployments, I've decided to open-source it.\n\n## How does it work?\n### Server\nThe server captures incoming POST requests, validates and relays them to the client. All webhook configuration is determined by the client and not the server.\n### Client\nThe client contains the configuration for the webhook and the command to run. It will connect to the server over a socket connection and authenticates using JSON webtoken. Multiple clients are supported as long as their APP (id) is unique.\n\n---\n\n## Install\n\n    npm install\n\n## Run\n### Server\n\n    npm run server\n    \n### Client\n\n    npm run client\n \n\n## Configuration\n\n### Environment variables\n\nThe server accepts the following environment variables:\n\n- `TOKEN` (Server/Client) This is the password the server will use to authenticate the client with, make sure to change it\n- `SECRET` (Server) The JWT secret\n- `SECRET_EXPIRY` (Server) The JWT secret expiry. Note that the JWT check is only done at socket connection and not in subsequent messages.\n- `PORT` (Server) The port the server will listen on. Default: 8080\n- `APP` (Client) The client ID, should be unique per client.\n- `SERVER_URL` (Client) The server URL which the client will connect with.\n\n### Webhooks\n\nNow this is the real meat.\n\nThe client will check for a `hooks.json` configuration file in the repo root, the user home directory and in the src directory in that order.\n\nThe `hooks.json` file holds the configuration for all the hooks. You can define multiple.\n\nExample `hooks.json` configuration:\n\n\t[\n\t  {\n\t    \"id\": \"r2d2\",\n\t    \"execute-command\": \"python3 ./r2d2.py\",\n\t    \"command-working-directory\": \"/Users/codebrewery/PyTalk-R2D2-master/src\",\n\t    \"response-message\": \"Executing r2d2 script\",\n\t    \"pass-arguments-to-command\": [\n\t      {\n\t        \"source\": \"payload\",\n\t        \"name\": \"text\"\n\t      }\n\t    ],\n\t    \"trigger-rule\": {\n\t      \"match\": {\n\t        \"type\": \"value\",\n\t        \"value\": \"\u003cYOUR-GENERATED-TOKEN\u003e\",\n\t        \"parameter\": {\n\t          \"source\": \"payload\",\n\t          \"name\": \"token\"\n\t        }\n\t      }\n\t    }\n\t  }\n\t]\n\nFor more info on the configuration I'd like to point to the json used in https://github.com/adnanh/webhook as I took that as a reference. They have a detailed wiki https://github.com/adnanh/webhook/wiki.\n\nCurrently only the `match` trigger rule is supported.\n\n## Security\n\nIt should be quite obvious but allowing an external influence run shell commands poses quite a security risk. Therefore I recommend you always run the server over SSL, change the default server `SECRET` and the `APP_TOKEN` environment variables.\n\n## Docker\n\n### Server\n\nYou are able to run the server in a docker environment. For production I would recommend to proxy it with for example nginx and only accept requests over SSL.\n\n### Client\n\nSince the client needs shell access, running it inside a container won't do anything for you.\n\n## TODO\n\n- Add tests, this is an open-source project and would like high coverage ;)\n- Add some tools, such as versioning and CI\n- Enable all json configuration based on https://github.com/adnanh/webhook/wiki/Hook-Definition\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodebrewery%2Fweb-node_webhook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodebrewery%2Fweb-node_webhook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodebrewery%2Fweb-node_webhook/lists"}