Google Assistant: Bring Development to your Local Machine

Akshay Nandwana
Jul 20, 2019 · 5 min read

Welcome to the fourth article of the series. Hope you had great fun creating count characters and win cool Google Swags. If not, please give a read to the previous article and Win the Prizes.

Image for post
Image for post

In this article, we are going to learn about how to bring development to our local machine. We are going to work on the terminal and also see about Node.js, Firebase command-line and text editor. Before starting with this article, if you are new to Actions on Google, please familiarize yourself with the previous articles in series.

Let’s begin with the Node.js.

Node.js is an open-source server runtime environment which allows you to run JavaScript on servers. Node.js uses asynchronous programming. It is a design pattern which runs the non-blocking code execution.

We have Modules in Node.js which are same as JavaScript Libraries. Set of Functions which we require in any of our project to perform specific tasks. Single File. And, A package is a directory of Modules and also consist of package.json file for metadata info.

So, To manage all these packages we have a manager which makes our work very easy is called NPM — Node Package Manager. This manager gets installed when we install Node.js.

Download Node.js from the official website

If you are on a mac using brew, it will be very easy to set up Node.js. All you need to do is:

brew update
brew install node
// now test it in terminal
node -v
npm -v
// update node if you had old version
brew upgrade node

know more about Homebrew here. 🍺

If you are on windows, simply follow the wizard you get after double-clicking on node.js MSI file which you had downloaded from the official website. It is very easy and after installation, you can test it on command prompt — cmd.

node -v
npm -v
Image for post
Image for post

Let’s talk about Text Editor now. We have different options like WebStorm, Atom or Sublime. Setup any of the text editor and let’s go to step three.

Now, we are going to install the Firebase Command Line Interface. The Firebase Command Line Interface allows us to view, manage and deploy to firebase projects. To begin with this step, I hope you had done with npm installation. We are going to require npm for this step.

Cloud Functions helps us to run the backend code on any specific event or action took place. For example — the user asks the assistant to know about our upcoming event. Event data has been added to the Firebase database. Now, it’s the cloud function who will deliver the data from the database to the user whenever it required.

Let’s install the command-line now. Run the below command on your terminal.

npm -g install firebase-tools// to update old firebase command-line interface
npm i -g firebase-tools

Check out here if you get any error after running this command.

// Login on firebase with your same account as on Actions on Google Console and Dialogflowfirebase login

Build better voice apps. Get more articles & interviews from voice technology experts at

Previously, we are using inline editor provided on the console which is a single file named index.js. When we bring the development on our local machine, this helps us in many ways like you can use version control to control projects.

I am using the project from count characters article.

First, create a folder on your local machine where you want to keep all your project file. Open Terminal and move to that folder.

// Initialize firebase to connect your local project with the project on consolefirebase init
Image for post
Image for post

This will ask you which feature you want to use. We will be requiring cloud functions so, move to Functions and press spacebar then hit enter.

Now, it will be going to ask for more things.

Image for post
Image for post

Select the firebase project with which you want to connect your Dialogflow project. Select it using spacebar and hit enter. Then select JavaScript and hit enter.

Firebase Initialization Done.

Image for post
Image for post

If there is any update available, it will ask you to update it.

Now, I need all my intents and other related files from Dialogflow as a zip. Open Dialogflow console -> Click on the gear icon on the top left ->Click on Export and Import and then click on Export as zip.

Image for post
Image for post

Now, put this zip file into your folder. We are ready for deployment now.

Go to your firebase console, Click on the gear icon on top (settings) -> Project settings -> and copy project id.

On your terminal run the following command

firebase use --project <your_project_id>npm installfirebase deploy --project <your_project_id>
Image for post
Image for post

Deployment Complete 👍

Go to firebase console -> Click on Functions from the left sidebar and copy the Request URL.

Image for post
Image for post

Open Dialogflow -> Go to fulfilment -> disable inline editor -> enable webhook -> paste the URL

Image for post
Image for post

Now, Test your action. Click on the “Google Assistant” on the right side.

Image for post
Image for post

Congratulations 🎉 We had successfully deployed our webhook to Firebase.

I had added some visual components to the assistant response. We are going to learn about them in upcoming articles.

If you find this reading useful, please click the 👏 button and share to help others find it! Feel free to leave a comment 💬 below.
Have feedback? Let’s be friends on

Voice Tech Podcast

Voice technology interviews & articles.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store