loading...

Getting started with Google Actions

botreetech profile image BoTree Technologies Updated on ・5 min read

Getting started with Google Actions

What is Action?

An Action is a starting point into an interaction that you build for the Assistant. Users can talk to your Action by typing or speaking to the Assistant.

To start talking to your Assistant using action, the user says or types the phrase like “Hey google play some music” the whole sentence is utterance while the phrase “hey google” is the trigger. Let’s take another example, "Hey Google, talk to Appointment Scheduler". Here, “Hey Google” is the trigger and “Appointment Scheduler” is the invocation name.

Setup Google Action

  • Open Google Actions Console,log in with your Google account and add a new project.
  • Select the “conversational” option to build a customized conversational experience.
  • You are now on your project’s overview page. Now click “Quick setup” and “Decide how your Action is invoked”.
  • Set Invocation Display name and Google Assistant voice and save the changes.

Output 1

  • Go to “Actions” in the Build section. And add your first action, leave the default selection of “custom intent” as it is and Builds. It will take you to the Dialog Flow console.

What is Dialog Flow?

Dialog Flow is Natural Language Processing. Dialog Flow handles the job of translating natural language into machine-readable data using machine learning model.

Here is an example of how Dialog Flow handles a user utterance.

output 2

Key Terms:

  • Agent
  • Intent
  • Entities
  • Fulfillment

Read Also - Extracting text from image using Google Cloud vision OCR with Ruby

Agent

  • We first create an agent with a dialog flow, Agent is your entire chatbot application

What Agent does?

  1. Collects what users say
  2. Map it to an intent
  3. Takes action on it
  4. Provide the response
  • This all starts with the trigger event called utterance. This is how users invoke the chatbot.

  • Let's create an agent.

Enter the new Agent name or keep the default one and hit “Create”.

Intent

  • The intent is something that lets you take any normal conversation/text and extracts computer-understandable information from it.

  • For example: If you say “I want to set an appointment”. “Set appointment” is an intent here. Or if you ask “what are your hours of operation” then “hours of operation” here is intent.

  • Dialog flow then trains the machine learning model with many more similar phrases and finally match the user's phase to the right intent. This process is called intent matching (Refer the example diagram above).

  • Dialog Flow has two default intents, Welcome Intent and another is Fallback Intent. Welcome Intent helps greet users and the default fallback intent helps to catch all the phrases that your software does not understand. You can try writing some phrases in the “try it now section” of the test console (last panel) on the screen.

  • Let's create our custom intent.

Write the Intent name, we are using “Schedule Appointment” and hit “Save”. Let’s skip context and events for now and we will add training phrases and responses.

output 3

Click “Add Training Phrases”, As you add the phrases and press enter you will see the date and time entities are automatically highlighted.

output 4

Click “Add Responses”, Type the response you want for the mentioned training phrases. And to show the date and time, use our system variables $date and $time in the response.”$” sign here helps to access the entity values.

output 5

Now, test it in the test console. Type your phrase in “Try it now” and press enter.

output 6

Voila... It works!

Entities

  • Critical pieces of information in the statement to do some task. These are variables you want to define and collect.

  • For example: “Set an appointment tomorrow at 4 pm”. 4 pm and tomorrow are the two entities

  • DialogFlow has some predefined entities like date, time, address, city, etc…, these are called system entities.

  • We can also define custom entities in our agent, which are called developer entities.

Now, What if someone writes the phrase “Set an appointment”. We have not yet handled that scenario, to support this we have something called Slot Filling. Here, we make the entities as required and the dialog flow will make sure to ask for the missing required entities.

Let's add the above scenario in our software.

  • Click on “Manage Parameters and action” from the action and parameters section.

  • Mark the entities required and click on “define prompts” to define the prompts for the required entities.

You can add more variables if you want to and just click “Save”.

output 7

Now, again test it in the test console.

output 8

Yayy… It works.

If you want to add any custom logic or calculations to the software then you can use fulfilment. That we will cover in the next blog post.

We did all the testing in the test console. What if you want to share this software you made with your friends?

To share it just click on “Integrations” in the sidebar and enable the “Web Demo”. You can share the link or you can frame it in your website or mobile application.

Deploying the application

Stay on the “Integrations” page and click “Integration Settings”. You can “Test” the app and then If all works fine to go on and click “Manage Assistant app”.

output 9

Click “Get ready for deployment”. Fill up the details and go back and click the “Release” option. Reach out to learn more about the expert web developers in NYC for the various ways to improve or build the quality of projects and across your company.

output 8

That’s it for now.

Posted on May 10 '19 by:

botreetech profile

BoTree Technologies

@botreetech

We are in the business of offering expert product engineering and development services for bespoke applications. Web, Mobile, RPA, ML & AI solutions company with expertise in Ruby on Rails, Python.

Discussion

markdown guide