Google Home App with Node.js — A Song of API-ce and Firebase

Benjamin Zaslavsky
Jan 4, 2018 · 7 min read

Intro

Recently employed by an IT consulting company, one of my first clients was a very well known and established newspaper company in France. Since the famous Google Home was FINALLY coming to our country, my client wanted an app for it, and applied to be one of the first apps released with the device.

  • Give stories of the day and milestones for everyday of the year
  • Allow the user to play a trivia game about famous personalities.

Base setup

The base setup looks similar to the one this article, “How to create a custom private Google Home Action with API.AI and Google App Engine.”

It’s off to work we go!

First, don’t get me wrong here. The original developer on the project had done a great job. They simply had to move to another project where their expertise was needed. Since they started working on something else, and though they still remained as advisor on the project, I’ll be conveying this story in first person.

Advice from Google

The first attempt at making all these services work together implied the following workflow:

  • Actions on Google calls Dialogflow
  • Dialogflow calls the Firebase hook
  • The Firebase Function returns the proper welcoming screen, based of the number of times the user had already called the app, including that day
  • The user is prompted to ask the app for what they want it to do
  • The corresponding action is started.
  • Dialogflow was our Dispatcher, matching user speech with Intents
  • The Node.js Firebase Function was to be our brain, the collection of microservices, each one attached to a particular intent, encasing all the logic related to that action.

User — Question History Dev

Invigorated by this little chat with myself and the awesome team at Google, I started working right away. And with this new pattern, I was able to implement a clearer way to deal with users’ answers, good or bad, and to allow chaining questions if the user stated so.

Submission

At this point, there wasn’t much left for me to do. Minor tinkering, small wording corrections. On this subject, please note that spelling and syntactical rules apply. At least if you want your speech synthesis to be smooth and sound nearly human.

Review

Don’t think we left the app alone while waiting for the review. We came to a simple realization during this time…We were extensively testing our app, mainly because we were deeply enjoying ourselves and having fun, but we came across a little snag: the app had trouble understanding some of our statements.

Yay!

Node.js Collection

Community-curated content for the millions of Node.js users.

Benjamin Zaslavsky

Written by

PHP - Symfony /@nodejs developer and Community Committee Member, Mentor at @OpenClassrooms, tech enthusiast, young dad… Full time schedule.

Node.js Collection

Community-curated content for the millions of Node.js users.