maker-webtask
v1.0.14
Published
Consume message between IFFT (Maker) and other webtask-queue consumers
Downloads
7
Readme
maker-webtask
Consume message between IFFT (Maker) and other webtask-queue consumers
Setup
- Follow the
- Setup your IFTTT Channel to listen for maker commands at the queue output above. You will want it to POST a body similar to the below:
{
"device": "<NAME OF DEVICE TO LISTEN FOR>",
"command": "<SPECIFIC DETAILS TO REACT UPON>"
}
- Set an environment variable for the webtask queue above
- Set the environment variable
MAKER_WEBTASK_URL
giving it the above url - Set the environment variable
WEBTASK_SECRET
giving it the secret used in the step above - Add the package as an NPM package reacting to these commands
var makerWebtask = require('maker-webtask');
var webtaskUrl = ...; // The url from the first step above
function turnOnLight(message) {
if (message.command === 'on') {
// Turn light on
}
}
var pollingInterval = 5; // Check the queue every 5 seconds due to quotas
makerWebtask.run('lightbulb', turnLightOn, pollingInterval);
With the above example, when Maker calls the above URL with the following body:
{
"device": "lightbulb",
"command": "on"
}
The light will turn on.