# express-github-webhook

> A Express middleware for handle Github Webhooks

Latest version **1.0.6** (published 2017-03-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install express-github-webhook
pnpm add express-github-webhook
yarn add express-github-webhook
bun add express-github-webhook
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2017-03-27 |
| First published | 2016-03-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 36 |
| Author | Jiang Sheng |
| Maintainers | gisonrg |
| Keywords | github, webhook, express, middleware |

## Links

- npm: https://www.npmjs.com/package/express-github-webhook
- Repository: https://github.com/gisonrg/express-github-webhook
- Homepage: https://github.com/gisonrg/express-github-webhook#readme
- Issues: https://github.com/gisonrg/express-github-webhook/issues
- npm.io page: https://npm.io/package/express-github-webhook

## Dependencies (1)

- [buffer-equal-constant-time](https://npm.io/package/buffer-equal-constant-time.md) ^1.0.1

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.6 (latest) — 2017-03-27
- 1.0.5 — 2016-03-12
- 1.0.4 — 2016-03-08
- 1.0.3 — 2016-03-06
- 1.0.1 — 2016-03-06

## README

# express-github-webhook
[![Build Status](https://travis-ci.org/Gisonrg/express-github-webhook.svg?branch=master)](https://travis-ci.org/Gisonrg/express-github-webhook)

A Express middleware for handle Github [Webhooks](https://developer.github.com/webhooks/)

To Install:
-----------
```
npm install express-github-webhook
```

To Use:
-------

**Make sure you use [body-parser](https://github.com/expressjs/body-parser) middleware for your Express app**

```javascript
var GithubWebHook = require('express-github-webhook');
var webhookHandler = GithubWebHook({ path: '/webhook', secret: 'secret' });

// use in your express app
let app = express();
app.use(bodyParser.json()); // must use bodyParser in express
app.use(webhookHandler); // use our middleware

// Now could handle following events
webhookHandler.on('*', function (event, repo, data) {
});

webhookHandler.on('event', function (repo, data) {
});

webhookHandler.on('reponame', function (event, data) {
});

webhookHandler.on('error', function (err, req, res) {
});
```

Where **'event'** is the event name to listen to (sent by [GitHub](https://developer.github.com/webhooks/#events), such as 'push'), **'reponame'** is the name of your repo.

**'error'** event is a special event, which will be triggered when something goes wrong in the handler (like failed to verify the signature).

Available options for creating handler are:

* path: the path for the GitHub callback, only request that matches this path will be handled by the middleware.
* secret (option): the secret used to verify the signature of the hook. If secret is set, then request without signature will fail the handler. If secret is not set, then the signature of the request (if any) will be ignored. [Read more](https://developer.github.com/webhooks/securing/)


TODO
-----------
* Add support for content type of `application/x-www-form-urlencoded`
* Provide more available options
* Get rid of `body-parser` middleware

License
=======

[MIT](LICENSE)

---
_Source: https://npm.io/package/express-github-webhook · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
