1.0.3 • Published 5 years ago

kandilli v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

AUTO PILOT

Auto Pilot retrieves the earthquakes from Kandilli's official website and sends notifications via Slack application.

Installing

A step by step series of examples that tell you how to get a development env running

First of all, install the package using:

npm install kandilli

or

yarn add kandilli

Before running the application, you need to set the SLACK_TOKEN by creating a file called nodemon.json

touch nodemon.json

Then, copy the content into this file

{
    "env": {
        "SLACK_TOKEN": "xoxp-xxxx-xxxx-xxxx"
    }
}

Running the development server

After importing the package with

const kandilli = require('kandilli')

you can simply run the function for each X minutes using setInterval function.

const SECOND = 1000
const MINUTE = SECOND * 60

let earthQuakes = []

earthQuakes = kandilli(earthQuakes)
setInterval(function () {
  earthQuakes = kandilli(earthQuakes)
}, MINUTE * 5)

If function detects any newly occurred earthquakes, it will send a slack notification to given SLACK_TOKEN's channel.

Authors

See also the list of contributors who participated in this project.