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


We provide samples for the API.AI and the Actions SDK in our Github repository.


Most API.AI samples consist of two parts: the Node.js app for fulfillment and the project that you import into API.AI. You need to deploy both parts for the sample to work. We provide the following samples:

  • API.AI Webhook Template - A template project for API.AI that includes a webhook template

    git clone
  • Silly Name Maker - A very simple API.AI agent that doesn't have fulfillment.

    git clone
  • Silly Name Maker with Webhook - A version of Silly Name Maker that uses fulfillment.

    git clone
  • Facts about Google - Learn how to use more advanced concepts of API.AI, such as contexts.

    git clone
  • Name Psychic - Request user profile information and persist it across conversations

    git clone
  • Number Genie - A guess a number game that shows great VUI design.

    git clone

Actions SDK

All Actions SDK samples consist of two parts, the Node.js app for fulfillment and the action package that you preview or deploy with the gactions CLI. You need to deploy both parts for the sample to work.

  • Eliza - A version of Eliza for Actions on Google.

    git clone
  • Ordinal Number Speaker - A very simple action that speaks back any number you say with an ordinal version of the number.

    git clone

Directory structure

In general, each sample contains the following files:

  • API.AI project zip file or agent.json - Contains the project to import into API.A or the action package to deploy
  • app.js - The fulfillment code
  • app.yaml - Google App Engine project manifest. You don't need this file if you are not using Google App Engine.
  • package.json - Node.js dependencies for the project.
  • node_modules directory - Contains downloaded project dependencies, including the actions-on-google client library. This directory appears after you run npm install.

Download the sample and dependencies

Run the following commands where <sample_url> is one of the sample URLs above and <sample_dir> is the directory that git creates.

    git clone <sample_url>
    cd <sample_dir>
    npm install

Deploy the Node.js app for fulfillment

These instructions assume you are using Google App Engine. See deploying to Heroku for instructions on how to deploy to Heroku.

This tutorial assumes you are using Google App Engine, but you can use any hosting platform that supports Node.js.

  1. Download, install, and initialize the Google Cloud SDK.
  2. Download and install Node.js
  3. Go to the Google Cloud Console projects page and select or create a new project. Make a note of the project ID, because it is used for configuration and deployment.
  4. Enable billing for your project. See the console's help center for more information.
  5. Deploy the project to Google App Engine. This process takes a few minutes.
    $ cd <sample_dir>
    $ gcloud config set project <project_id>
    $ gcloud app deploy

You should see output that is similar to the following example. Make note of the endpoint URL. You'll need this in the next section to configure the fulfillment URL.

Updating service [default]...done.                                                                              
Deployed service [default] to []

You can read logs from the command line by running:
  $ gcloud app logs read

To view your application in the web browser run:
  $ gcloud app browse

Import and configure the API.AI project (for API.AI only)

  1. Create an API.AI agent named MyAction.
  2. Restore the zip into the MyAction project:
    • Click on the gear icon to the right of the agent name.
    • Click on the Export and Import tab.
    • Click Restore from Zip and select the API.AI project zip file.
    • Type RESTORE in the text box and click Restore.
  3. Enable fulfillment:
    • Click Fulfillment and slide the Enabled slider to the right.
    • In the URL field, enter the endpoint URL for fulfillment.

Previewing and Testing Actions

See Previewing and Testing Actions for information on how to test actions once deployed.