npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

appsoma-webhooks

v0.2.1

Published

Execute arbitrary operating system commands in a sandbox when webhook calls are received.

Downloads

2

Readme

Webhooks

Execute arbitrary operating system commands (called "actions") in a sandbox when webhook calls are received.

Usage

Start the server:

supervisor -n error webhooks.js

The server automatically adjusts itself if you change the webhooks-config.json file - no restart needed.

Try It!

Visit the URL of your webhook server to see a web page that lets you experiment.

To make an action that responds to a webhook:

  1. Edit webhooks-config.json
  2. In the actions section add this line:
"/mycommand": "echo this is my command!"

You do NOT need to restart the server - it watches the config file automatically.

  1. Visit http://yourserver:7788/mycommand.
  2. Watch the console. It worked!

Attaching Actions

The file webhooks-config.json lets you set up commands to run when webhooks are received.

webhooks-config.json

{
  actions: {
    "/helloworld": "echo hello world",
    "/badcommand": "commandDoesNotExist",
    "/getResult": {
      command: "echo This is a returned result. My uid is $webhook_uid",
      respond: true
    }
}

Responses

By default, webhooks.js responds with code 200 and "OK" in the response body.

Setting respond: true makes the HTTP response wait until the command's process is complete, and then causes it to pass back:

{
  "uid": 132,
  "stdout": "this is my stdout\n",
  "stderr": "any errors show here",
  "exitCode": 0
}

Environment Variables

The following environment variables will be available to any command you run:

webhook_url       the localhost:port webhooks is using
webhook_uid       the unique id of this webhook call
webhook_path      the path of the webhook
webhook_command   the command being run
webhook_headers   the headers of the incoming webhook
webhook_query     the query section of a 'get' webhook
webhook_body      the body section of a 'post' webhook
webhook_{key}     each key in a 'get' webhook will be assigned

Installation

git clone https://github.com/appsoma/webhooks.git
cd webhooks
npm install

Subscribe to Live Webhook Feed

You can see all webhooks happen in real time by connecting to the server with a websocket client. Here is a working example: index.html