Assistant & … Pizza 🍕 — Overview — Part 1

Build Actions on Google Assistant with Kotlin — Build your first: “Hey Google, what is the next …”

--

This article is part of a series “Build Actions on Google Assistant with Kotlin!”
Overview | Dialogflow | Intent | Backend | Tips & Tricks

Nowadays we are surrounded by smart devices that can understand what we say, from Android smartphones to smart speakers powered with Google Assistant.

These “smart” devices are great if we want to play some music or for setting up a timer. Unfortunately, if we ask something more challenging, the answer we get is way too often a “Sorry, I don’t know how to help you”.
Let’s see if we can help them 😁

Photo by Kevin Bhagat on Unsplash

How to build a smarter assistant

Actions on Google let you extend the functionality of Assistant making any device able to respond to a huge variety of other situations:

  • Local business: “Hey Google, what are the special offers by Incredible Amazing Pizza?”
  • Events: “Hey Google, when is the next DevFest Levante?”
  • Services: “Hey Google, where is the closest available City Bike?”
  • just any information available in digital format.

Start your first Action on Google

Now, let’s start with an example, we want to help the customers of our imaginary “Incredible Amazing Pizza” restaurant.

Before we dive into how we can build our Action, we have to understand how a user can interact with Google Assistant.

There are 2 ways to do so:

  • Explicit intent: user says they want to talk to our Action by using the complete name

Example: user says “Hey Google, talk to Incredible Amazing Pizza”

  • Implicit intent: user asks a generic question that can be handled by our Action

User says “Hey Google, what are the ingredients of a Margherita?”

Explicit intent

Graphically, this is what happens when a user asks to talk to an Action:

  • User: “talk to Incredible Amazing Pizza”
  • Google Assistant opens our Action by starting the Welcome event
  • User asks supported questions
  • Google Assistant processes requests and responds to user

From a developer’s point of view, things are slightly more complicated.

We usually need several pieces for a simple Action.

  • Actions on Google: it’s the service that describes the app, it contains a name, a description, and everything is needed to distribute our app. It also allows us to test the app on different Assistant-enabled devices.
  • Dialogflow: it’s the service that converts the user’s request to an intent.

User says “I want something sweet! Probably a hot coffee is ok” will match the intent “Add Drink” in Dialogflow.

  • Backend: to handle more complicated questions. This might need some “applicative logic”, we could use our backend, which handles the Intent with some optional parameters.

Taking into account the example we described from the users’ point of view, let’s see how this Action can be managed more deeply.

Users will always interact with Actions on Google, which is the main entry point on any device running Assistant. Actions on Google is only the interface we chose to publish our app. Requests will be analyzed by Dialogflow, which will extract the information we need from requests to provide us with a structured answer.

This service alone is not enough, we need something that can execute the requests and give back results, the backend can process the request.

Next step — Setup the environment! 📜

We now have a general understanding of what we need. We should prepare the environment for developing our Action.

--

--