0.2.0 • Published 7 years ago

@porla-contrib/webhook v0.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

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
        };
    })
]);