Join the Actions on Google Developer Challenge to win a trip to Google I/O 2018 and more than 20 other prizes.

Create an Actions Project and API.AI Agent

To develop for Actions on Google, you first need to create an Actions project and an API.AI agent. Having a project allows you to define metadata, manage your app through the approval process, view analytics for your app, and more. The API.AI agent defines intents that map what users say to the corresponding logic that fulfills the intent and responds back to the user.

  1. Download and unzip the Facts about Google sample app from GitHub or clone the repository. We'll refer to the sample app directory as <sample_dir>. The sample app contains an API.AI agent (<sample_dir>/ and the corresponding fulfillment (<sample_dir>/functions/index.js).
  2. Turn on Web & App Activity, Voice & Audio Activity, and Device Information permissions on the Activity controls page for your Google account. You need to do this to use the Actions Simulator, which lets you test your actions on the web without a hardware device.
  3. Create a project and agent:
    1. Go to the Actions on Google Developer Console.
    2. Click on Add Project, enter FactsApp for the project name, and click Create Project.
    3. In the Overview screen, click on Use API.AI and then CREATE ACTIONS ON API.AI to start building actions.
    4. The API.AI console appears with information automatically populated in an agent. Click Save to save the agent.
  4. Restore the <sample_dir>/ into the FactsApp agent:
    1. In the left navigation, click on the gear icon to the right of the agent name.
    2. Click on the Export and Import tab.
    3. Click RESTORE FROM ZIP and select the <sample_dir>/ file.
    4. Type RESTORE in the text box, click RESTORE, then DONE. When the restoration is finished, the following screen appears. Make note of your app's project ID; you'll need it to deploy the sample's fulfillment.

You now have an API.AI agent that includes intents that are triggered when users say specific phrases. You can learn more about the intents in the next section or move on to deploying fulfillment for the app as a Cloud Function for Firebase.

Learn more

When the import is finished, you'll have an agent populated with the following intents:

  • Default Welcome Intent - This intent is the default intent that is triggered when users initially invoke your app. It responds with "Welcome to Facts about Google! Do you want to hear about Google's history or do you want to hear about its headquarters?"
  • choose_fact - This intent is triggered when users say they want to hear a history or headquarters fact about Google. It defines samples phrases and parameters in the User says phrases. Parameters tell API.AI to parse certain values from the user input so your fulfillment knows which fact to deliver. In this case, API.AI parses either history or headquarters.
  • tell_fact - This intent is triggered when users say "Yes", "I want to hear another", or similar phrases when they want to hear another fact (either history or headquarters facts).
  • quit_facts - This intent triggers when users say "Bye", "I'm done now", or similar phrases.
  • Cat facts easter egg - Facts about cats are also available and the conversation is driven by the choose_cats and tell_cat_fact intents. These intents work similarly to choose_facts and tell_fact.