arrow_back

Google Assistant: Qwik Start - Dialogflow

Join Sign in

Google Assistant: Qwik Start - Dialogflow

1 hour 15 minutes 1 Credit

GSP263

Google Cloud self-paced labs logo

Overview

Google Assistant is a personal voice assistant that offers a host of actions and integrations. From sending texts and setting reminders, to ordering coffee and playing your favorite songs, the 1 million+ actions available suit a wide range of voice command needs. Google Assistant is offered on Android and iOS, but it can even be integrated with other devices like smartwatches, Google Homes, and Android TVs.

As you will soon find out, Actions is the central platform for developing Google Assistant applications. Actions work with a number of human-computer interaction suites, which simplifies conversational app development. Out of all the platforms, the most popular is Dialogflow, which uses an underlying machine learning (ML) and natural language understanding (NLU) schema to build rich Assistant applications.

In this lab you will get hands-on practice with Actions and Dialogflow by building an Assistant application that generates quotes when prompted by a user. You will gain practical knowledge of computer-human interaction suites and by the end of this lab, you will have successfully built a fully-fledged Google Assistant application.

What you will Learn

In this lab, you will learn how to:

  • Differentiate between the basic components and services that make up an Assistant application.

  • Create an Actions project.

  • Integrate Dialogflow with an Actions project.

  • Build a Dialogflow intent that handles quotation responses.

  • Update your Google permission settings.

  • Test your application with the Actions simulator.

Prerequisites

This is an introductory level lab. This assumes little to no prior experience developing Google Assistant applications. However, basic knowledge of the Cloud Console and the Qwiklabs platform is expected. If you are a new Google Cloud or Qwiklabs user, please take the following lab before attempting this one:

Once you're ready, scroll down to get your Actions project set up.

Create an Actions project

Before we start building our quotation generator, let's review the following terms one more time.

Google Assistant is the virtual assistant that's found on smartphones, homes, and a host of other devices. It's the application that takes in voice commands and completes tasks based on user input.

Actions on Google is the developer platform that allows you to build applications for Google Assistant. This is going to be the central console for conversational application development.

Let's take our first step by building an Actions project.

Open a new tab in your browser and go to the Actions on Google Developer Console. Then sign in with your temporary lab credentials. Once you are signed in, you should be looking at a clean Actions console, which should resemble the following:

5948ab7cb1e69290.png

Click New project and agree to the Actions on Google Terms of Service that appears. Next, click on the project field, select the Google Cloud project ID for Qwiklabs, and click Import project:

project-import.gif

Soon after you will be presented with a welcome page that resembles the following:

actions-console.png

Click on Actions Console in the top left corner. Then click on the project you just created (title has your Project ID as the name.)

Test your Understanding

Below are a multiple choice questions to reinforce your understanding of this lab's concepts. Answer them to the best of your abilities.

Set up Dialogflow

Next, go to Build your Action > Add Action(s). Click Get started. Then select Custom Intent > BUILD:

297e7815f62b4452.png

This will take you to the Dialogflow console.

Select your Qwiklabs account and click Allow when Dialogflow prompts you for permission to access your Google Account.

When you land on the Dialogflow page, check the box next to Yes, I have read and accept the agreement and click ACCEPT:

terms.png

You will then be brought to the Dialogflow agent page. Click CREATE in the top right corner.

In the last few steps you were introduced to some new terms. Let's take a moment to review them:

  • Action: an interaction built for Google Assistant that performs specific tasks based on user input.
  • Intent: the goal of the Action (e.g. generate quotes). An intent takes user input and channels it to trigger an event.
  • Agent (Dialogflow): a module that uses NLU and ML to transform user input into actionable data to be used by an Assistant application.

Here is a handy cheat sheet that you can reference if you run into any unfamiliar terms.

Test Completed Task

Click Check my progress to verify your performed task.

Create a Dialogflow agent

Build a custom Dialogflow intent

From the left-hand menu select Intents and then click on CREATE INTENT in the top right corner.

This will bring you to a fresh Intent template that's ready to be filled in.

For the Intent name enter in Quote generator.

Then click on ADD TRAINING PHRASES and add the following user expressions:

  • Give me a quote.
  • How about a quote?
  • Give me some inspiration.
  • Supply me with a quote.

TrainingPhrases1.png

At the bottom in the Responses section click ADD RESPONSE. Now add the following Shakespeare quotes as Text responses (or feel free to add your own!):

  • If music be the food of love, play on.
  • This above all; to thine own self be true.
  • Some are born great, some achieve greatness, and some have greatness thrust upon them.
  • Love all, trust a few, do wrong to none.
  • The course of true love never did run smooth.
  • But if the while I think on thee, dear friend, all losses are restored and sorrows end.

Responses2.png

Now click SAVE in the top right corner.

Test Completed Task

Click Check my progress to verify your performed task.

Create a Quote generator Dialogflow intent

Check your Google Permission Settings

To test the quote generator, you will need to enable the necessary permissions.

Go to the Activity Controls page and sign in with your Qwiklabs credentials if prompted.

Ensure that the following permissions are enabled by clicking on TURN ON button for the following cards (confirm by clicking on Turn on > Got it):

  • Web & App Activity

Now close the Activity Controls page.

Test your understanding

Below are a multiple choice questions to reinforce your understanding of this lab's concepts. Answer them to the best of your abilities.

Test the quote generator

Return to the Dialogflow Console. Then from the left-hand menu, click Integrations then click on integration link inside the Try Actions Builder section.

Then click TEST:

GoogleAssistant3.png

To invoke the Action, click on the Talk to my test app button from the left-hand menu. You should be presented with a similar output:

ActionsConsle4.png

Now go ahead and type in one of the training phrases (for example "Give me a quote") in the input box and press Enter. You should receive one of the Shakespeare quotes that you added in the response section:

de78b765043fdfe4.png

You can keep repeating this process—entering in one of the training phrases to get a random Shakespeare quote—as many times as you want!

When we create an Intent, Dialogflow uses it's ML and NLU processing to auto generate prompts that are similar to the training phrases you entered in. This is a nice feature to have because your user's prompts don't have to exactly match your training phrases. This also simplifies development because you don't have to add every possible prompt to your training phrases—Dialogflow intelligently handles all of this behind the scenes.

To see this in action, type in a prompt that isn't in our training phrases (but still gets the same message across.) For example, try typing in new quote or more inspiration into the input box. You will be returned with a Shakespeare quote:

b25674b68449b063.png

Once you've gotten enough inspiration, type quit to exit the simulation.

Congratulations!

Great job building your first Google Assistant application! You got a high level overview of the Actions console, Dialogflow, and the other components that go into creating a Google Assistant Application. In just 30 minutes you were able to build your own quotation generator, not bad for just starting out.

Finish Your Quest

assistant-badge.png quest-logo.png

Continue your Quest with OK Google: Build Interactive Apps with Google Assistant and Baseline: Deploy & Develop. A Quest is a series of related labs that form a learning path. Completing this Quest earns you the badge above, to recognize your achievement. You can make your badge (or badges) public and link to them in your online resume or social media account. Enroll in this Quest and get immediate completion credit if you've taken this lab. See other available Qwiklabs Quests.

Next Steps / Learn More

This lab is part of a series of labs called Qwik Starts. These labs are designed to give you a little taste of the many features available with Google Cloud. Search for "Qwik Starts" in the lab catalog to find the next lab you'd like to take!

Google Cloud training and certification

...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.

Manual Last Updated January 11, 2022
Lab Last Tested January 11, 2022

Copyright 2022 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.