Kerberos.io WebHooks module extensible using plugins
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
lib
plugins
test
.codeclimate.yml
.eslintignore
.eslintrc
.gitignore
.jshintrc
.travis.yml
LICENSE
README.md
index.js
package.json
webhook-init-d

README.md

Greenkeeper badgeBuild Status Code Climate Test Coverage Issue Count

kerberosio-hooks

Kerberos.io WebHooks extensible module to be notified where you need if anything happens on you Kerberosio

Requirements

To use this script you need a recent version of NodeJS (the 0.10.X is not supported). I suggest you to use the latest LTS version. To install it on your RPi the easy way is using NVM (Node Version Manager https://github.com/creationix/nvm)

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
nvm install --lts
nvm alias default <the lts version installed>
nvm use default

Installation

Clone the project on your system:

git clone https://github.com/mmornati/kerberosio-hooks

Install all dependencies using npm:

cd kerberosio-hooks
npm install

Configuration

To use this module you need to configure into the config/default.json file containing basic parameters and all the module's too.

{
  "server_port": 8080,
  "activated_plugins": ["pushbullet"],

}
  • server_port: configure the listen port for the WebHook server_port
  • activated_plugins: list of plugins you want to use (contained into the plugins folder)

Pushbullet Configuration

{
  "pushbullet_key": "test",
  "device_id": "",
  "images_base_url": "https://media.home.mornati.net/'",
  "images_base_path": "/mnt/kerberosio/machinery/capture/",
  "image_method": "PATH"
}
  • pushbullet_key: is the API key you can obtain on the Pushbullet website
  • images_base_url: used as base image path to upload the image to Pushbullet (the url should be accessible from internet).
  • images_base_path: local path where Kerberos.io images are stored.
  • image_method: which method you want to use to upload the image to pushbullet (PATH/URL). The default is the local PATH.
  • device_id: If you want to notify only one device, you can configure the Pushbullet device id here.

WebHook Usage

To start the WebHook Listener you can use the following command line:

node index.js

A webserver will be started on the configure port (by default 8080). Into the Kerberos.io configuration you can then configure the URL of the server: http://ip:port/kerberosio The sent message will contain some information about the detection (image url, time, ...).

Init.d Service

You can start your service in background and configure to start it up automatically when the system starts up.

First of all you need to install forever

npm install -g forever

Then you can simply use (and configure) the sample init.d script placed in the root source folder (webhook-init-d).

sudo cp webhook-init-d /etc/init.d/webhook
sudo /etc/init.d/webhook start