Google Home Push Notifications Tutorial

Date: 29/10/2017 | Development, Google Home, Javascript, Programming

Developing Google home voice assist applications is great for those on demand requests. But what about those times where you need Google Home to notify you of events programmatically ?. There are a million scenarios where you might want this to happen. Maybe you would like to know when a certain stock has dropped below a value and you want to be informed immediately?. Or maybe you have time sensitive emails you need to respond to and would rather not check your laptop or phone every 5 minutes?. In this tutorial, I’m going to demonstrate how to achieve the latter scenario in a few short lines of code.



To complete this tutorial you are going to need the following :

Putting it all together:

  1. The first step is to create a new project folder and call it “ghome-demo”
  2. Inside your new folder, create a new blank file called index.js
  3. Using a terminal, install the following npm packages in your "ghome-demo" folder :
    • Inbox – npm install inbox
    • Google Home Notifier - npm install google-home-notifier
  4. Copy and paste the code below into the index.js file you created earlier.
    var inbox = require("inbox"),
    util = require("util");
    var googlehome = require('google-home-notifier');
    function main() {
        var client = inbox.createConnection(false, "", {
        secureConnection: true,
            user: "[email protected]",
            pass: "mypassword"
        debug: true
        client.on("connect", function(){
        client.openMailbox("INBOX", function(error, mailbox){
            if(error) throw error;
        client.on("new", function(message){
            console.log("New message:");
            console.log(util.inspect(message, false, 7));
            var title_1 = message.title;
            if(title_1 == 'this is my important email'  ){
    client.on('error', function (err){
      client.on('close', function (){
    function notifyUnit(devIP){
      googlehome.notify('Incomming Message! I have detected an email that might be of high importance to you. Please review as soon as possible. Thanks ', function(res) {
    // begin program
  5. Now update the Gmail credentials and the IP of your Google Home device. You will be able to obtain this information by logging into your router and retrieve your device IP.
  6. Now run the application by typing: $node index.js

Let’s test it:

This is a super easy step to complete. All your need to do is send yourself an email (the Gmail-email you provided in your index.js file) with the subject matter “this is my important email”.  Wait a few seconds and your Google Home device should respond with an alert. It’s that easy. If you have any cool idea’s you’d like to share or would like some assistance then please comment on this post.

Posted by: Shaun Case
Position: Technical Consultant
Date: 29/10/2017

Share On: