1.4.4 • Published 3 years ago

simple-webhook-github v1.4.4

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Simple Webhook Github

npm.io

This package is used to spin up a webserver to get POST requests from github webhook.

Installing

npm install simple-webhook-github

Examples - Simple

You can setup a simple webhook like this..

Typescript

import SimpleWebhook from "simple-webhook-github";

const Port = 3000;
const webhook = new SimpleWebhook(Port);

webhook.listen("everything", response => {
    // Do something
})

JavaScript

const SimpleWebhook = require("simple-webhook-github").default;

const Port = 3000;
const webhook = new SimpleWebhook(Port);

webhook.listen("everything", response => {
    // Do something
})

Examples - Express

You can also use express as an middleware

Typescript

import SimpleWebhook from "simple-webhook-github";
import Express from "express";

const Port = 3000;
const app = Express();
const webhook = new SimpleWebhook(app);

webhook.listen("everything", response => {
    // Do something
})

app.listen(Port);

JavaScript

const SimpleWebhook = require("simple-webhook-github").default;
const Express = require("express");

const Port = 3000;
const app = Express();
const webhook = new SimpleWebhook(app);

webhook.listen("everything", response => {
    // Do something
})

app.listen(Port);

Configurations

...
interface Options 
{
    /**
     * @param endpoint The endpoint for the webserver
     * @default /webhook
     */
    endpoint: string;

    /**
     * @param secret The secret from github, needs to equal to each other
     */
    secret: string;
}
...

Webhook paramenters

SimpleWebhook(Port or Express, Config)

On event

The on event includes events that can happen in the webhook, like errors etc.

Typescript

import SimpleWebhook from "simple-webhook-github";

const Port = 3000;
const webhook = new SimpleWebhook(Port);

webhook.on("error", (error) => {
    console.log(error);
})

Discord

Discord

1.4.4

3 years ago

1.4.3

3 years ago

1.4.2

3 years ago

1.4.0

3 years ago

1.3.9

3 years ago

1.3.8

3 years ago

1.3.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago