Conversation Actions help you fulfill user requests by letting you have a two-way dialog with users. When users request an action, the Google Assistant processes this request, determines the best action to invoke, and invokes your Conversation Action if relevant. From there, your action manages the rest, including how users are greeted, how to fulfill the user's request, and how the conversation ends.
Major components of a Conversation Action
When you build conversation actions, you define these major components:
- Invocation triggers define how users invoke and discover your actions. Once triggered, your action carries out a conversation with users, which is defined by dialogs.
- Dialogs define how users converse with your actions and act as the user interface for your actions. They rely on fulfillment code to move the conversation forward.
- Fulfillment is the code that processes user input and returns responses and you expose it as a REST endpoint. Fulfillment also typically has the logic that carries out the actual action like retrieving recipes or news to read aloud.
All of these components require you to communicate with the Google Assistant in a standard way, which is defined by the Conversation API.
The Conversation API defines a request and response format that you must adhere to when communicating with the Google Assistant. Even though you control the user experience when your action is invoked, the Google Assistant still brokers and validates the communication between your action and the user.
Requests contain information such as the user input, information about the user and the device the request came from, and other important data you need to process the requests. The Google Assistant sends requests to your actions when it wants to invoke them and when it has user input that it needs to send to your actions for processing.
Responses that you return to the Google Assistant contain information such as the text to speak back to users and whether or not you expect the user to provide additional information. Your actions must send a response to the Google Assistant every time it receives a request.
To help you parse requests and construct responses, we provide the Actions SDK, which comes with a NodeJS client library.
The Actions SDK provides the following tools and libraries to build actions:
- NodeJS client library - This library provides convenience methods to parse requests and construct responses that adhere to the Conversation API. You use this library in your fulfillment code.
- Action Package definition - A JSON-based definition that describes a group of actions, how they are invoked, what fulfillment endpoints to call, and other important metadata. You provide this file, along with other assets, when you submit your action for approval.
gactionsCLI - a command line interface to test actions and deploy action packages
- Web Simulator - a web-based, virtual Google Home device to simulate your actions on
See Actions SDK Getting Started to build your first action with the Actions SDK.
API.AI and other tools
The Actions SDK gives you all the tools you need to build Conversation Actions, but you might want to choose to build with one of our supported tools, such as API.AI. These tools generally provide a better developer experience by making it easier to build and deploy actions within a single interface and also provide additional features to make building actions easier. By using API.AI to build actions, you gain a lot of conveniences, such as:
- API.AI NLU - API.AI's Natural Language Understanding is integrated into API.AI and does in-dialog processing of input. This offers you with conveniences such as natural expansion of phrases and built-in features to easily distinguish and parse arguments from user input.
- A GUI interface - You can define and configure action components, such as dialogs and invocation, in an easy-to-use UI.
- Conversation building features - API.AI has advanced features such as contexts, which let you easily maintain state and contextualize user requests, a built-in simulator, and machine learning algorithms to better understand user input.
To get started with API.AI, see the Getting Started guide.
See the Tools overview for information on the tools we support and companies to help you build actions.