Getting Started with Actions on Google

Author

Reads 6.8K

Dynamic action shot of a high school basketball game indoors.
Credit: pexels.com, Dynamic action shot of a high school basketball game indoors.

Actions on Google is a platform that allows developers to create conversational interfaces for Google Assistant, making it easy to build custom voice experiences.

To get started, you'll need a Google account and a Google Cloud account, which is free to sign up for.

Developers can choose from a variety of tools and services to build their Actions, including Dialogflow, a popular conversational AI platform.

Setting Up

To set up your Actions project, start by opening the actions.intent.MAIN.yaml file in your text editor. Replace the text in the speech field with your desired welcome message.

If you're having trouble installing the gactions CLI, you can use the npm package instead, which is even easier. Simply run the command `npm i -g @assistant/gactions` in your terminal.

Make sure to also enable Cloud APIs in the correct project, which should have the same projectId as the one you've set in settings.yaml. This is easily done through the Cloud Dashboard.

For another approach, see: Google Cloud and Google Drive Difference

Index Js

A man wearing a knitted sweater holds a card near a smart speaker on a marble table with a flower in glass.
Credit: pexels.com, A man wearing a knitted sweater holds a card near a smart speaker on a marble table with a flower in glass.

Save the index.js file, which defines the greeting handler that sends the appropriate greeting to the user.

This handler is a fundamental component of your Action, and it's essential to get it right from the start. To do this, simply save the file after making any necessary changes.

Next, you'll need to create a new file called package.json in the ActionsOnGoogleFulfillment directory. This file specifies the dependencies and metadata for your webhook.

Here are the key steps to create the package.json file:

1. Open package.json in your text editor.

2. Copy the code from the GitHub repository and paste it into the package.json file.

3. Save the file after making any necessary changes.

Once you've completed these steps, you'll be ready to move on to the next phase of setting up your Action.

For your interest: Google Drive File Editor

What You'll Learn

In this section, you'll learn the essentials of setting up your project. You'll discover how to create a project in the Actions console.

Explore further: Google Project on Drive

Credit: youtube.com, Ergonomics Expert Explains How to Set Up Your Desk | WSJ Pro Tip

The Actions console is where you'll manage your project, so it's essential to understand how to use it. You'll learn how to use the gactions tool to push and pull your Action project between the Actions console and your local file system.

Here's a quick rundown of what you'll learn:

  • How to create a project in the Actions console
  • How to use the gactions tool to push and pull your Action project between the Actions console and your local file system
  • How to test your Action in the Actions simulator

As you progress, you'll also learn how to implement fulfillment using the Cloud Functions editor. This is a key part of making your Action functional and interactive.

Set Up Invocation

To set up your Action's invocation, you'll need to edit the main invocation prompt in the actions.intent.MAIN.yaml file. Open this file in your text editor and replace the default text in the speech field with your own welcome message.

The prompt should be a wondrous greeting, something like "A wondrous greeting, adventurer! Welcome to the mythical land of Gryffinberg!" This will be the message your Action sends back to the user when they invoke your Action.

Explore further: Action Dropbox

Credit: youtube.com, Harmin Karden INVOKE unboxing and initial setup

To modify the prompt, follow these steps: Open custom/global/actions.intent.MAIN.yaml in your text editor, replace the text in the speech field with your welcome message, and save the changes.

You can also use the gactions tool to push and pull your Action project between the Actions console and your local file system. This will help you keep your project organized and up-to-date.

Here's a quick summary of the steps to set up your main invocation:

Once you've set up your main invocation, you can test it in the Actions simulator. This will allow you to converse with your Action as if it were running on a smart display, phone, speaker, or KaiOS.

Understanding Intents

Understanding Intents is a crucial part of building Actions on Google. There are three main types of intents: Common, Vertical, and Custom. Common intents allow users to access universal app features with simple voice commands, such as Open and Search.

