@porla-contrib/webhook

0.2.0 • Public • Published

Webhook plugin for Porla

The webhook plugin can send HTTP POST requests with custom payload data. Use it to integrate with other HTTP services.

Usage

The webhook function takes two arguments. The first is the URL to POST data to, and the second is a transform function that takes the event parameter and returns an object that gets sent as the JSON payload.

const { Porla } = require('@porla/porla');
const webhook = require('@porla-contrib/webhook');

const app = new Porla();

app.subscribe('torrent.added', [
    webhook('http://example.com', _ => {
        return {
            id: _.torrent.infoHash
        };
    })
]);

/@porla-contrib/webhook/

    Package Sidebar

    Install

    npm i @porla-contrib/webhook

    Weekly Downloads

    0

    Version

    0.2.0

    License

    MIT

    Unpacked Size

    2.4 kB

    Total Files

    3

    Last publish

    Collaborators

    • vktr