@knight_42/octopus

0.3.6 • Public • Published

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.

Reference

Package Sidebar

Install

npm i @knight_42/octopus

Weekly Downloads

0

Version

0.3.6

License

MIT

Last publish

Collaborators

  • knight_42