maker-ifttt

1.0.0 • Public • Published

Maker-IFTTT

A small library that generates triggers on the Maker channel of IFTTT.

Installation

npm install maker-ifttt --save

Usage

// Activate the Maker channel on IFTTT to get your key
var maker = require('maker-ifttt');
var trigger = new maker(IFTTT_MAKER_KEY);

/* Triggers an event with
 *     value1 = 'from Mike'
 *     value2 = null
 *     value3 = null
 * Logs the response from IFTTT to the console.
*/
trigger.triggerEvent('hello_world', 'from Mike', function (res) {
    res.setEncoding('utf8');
    res.on('data', function (chunk) {
        console.log('Response: ' + chunk);
    });
});

/* Triggers an event with
 *     value1 set = current date
 *     value2 = 'open'
 *     value3 = null
 * Ignores the response from IFTTT.
*/
trigger.triggerEvent('door_state', [new Date().getTime(), 'open']);

/* Triggers an event with
 *     value1 set = current date
 *     value2 = 'unlocked'
 *     value3 = 'Kitchen Window'
 * Ignores the response from IFTTT.
*/
trigger.triggerEvent('window_state', {
    value2: 'unlocked',
    value1: new Date().getTime(),
    value3: 'Kitchen Window'
});

/* Triggers an event with
 *     value1 = null
 *     value2 = null
 *     value3 = null
 * Ignores the response from IFTTT.
*/
trigger.triggerEvent('door_opened');

Readme

Keywords

Package Sidebar

Install

npm i maker-ifttt

Weekly Downloads

0

Version

1.0.0

License

ISC

Last publish

Collaborators

  • manderson10