New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

webhook-manager

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webhook-manager

This is a NPM-Module for managing multiple incomming webhooks.

latest
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

Webhook-Manager

This is a lightweight npm-package to manage webhook-listeners.

What WebHooks are used for

Webhooks are "user-defined HTTP callbacks". They are usually triggered by some event, such as pushing code to a repository or a comment being posted to a blog. When that event occurs, the source site makes an HTTP request to the URI configured for the webhook. Users can configure them to cause events on one site to invoke behaviour on another. The action taken may be anything. Common uses are to trigger builds with continuous integration systems or to notify bug tracking systems. Since they use HTTP, they can be integrated into web services without adding new infrastructure.

Installation

npm i -s webhook-manager

How it works

To receive webhooks, we basically just need to setup a webserver and start listening for incomming POST-requests. This is, what this plugin does.

We setup an express-server on a specific port and then start listening for all incomming POST-requests. The requests get filtered, if a webhook is listening for it - if yes, then an event to this registered webhook gets emitted.

Usage

// Import the package
const WebhookManager = require("webhook-manager");

// Create a new instance of the Webhook-Manager with a specific port to listen on
const manager = new WebhookManager(4848);

// Just a listener for the "ready"-event
// It get's fired, when the manager is setup properly
manager.on("ready", () => {
    console.log(`WebhookManager started on port :${manager.PORT}`);
});

// Register a new Webhook-Listener
// It listens for everything, that goes directly to 'http://YOUR_SERVER:PORT/webhook
// The callback gets fired, when a webhook is received
//      'data' is the request, received by the listener
manager.on("/webhook", data => {
    console.log("Received webhook with following data:", data);
});

Keywords

webhook

FAQs

Package last updated on 06 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts