Using Node-RED to trigger IFTTT events

I recently set up a Node-RED node that can interact with IFTTT. The node interacts with the Maker Channel on IFTTT and allows you to either send or receive messages to IFTTT. This means that you can connect your home system to the vast range of input and output channels that IFTTT supports.

Install the IFTTT node (UPDATE, no longer listed in the Node-RED library, see note at the bottom of the page) by navigating to the Node-RED directory and running:

npm install ttb-ifttt

To test this node I tried it out with the sun events node. This node is easy to set up. All you need to do is enter your Latitude and Longitude. For debugging you can check “Make hours seem like minutes? (test mode)”, this will trigger a full 24 hours worth of events in 24 minutes! Node-RED Sun Event

To set up the IFTTT node sign in to your IFTTT account, connect to the Maker Channel and copy the key to the node settings on Node-RED.

Node-RED IFTTTNode-RED IFTTT info

The next part took me a while to figure out. Initially I thought it would be a case of  adding msg.payload to the Value boxes on the node settings, but all that did was send the string “msg.payload” to IFTT. Finally I figured out by studying the Node info shown that what I needed to do was insert an extra function node in between the Sun Event node and the IFTTT node and use it to set msg.value1. The Value boxes on the settings can be used to add static values that can be sent to IFTTT, as shown in the example in the node info. The function is as simple as:

msg.value1 = msg.payload;
return msg;

If you want to import this flow it’s at the bottom of this post: 

UPDATE: I realised recently that this IFTTT node is no longer listed in the Node-RED library but it does still seem to be available in NPM and can still be installed by running npm install ttb-ifttt. The alternative IFTTT node now available is https://flows.nodered.org/node/node-red-contrib-ifttt. The main difference is that the message needs to be msg.payload.value1 etc instead of msg.value1.

Add a Comment

Your email address will not be published. Required fields are marked *