Map Github webhook events to their names
Latest commit f4706bd Oct 27, 2015 @mixu 1.1.0
Failed to load latest commit information.
sample-events Initial commit Oct 22, 2015
.gitignore Initial commit Oct 22, 2015
.npmignore Initial commit Oct 22, 2015
event-names.json Initial commit Oct 22, 2015
generate.js Add .target() function Oct 28, 2015
index.js Add .target() function Oct 28, 2015
mapping.json Initial commit Oct 22, 2015
package.json 1.1.0 Oct 28, 2015 Add .target() function Oct 28, 2015
test.js Initial commit Oct 22, 2015


Map Github webhook events to their names


  • Using the Github webhooks / services API with AWS Lambda can be annoying because by default, AWS Lambda strips out request headers and getting them back requires a bunch of fiddly configuration (and Github webhooks pass the event type in a header).
  • identify-github-event identifies Github webhook events based on their payload and returns the event name
  • since v1.1.0: can also return the user, repo and branch information from a Github event (except for MembershipEvent which does not contain that information).
  • Tested on the example events listed on the Github Events API page.
  • note that Github events have unique signatures as long as you look at the full set of key names; if this ever becomes not true then some events may be confused with each other since some events share key names (but not key name signatures; e.g. difference(event.keynames, union(other.keynames)) is an empty set for some events like PublicEvent and).
  • the type key, which is not present on webhooks/services but is present on Events API calls is used if it is available (after validating it against the list of known events)
  • the NPM version filesize is quite small - it only includes the signatures and the wrapper code


npm install --save identify-github-event


var identifyGithubEvent = require('identify-github-event');

// returns the CamelCased name, e.g. PushEvent (or undefined if the event signature is unknown)

// returns a hash { user: 'name', repo: 'somename', branch: 'somebranch' }


The mapping.json and event-names.json files are automatically generated via npm prepublish script. To run it manually, run npm run-script prepublish.