Credit: youtube.com, Built-in intents for App Actions

You can connect specific app functionality to voice commands with Vertical intents, which are tailored to various app categories like Health and Fitness, Communications, and Productivity. Custom intents, on the other hand, enable you to create unique voice commands for your app's functionality.

Here are the three main types of intents:

By understanding the different types of intents, you can create a more user-friendly and efficient Action on Google.

Common Intents

Common intents are a crucial part of making your app accessible to users through simple voice commands.

You can enable universal app features like Open and Search by using straightforward voice commands. This allows users to easily access the features they need without having to navigate through complex menus.

To make your app more user-friendly, consider adding common intents that cater to basic user needs.

Here are some common intents you can add to your app:

By incorporating these common intents, you can create a more intuitive and user-friendly experience for your app's users.

Vertical Intents

Credit: youtube.com, Intents

Vertical intents allow you to connect specific app functionality to voice commands, making it easier for users to interact with your app.

Tailoring voice commands to app categories is key, and this can include areas like Health and Fitness, Communications, and Productivity.

By doing this, you can create a more seamless and intuitive experience for your users, making it easier for them to get what they need from your app.

For example, users can say specific voice commands to access app functionality, such as "Track my workout" or "Send a message to John".

Curious to learn more? Check out: Google Fi Google Voice

Custom Intents

Custom Intents are a powerful tool that allows you to create your own voice commands tailored to your app's unique functionality.

You can create custom intents using voice commands that are customized to your app's unique functionality, as shown in Example 2. This means you can design specific voice commands that trigger specific actions within your app.

To add a yes or no intent, you'll need to create a new file called yes.yaml in the intents directory, as described in Example 3. This file will contain the custom intent that matches when the user says "Yes" or "No".

You might enjoy: Android No Google

Credit: youtube.com, DialogFlow Intents Tutorial: How to Create and Use Custom Intents

You can then add the yes custom intent to the Start scene, following the steps outlined in Example 4. This will allow your app to understand when a user is expressing a "yes" intent and respond accordingly.

Here's a summary of the steps to add a yes intent to the Start scene:

  1. Create a new file called yes.yaml in the intents directory.
  2. Add the intentEvents and yes handler to the end of the Start.yaml file.

By following these steps, you can create custom intents that enhance the user experience and provide a more personalized interaction with your app.

Testing and Debugging

Testing and Debugging is a crucial part of building a successful Actions on Google project. You can test your Action in the simulator, which provides a web tool for testing your Action as if it were running on a smart display, phone, speaker, or KaiOS.

To test your Action in the simulator, follow these steps: copy the provided URL and paste it into a browser, click Test to take you to the simulator, type Talk to my test app in the Input field and press Enter, and then respond to the prompts with Yes or No or by clicking the suggestion chips.

Credit: youtube.com, Google Home Debugging Tools: Overview

The event logs in the Test tab of the Actions console display the conversation history as event logs, which can help you debug your Action if you have any issues. Each event log shows the events that happen during that turn of the conversation, including the user's input, your Action's response, and the selected transition.

Here is a breakdown of the event logs:

  • userInput: Corresponds to the user's input
  • interactionMatch: Corresponds to your Action's main invocation response, which was triggered by the user's input
  • endConversation: Corresponds to the selected transition in the Main invocation intent

By following these steps and using the event logs, you can test and debug your Actions on Google project to ensure it works as expected.

View Event Logs

Viewing event logs is a crucial step in testing and debugging your Action. It provides visibility into how your Action is working, making it easier to identify and fix issues.

Event logs display the conversation history as event logs, showing the events that happen during each turn of the conversation. Each event log corresponds to a specific turn, with events arranged chronologically.

Credit: youtube.com, Google Home Debugging Tools: Event logs

You can view event logs in the Test tab of the Actions console. The panel shows the event logs, with each log displaying the user's input and your Action's response.

Here's a breakdown of the event log:

  • userInput: Corresponds to the user's input
  • interactionMatch: Corresponds to your Action's main invocation response, which was triggered by the user's input
  • endConversation: Corresponds to the selected transition in the Main invocation intent

To see the details of an event, click the arrow next to the event name. This will expand the row, showing the prompt you added for the main invocation.

Event logs are useful tools for debugging your Action, and they can help you identify issues with your Action's response. By examining the event logs, you can see how your Action is working and make changes to improve its performance.

Test in Simulator

Testing in the simulator is a crucial step in ensuring your Action works as expected. To test your Action in the simulator, you'll need to follow some steps.

You can deploy your project to the Actions console for testing by running a command in the terminal. This will provide a URL that you can paste into a browser to access the simulator.

Credit: youtube.com, Unit Tests & Debugging in Decisions

To invoke your Action in the simulator, type "Talk to my test app" in the Input field and press Enter. This will trigger your Action's main invocation, and the Assistant will respond with your customized welcome message.

The conversation will end after the Assistant responds with a greeting, but don't worry, you'll modify your Action to continue the conversation in the next section.

You can also test your Action in the simulator by following these steps:

  • Copy the provided URL and paste it into a browser
  • Click Test to take you to the simulator
  • Type "Talk to my test app" in the Input field and press Enter
  • Your Action should respond with the Main invocation prompt and the added Start scene prompt
  • Click the Yes or No suggestion chip to respond to the prompt

If you respond to the prompt, your Action will respond with a generic message indicating that it can't understand your input. This is because you haven't yet configured your Action to understand and respond to "Yes" or "No" input.

Here are the steps to test your Action in the simulator:

1. Copy the provided URL and paste it into a browser

Credit: youtube.com, Simplify Your Webhook Testing and Debugging Process | Webhook Simulator Lifetime Deal

2. Click Test to take you to the simulator

3. Type "Talk to my test app" in the Input field and press Enter

4. Type "Yes" in the Input field and press Enter

5. Alternatively, click the Yes suggestion chip

Your Action will respond to the user and tell them their fortune depends on the aid they choose. Your Action will then end the session because you configured the End conversation transition for the yes intent.

Take a look at this: Front End Web Page Design

Test Yes Intent

To test the yes intent in the simulator, follow these steps:

Copy the provided URL and paste it into a browser.

Click Test to take you to the simulator.

Type Talk to my test app in the Input field and press Enter.

Type Yes in the Input field and press Enter, or alternatively click the Yes suggestion chip.

Your Action will respond to the user and tell them their fortune depends on the aid they choose.

Dynamic action shot of teenagers playing basketball in a well-lit indoor court.
Credit: pexels.com, Dynamic action shot of teenagers playing basketball in a well-lit indoor court.

The Action then ends the session because you configured the End conversation transition for the yes intent.

You can also create the yes intent by following these steps:

In the terminal, create a new file called yes.yaml in the intents directory.

Open yes.yaml in your text editor and paste the training phrases into the file.

The training phrases should match the user's response, such as "Yes".

To add the yes intent to the Start scene, follow these steps:

Open custom/scenes/Start.yaml in your text editor.

Add the intentEvents and yes handler to the end of the Start.yaml file.

This will allow the Action to understand when a user is expressing a "yes" intent and respond accordingly.

Here's a summary of the steps to test the yes intent:

By following these steps, you can test the yes intent in the simulator and ensure that your Action is responding correctly to user input.

Running This Sample

Running this Sample can be a bit of a challenge, but don't worry, I've got the solution for you. You can test your Action on any Google Assistant-enabled device on which the Assistant is enabled.

Credit: youtube.com, How to run an end-to-end test interactively (debugging)

To test your Action, you'll need to follow some steps, but don't worry, I'll walk you through them. You can test your Action on any Google Assistant-enabled device on which the Assistant is enabled.

The solution to this problem is to go to the Web Testing page and trigger a new function deployment. This will allow you to test your Action without having to redeploy it every time.

Here are the steps to trigger a new function deployment:

  • Go to the Web Testing page
  • Trigger a new function deployment

This will save you a lot of time and hassle in the long run. Having to do this every time can be bothersome, but it's a small price to pay for being able to test your Action quickly and easily.

Building the Action

To create a project in the Actions console, you'll need to follow a few steps. You can start by copying a provided URL and pasting it into a browser.

The Actions console provides a visual representation of your Action's configuration. This can be useful during development, but it doesn't affect the version of your Action that's served for testing.

Intriguing read: Googl Console

Credit: youtube.com, Build Actions for Google Assistant using Actions Builder (Codelab 1)

To visualize your Action's configuration, click Develop in the top navigation bar and then click the drop-down arrow next to Scenes and click Start. You should see a visual representation of your Action's Start scene.

Your Action's configuration is defined in the ActionsOnGoogleFulfillment.yaml file. This file tells your Action to use Cloud Functions as the webhook endpoint.

To create this file, you'll need to create a new ActionsOnGoogleFulfillment directory in the webhooks directory and add a new file called index.js. In index.js, you'll need to add the following code.

Here's a step-by-step guide to creating the Action:

  1. Create a new project in the Actions console.
  2. Use the gactions tool to push and pull your Action project between the Actions console and your local file system.
  3. Implement fulfillment using the Cloud Functions editor.

Testing and Deployment

Testing your Action in the Actions console simulator is a great way to see how it responds to user input. To do this, deploy your project to the Actions console for testing by running a command in the terminal.

You'll receive a URL that you can copy and paste into a browser. Then, invoke your Action by typing "Talk to my test app" in the Input field and pressing Enter. The Assistant should respond with your customized welcome message, which is a wondrous greeting in this case.

To test your Action locally, you'll need to set up an HTTPS endpoint for fulfillment. This can be the same Firebase Function you've been using, or a Ngrok Public URL if you're still developing.

See what others are reading: Googl Url

Test Main Invocation in Simulator

Credit: youtube.com, Well Test Simulator - Surface Testing - Walkthrough 1/2

To test your Action's main invocation in the simulator, you need to deploy your project to the Actions console. Run the command in the terminal to deploy your project, and copy the provided URL to paste into a browser.

The simulator interface will allow you to converse with your Action as if it were running on a smart display, phone, speaker, or KaiOS. To invoke your Action, type Talk to my test app in the Input field and press Enter.

Your Action should now respond with the customized prompt you added, which in this case is "A wondrous greeting, adventurer!...". This is the expected response after deploying your project and invoking the main invocation in the simulator.

Here are the steps to test your Action's main invocation in the simulator:

  1. Deploy your project to the Actions console using the command in the terminal.
  2. Copy the provided URL and paste it into a browser.
  3. Type Talk to my test app in the Input field and press Enter.

By following these steps, you can test your Action's main invocation in the simulator and ensure that it responds correctly with the customized prompt.

Releasing

Credit: youtube.com, Deployment Methods and Objectives

Releasing is a straightforward process. Just go to the "Deploy" tab and submit your information to create a new release.

You'll need to wait for Google's verification before your action is officially live. After that, you can expect to see it in action.

Conversation Components

Your Action's conversation is made up of scenes, intents, and transitions. These components work together to define the various paths your user can take through your Action's conversation.

A scene is a section of your conversation that can be activated by a user's input. In this codelab, you'll create a scene and define how it's activated after a user invokes your Action.

The most common way to activate a scene is to configure your Action so that when the user input matches an intent within a scene, that intent triggers the transition to another scene and activates it. For example, a hypothetical Action that provides animal facts can have a scene called Facts that's activated when the user asks to hear a fact.

Credit: youtube.com, Building Your Own Conversations for the Google Assistant with Actions on Google

Intents are custom triggers that match user input and can be used to activate a scene. In the example, the intent called Cat is used to match user input like "I want to hear a cat fact" or "cat", and triggers a transition to the Cat fact scene.

Transitions are used to move from one scene to another based on user input. They're an essential part of your Action's conversation logic and help define the various paths your user can take.

Local Development

Local development is key to creating Actions on Google. You can start by downloading your Actions project from the Actions console.

To do this, you'll need to make a new directory and change into that directory using the command line. Then, copy the configuration of your Actions project to your local file system using the command `gactions download`.

Once you have your project locally, you can use a local editor to make changes and test your code without deploying it again. This is especially useful for development and testing purposes.

Install CLI

Person photographing elegant ceramic crockery setup with mobile phone for online selling.
Credit: pexels.com, Person photographing elegant ceramic crockery setup with mobile phone for online selling.

To install the CLI, follow the instructions in Install the gactions command-line tool.

The gactions CLI is a must-have for local development.

To install it, you'll need to follow the instructions in the Install the gactions command-line tool section.

The process is straightforward and should only take a few minutes to complete.

A different take: Google Traductor De Inglés

Local Editing

Local editing is a crucial step in the local development process. You've likely followed the quick start guide and now have an Interactive canvas sample project in your computer.

To edit your project locally, you'll need to use a local editor. This is where you can make changes to your code and test it without deploying it again.

You can start by making a new directory and changing into that directory. Run the following commands to do so:

  1. mkdir my-project
  2. cd my-project

With your local project set up, you can now copy the configuration of your Actions project to your local file system. Run the following command to do so:

  1. gactions sync

This will synchronize your Actions project between the Actions console and your local file system, giving you a local copy of your project that you can edit and test.

Google Actions

Credit: youtube.com, Actions On Google To Help Flesh Out Google Assistant | CNBC

Google Actions offer a unique experience compared to Amazon's Alexa skills. Users don't need to enable an action before using it, making it instantly discoverable and accessible at any time.

Unlike Alexa, where enabling a skill is like downloading an app, Google Actions are always available to everyone, requiring no extra steps.

The Google Assistant's intent model also presents opportunities for brands and publishers to make their actions and content more discoverable through voice-enabled SEO and deep-linking techniques.

Console

To create a Google Action, you'll need to access the Actions Console. To do this, go to the Actions on Google Console and follow these steps.

First, click on New project and then Create project. Next, under What kind of Action do you want to build?, select Custom and then choose a Blank project.

You can create a new project in the Actions Console by following these steps:

  1. From the Actions on Google Console, go to New project > Create project.
  2. Under What kind of Action do you want to build?, select Custom.
  3. Choose a Blank project.

Google

Google Actions offer a seamless user experience, where users can access any action at any time without needing to enable it first. This is a stark contrast to Amazon's Alexa skills, which require users to take extra steps to enable and discover.

Actions on Google are always available to everyone, eliminating the need for extra steps like downloading an app.

Interface and Navigation

Credit: youtube.com, Google I/O 2012 - Navigation in Android

The Actions platform on Google Assistant supports two types of actions: "direct" and "conversational". The direct actions are straightforward, while conversational actions are more complex and suitable for advanced applications.

Developers can create actions directly against the API, and a SDK for Node.js is also available. This gives them the flexibility to design and implement their actions in a way that best suits their needs.

As of April 2017, there were over 175 Actions for Google Assistant, including ones from well-known companies like Uber, The Motley Fool, and Domino's Pizza.

Great Voice UX

Developing a great Voice UX is crucial for engaging users and driving interactions. XAPP has helped numerous brands streamline custom Actions on Google development, leveraging deep-link discovery and search features to maximize user discovery and engagement.

Measuring performance has taught us best practices for voice user experiences. We've developed hundreds of Voice UXs for content discovery, advertising, and the Google Assistant, producing millions of consumer interactions.

Credit: youtube.com, UX Design Talk: What is Voice User Interface Design?

A well-designed Voice UX should enable users to access specific app functionality with ease. App Actions allow users to say simple voice commands to quickly access your Android app's functionality, thanks to Google Assistant's intent mapping and Natural Language Understanding (NLU).

Developing an action for the Google Assistant on Google Home prevents missed opportunities and allows brands to engage with interested consumers. It's essential to start voice app SEO early to avoid losing out to competitors.

Here's an interesting read: Google Colab Access Google Drive

Interface

The Google Assistant's interface is quite impressive, with over 175 Actions available as of April 2017.

Developers can create either "direct" actions for simple tasks or "conversational" actions for more complex applications.

More advanced developers can develop directly against the API, giving them greater control over the interface.

A SDK for Node.js is also available, making it easier for developers to integrate the Google Assistant into their applications.

The Google Assistant's interface is not limited to the Google Home space, but is also available on Android and iOS devices.

Project Management

Credit: youtube.com, Project Planning for Beginners | Google Project Management Certificate

To create an Actions project, you start by opening the Actions console and clicking New project. Enter a Project name, such as actions-codelab, for your internal reference.

You can set an external name for your project later, but this internal name will help you keep track of your project. To create the project, click Create project, and then follow the prompts to select a Custom card and a Blank project card.

To access your project settings, click the three vertical dots in the Actions console, and then click Project settings. This will allow you to manage your project's settings and configuration.

See what others are reading: Create Your Google Account Google Accounts

Create a Project

To create a project, open the Actions console and click New project. This will start the process of creating a container for your Action.

You'll need to enter a Project name, such as actions-codelab, which is for your internal reference.

Click Create project to proceed.

In the next step, select the Custom card from the What kind of Action do you want to build? screen.

Side view of female freelancer in warm sweater and eyeglasses drinking tea from white ceramic cup while sitting on floor near sofa with netbook on legs while creating document for remote work project
Credit: pexels.com, Side view of female freelancer in warm sweater and eyeglasses drinking tea from white ceramic cup while sitting on floor near sofa with netbook on legs while creating document for remote work project

Next, click Next and then select the Blank project card from the How do you want to build it? screen.

Click Start building to begin the project creation process.

To access your project settings, click the three vertical dots in the Actions console and then click Project settings.

Here are the steps to create a project in a concise format:

  1. Open the Actions console.
  2. Click New project.
  3. Enter a Project name.
  4. Click Create project.
  5. Select Custom card.
  6. Click Next.
  7. Select Blank project card.
  8. Click Start building.

Save Project ID

To save your Project ID, you need to copy it.

You can retrieve your Project ID by following a few simple steps.

Copy the project ID. This is a unique identifier for your Action, and you'll need it for several steps in this process.

In this case, you're using the gactions command-line interface (CLI) tool to synchronize your Actions project between the Actions console and your local file system.

Brands Must Begin Voice App SEO Early

Developing a voice app for the Google Assistant on Google Home is crucial to prevent missed opportunities. If consumers inquire about a product or service through the Google Assistant, the response might be basic information gathered from the web or worse, information from a competitor's Action.

Credit: youtube.com, Lark | The Best All-in-one AI Project Management Platform for Companies

Organizations have more to lose by not being on Google Home early, as the first-mover advantage can be significant. This is especially true for brands and publishers who want to engage with interested consumers and reach a new audience.

Developing an action for the Google Assistant on Google Home allows brands to be the first to respond to consumer inquiries and gather valuable information.

Gilbert Deckow

Senior Writer

Gilbert Deckow is a seasoned writer with a knack for breaking down complex technical topics into engaging and accessible content. With a focus on the ever-evolving world of cloud computing, Gilbert has established himself as a go-to expert on Azure Storage Options and related topics. Gilbert's writing style is characterized by clarity, precision, and a dash of humor, making even the most intricate concepts feel approachable and enjoyable to read.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.