Getting Started

This document goes over how to build a simple Conversation Action (without fulfillment) that ask users for their favorite color and lucky number, creating a silly name from the two:

    Silly Name Maker: Hi! Welcome to Silly Name Maker!
                      Let's get started. What is your lucky number?
    User: 22
    Silly Name Maker: What is your favorite color?
    User: Blue
    Silly Name Maker: Alright, your silly name is Blue 22.
                      I hope you like it! See you next time!
To download this sample directly without having to build it, see the Silly Name Maker sample in Samples section.

Create an API.AI agent

This API.AI agent contains three intents and one action. The welcome intent is triggered when your action is invoked. It greets the user and asks a question, directing them to a second intent. This intent collects user input, responds to the user, and exits. Finally, there is a fallback intent for handling unrecognized user input.

To create an API.AI agent:

  1. Navigate to API.AI to create a new agent.
  2. Specify the following values for each field and click Save:

    • Agent name: SillyNameMaker
    • Agent Type: Public or Private See Agent Settings for more information.
    • Description: Use this action to come up with your silly name!
    • Language: English
    • Default Time Zone: Choose one or accept the default value

Edit the Default Welcome Intent

API.AI intents manage much of a Conversation Actions functionality. They define how user speech triggers a task to occur, what to do for the task, and what to provide as a response back to the user.

Your agent is initialized with a Default Welcome Intent. This intent is the first one users trigger when they invoke your action because it is fired by the WELCOME event. It should act as the entry into your brand, distinguishing it from Google. Without a clear welcome intent, your users might get confused and believe they are still within the Google Assistant experience instead of within your Conversation Action experience.

  1. In the left navigation, click Intents and select the Default Welcome Intent.

  2. Click the trash symbol next to each of the predefined responses at the bottom of the intent page.

  3. Define the following Response: Hi! Welcome to Silly Name Maker! Let's get started. What is your lucky number?

  4. Click Save.

Create the silly name maker intent

This agent transitions to another intent as the conversation progresses. Once the user has been greeted by your agent, they trigger a separate intent to fulfill the goal of the action, creating a silly name.

  1. In the left navigation, click the + sign next to Intents.
  2. Name the intent make_name and click Save.

Define User says phrases

User says phrases define what users need to say to trigger an intent. API.AI automatically expands these phrases to include similar phrases, so you don't need to be exhaustive. When users speak these phrases, this intent is triggered and carries out an action, which you'll define in the next step.

In the User says field, enter:

  • 23.
  • My lucky number is 23

Define an Action

You'll now create an action to carry out when this intent is triggered.

In the Action area:

  1. Specify make_name in the Enter action name... field.
  2. Add parameters with the following information:

    Number:

    • Required: Enabled
    • Parameter name: number
    • Entity: @sys.number
    • Value: $number

    Color:

    • Required: Enabled
    • Parameter name: color
    • Entity: @sys.color
    • Value: $color
  3. Mark each parameter to be Required. This tells API.AI to trigger the action associated with this intent only when it can parse a value for this parameter.

  4. Click Define prompts to define the prompts that API.AI speaks to users to obtain a color value from them. API.AI randomly selects these prompts to speak to users until it can parse a color and number values.
    • Color - What is your favorite color?
    • Number - What is your lucky number?

Define Responses

When the user speaks a color, you can set a response to send to the Google Assistant to speak to the user. Define the following response and click Save at the top of the page:

Alright, your silly name is $color $number. I hope you like it! See you next time!

Test in API.AI or the Google Home Web Simulator

  1. Click Integrations and move the Actions on Google slider to the right to enable it.
  2. Click on Settings and fill in the fields:
    • Invocation name for testing: Silly Name Maker
    • Google Project ID: Leave blank
    • TTS voice: Choose one
    • Welcome intent: Default Welcome Intent. This specifies the invocation intent to trigger when a user invokes the action.
    • Sign-in required: Leave unchecked
  3. Click Authorize and choose your Google account in the authorization flow.
  4. Click Preview to make this agent available in the Google Home Web Simulator or a Google Home device when you're logged in with the Google account above.
  5. Go back to the make_name intent and turn on the End Conversation option in the Actions on Google section and Save.
  6. Test the action out in the Google Home Web Simulator by invoking the action with "talk to silly name maker" and then enter a number and color after being prompted.

Once testing is complete, consider deploy your actions for others to use.