Build Apps for Google Home using Dialogflow

November 4, 2019
AI, All
by Rahil Shaikh
  • Building Conversational apps for Google assistant using Dialogflow

Dialogflow formerly knows as api.ai is an amazing tool for building conversational experiences. Google Home is a smart device that uses Google Assistant to get stuff done using voice commands or conversations.

In this tutorial, we will be creating a simple app on Dialogflow and try to interact with is using a Google Assistant-enabled device. As this our first tutorial on Dialogflow, we will build a very basic application that won’t be able to do much except answer a few questions.

The main goal of this article is to introduce you to building conversational apps for google assistant.

Setup Dialogflow Account

Go to dialogflow.com and sign in with your Google account. Once you are done, navigate to the console. Which looks something like below.

Create a New Agent

Agents in Dialogflow are like projects or applications. So go ahead and create one. For our tutorial, we will create an agent named Javascript. We will train this agent to answer a few questions on Javascript.

Create Intents

Now, intents in Dialogflow are something that will make your application understand what the end-user is requesting. What is the user’s intent or what does the user want to know about?

So let’s just dive into creating one. Our application is about Javascript, so the first thing it should know is “What is Javascript?”. When our user asks something like that, our app should reply with a short definition of Javascript.

An intent comprises of Contexts, Events, Training Phrases, Actions, Responses, and Fulfillment. Right now for the sake of simplicity, we will only be using Training Phrases and Responses.

So we will add training phrases like…

  1. What is Javascript?
  2. Tell me about Javascript
  3. Give me some information on javascript

To which our app should respond. How the app will respond depends on the responses. So let’s just go ahead and add response like “JavaScript is a programming language”

Make sure you click the save button.

So we have created our first intent named Definition. Let’s add another. This time let’s create an intent that will give us some info on the creation of Javascript.

Test our app on the Simulator

We can test our application using the simulator provided. To do so, click on Integrations, next click on Google Assistant. Keep the options to default and click Test.

By default the name of your app is The Test App. We can invoke our App by asking google assistantOk Google, Talk to the test App.

Here we asked our Test App, Javascript was created by?. To which our app correctly replies. If you notice, the question we asked does not match any of the training phrases exactly. But the Dialogflows AI is smart enough to understand and relate to the right intent.

Test our app on a Google Assistant powered device

We can also try out our app on a Google Assistant powered device like an Android Phone or Google Home. The only thing we need to take care of is that the Google Assistant on your device should be signed in using the same Google Account that you have used for integration.

Watch the video below to see me try it out!

Conclusion

This was just the basics of what we can do with Dialogflow combined with Google Assistant. In our further tutorials, we will cover more advanced concepts like Actions, Entities and talking to a back-end service. You can Subscribe to our newsletter to get notified.

Keep Learning…

About

Engineer. Blogger. Thinker. Loves programming and working with emerging tech. We can also talk on Football, Gaming, World Politics, Monetary Systems.

Get notified on our new articles

Subscribe to get the latest on Node.js, Angular, Blockchain and more. We never spam!
First Name:
Email:

Leave a Comment