0.2.2 • Published 6 years ago

webhook-catcher v0.2.2

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

webhook-catcher

This is an express router to catch webhooks. So you add this router to your express server and this router will emit signal when webhooks are triggered by services.

Install

$ npm install webhook-catcher

Getting started

import WebhookCatcher from 'webhook-catcher'
import express from 'express'

const app = express()

const catcher = new WebhookCatcher({
  services: [ 'bitbucket', 'github' ],
  token: '...',
})

app
.use('/webhook', catcher.router)
.get('/', (req, res) => {
    res.send('ok')
})

catcher.on('push', (pullRequest) => {
  // pull request
  // {
  //   appName: ...,
  //   repositoy: ...,
  //   service: 'github' | 'bitbucket',
  //   branchSource: ...,
  //   branchDestination: ...,
  //   description: ...,
  //   title: ...,
  //   reviewers: ...,
  //   url: ...,
  //   see all fields in the following documentation
  // }
})

catcher.on('push', (push) => {
  // push
  // {
  //   appName: ...,
  //   repositoy: ...,
  //   service: 'github' | 'bitbucket',
  //   branch: '...', // which branch is concerned
  // }
})

Available services

For now, it manages services:

  • github
  • bitbucket

See how to define webhook in services in services documentation

If you want specific tokens for each service, you can also define the webhook catcher like this:

const catcher = new WebhookCatcher({
  services: [
    {
      name: 'bitbucket',
      token: '...',
    },
    {
      name: 'github',
      token: '...',
    }],
})

Available events

For now, it manages events:

  • push
  • pull request

See all events fields in events documentation

Links

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago