The Actions SDK lets you build Conversation Actions easily with just two main components: an action package and a Node.js web service.

Action packages are JSON manifest that describes all the metadata about your actions in addition to how users invoke and provide input to your actions.

Fulfillment logic processes user input and ultimately fulfills the user's request. We provide a Node.js client library to help you build fulfillment logic as a web service.

The Actions SDK includes the following components:

Set up your environment

These instructions show you how to initialize a fresh directory structure to develop in. See the Getting Started documentation to see how to deploy a simple Conversation Action that's already built for you.

  1. Download and install node.js. (We recommend the latest stable version; see the installation instructions).

  2. Set up a Node.js web hosting environment. If you don't have a preferred one, try Google Cloud or Heroku.

  3. Download and unpack the gactions CLI to a directory we'll call <actions-sdk>.

  4. Create a directory in the <actions-sdk> directory for your Node.js app project. We'll refer to this directory as <actions-sdk/actions-project>
  5. Run the following command from the <actions-sdk/actions-project> directory to generate an action package named agent.json:

    gactions init
  6. Run the following command from the <actions-sdk/actions-project> directory to initialize the client library and other dependencies:

    npm install express body-parser actions-on-google --save
  7. Create an app.js file with your fulfillment logic. See the Ordinal Number Speaker example for a simple project example to start out with.

Start building

Follow these steps to design, develop, and distribute a Conversation Action to users:

  1. Design the dialogs, or user interface, for your action. Writing the dialogs upfront lets you catch mistakes, creates a natural sounding conversation, and gives you a good point of reference to code your actions when you're ready.
  2. Create an action package, A JSON manifest that describes your actions and defines other metadata.
  3. Define actions in the action package by doing the following:
    1. Define invocation and discovery patterns.
    2. Build dialogs and fulfillment.
  4. Test with the Web Simulator.
  5. Ensure you're ready for launch and take care of common issues.
  6. Publish the action and apply for an invocation name.