@knight_42/octopus
v0.3.6
Published
Yet another tiny and dedicated webhook handler
Downloads
14
Maintainers
Readme
Octopus
Yet another tiny, dedicated and extensible webhook handler.
Installation
$ npm i @knight_42/octopus
Usage
import octopus from '@knight_42/octopus'
// The listening port can be specified via parameter or `process.env.PORT`
// By default, it is 8080
const hook = new octopus({ port: 10080 })
hook.github({ secret: 'IAmAToken' })
.subscribe('issues', data => {
console.log('new issues')
})
.subscribe('ping', data => {
console.log('pong')
})
hook.gitlab({ path: '/gitlab' })
.subscribe('push', data => {
console.log(data.object_kind)
})
.subscribe('merge_request_note', data => {
console.log('new comments')
})
hook.travisci({ path: '/notification' })
.subscribe('*', console.log)
All available events can be found at:
And the data callback functions took is the request body (or the payload
data for travis-ci) in JSON.