Using Google Assistant to trigger a flow in Node-Red using Webhooks

IFTTT / Webhooks Full Node-Red flow

I’ve been playing around with webhooks. I have already shown how to push custom automations through Alexa, but I also own a Google Home Assistant, so i thought I would have a go at trying to achieve the same type of communication. I thought I would start with IFTTT.com. For those of you who aren’t familiar, IFTTT is basically a service that’s based on individual APIs and allows you to connect various applications together to help make life easier. It has components for most of the social media apps and integrates well with common services such as evernote, dropbox, gmail etc.I personally find it pretty clunky and not always reliable, but others swear by it. One useful feature it does have is webhooks. By using webhooks and a suitable server, you’re able to create an API which allows you to send a request in IFTTT and then have it trigger something in Node-red.

There are a couple of steps we need to go through to first set this up.

We need to set up an account here: https://my.webhookrelay.com/
This is free, but does have some limits on API hits etc. You can oauth using Google or Github to make it easier.
You will need to remember your login details as you’ll be logging into the server via node-red shortly.

You can then follow the instructions here in full: https://webhookrelay.com/v1/installation/node-red

In essence, you’re installing the following palette: node-red-contrib-webhookrelay
Once installed, you need to create a “bucket” (think of it as an API) and you need to retrieve your personal key and token from https://my.webhookrelay.com/tokens.

Once you have the Key and Secret (token) authenticate it in Node-red.

node-red webhook relay authentication
node-red webhook relay authentication

 

Once done, set up a simple debug node outputting from the webhook relay for testing.
See below:

webhook relay test node
webhook relay test node

Now we need to go to IFTTT and then configure the appropriate input to send out to the “bucket”/webhook.

I have already connected my google home account to IFTTT. I select Google Home as my input, and fill out the first half of the applet as follows:

IF Google Assistant => Say Simple Phrase, then THEN webhooks. For the sake of this tutorial, just fill in the bare minimum it wants you to so that you can actually create the applet. Once you have it there, you can edit it in its entirety. Below you can see mine. I removed my webhook for security reasons, but you just add your phrase and your webhook (inclduding any commands at the bottom that you want Node-red to pass through).

First half of the applet

First half of the applet

Second half of the applet
Second half of the applet

You can also have Google Assistant return a voice notification to you if needed. Amend the JSON at the end to trigger something more complex but for this simple example, it should be enough to get you going. Once you hit save, you can trigger the applet and see if it registers in Node-red.

IFTTT / Webhooks Full Node-Red flow

IFTTT / Webhooks Full Node-Red flow

Hopefully this works for you. Any issues let me know. Be sure to check my other posts here for more info:

www.thesmarthomebook.com/blog/

and for those of you interested in renovating your home or completing your new build with structured wiring, check out my book:

www.thesmarthomebook.com

Andy

 

Comments

Leave a Reply