Actions on Google integration

The Actions on Google integration for Dialogflow lets you build conversational fulfillment for Actions by handling communication between your Dialogflow agent and the Google Assistant using the Conversation protocol, which defines a standard way for conversational fulfillment to communicate with the Assistant. The integration lets you use Dialogflow's easy-to-use IDE and best-in-class NLU to build and deploy Actions without having to parse requests and generate responses in the Conversation protocol. In fact, you can build fulfillment for simple Actions completely in Dialogflow, without any code.

The following sections describe how fulfillment works and how Actions on Google intents map to Dialogflow intents when enabling the Actions on Google integration.

Fulfillment

Your Dialogflow agent acts as conversational fulfillment for your Actions. In addition, your actual agent can also call it's own fulfillment to further customize logic for your Actions.

Action fulfillment

When the Assistant invokes your agent, it acts as conversational fulfillment for your Action. The Assistant sends user utterances to your Dialogflow agent to match to an intent and respond back. Your agent matches the utterance to an intent and sends a response. The Assistant renders this response to the user, displaying it appropriately depending on the user's device capabilities (audio and display output).

Dialogflow agent fulfillment

In addition, your Dialogflow agent can call on its own fulfillment (deployed as a webhook) to carry out some logic like calling a REST API or some other backend service and then generate a response to return to the Assistant. In this case, your webhook generates the response using the Dialogflow webhook format. Your agent then translates this response to the Actions on Google conversation protocol so the Assistant can render the response to the user.

You can turn on fulfillment for individual Dialogflow intents, which allows you to specify which intents require extra processing and which can just return responses defined within the Dialogflow console.

Intents

Intents are used differently in Actions on Google than in Dialogflow, but there is a consistent mapping between the two platforms' intents to allow interoperability. The Conversation protocol requires the Assistant to provide an intent in every request to your Dialogflow agent, along with other data such as the user utterance, so that your Dialogflow agent knows how to respond back. Your Dialogflow agent receives the Actions on Google intent, matches it to one of its own intents, and responds back.

Your Dialogflow agent maps one of its own intents to one of these general types of Actions on Google intents:

  • Action - Represent tasks that the user wants to carry out. When your agent receives an Action intent, this means that the Assistant wants your agent to fulfill the user's request for an Action and is invoking the agent.
  • Dialog - Represents a back and forth turn between the Assistant and your fulfillment. The Assistant sends requests with the dialog intent (actions.intent.TEXT) to your agent when it receives a user utterance that it wants your agent to process. When your agent receives a dialog intent, it finds a matching Dialogflow intent and responds back accordingly. This happens repeatedly until your agent has enough information to fulfill the Action.
  • Helper - Represents a dialog that you want the Assistant to carry out on your behalf, such as obtaining the user's email or location. Your agent sends a response to the Assistant with a helper intent to carry out a dialog. The Assistant then returns the result of the helper back to your agent.

Action intents

Action intents represent something users want to get done and are passed to your Dialogflow agent when an Action is invoked. Your agent then carries out a conversation to fulfill the Action. There are three types of Action intents:

  • Main intent - This intent is named actions.intent.MAIN and represents the default Action for every Actions project. Your agent must specify one and only one intent as your main intent. When users say the invocation name that is associated with your Actions project, the Assistant makes an HTTP request to the corresponding fulfillment, providing this intent in the request, and hands off the conversation to your Dialogflow agent.

  • Built-in intents - Google defines these intents and the user utterances that trigger them. You can opt into supporting these intents to support standard invocations such as "play a game". For more information, see the built-in intents in Actions on Google documentation.

  • Custom intents - You define these intents and the user utterances that trigger them. These intents represent custom Actions that you create. To define a custom action, you specify the following components:

    • Query patterns- that describe what user utterances can trigger this intent.
    • Parameters that you want to parse from the user utterances.
    • A unique name for an intent that typically follows reverse domain name notation, followed by the name of the intent in all caps. For example, com.mybrand.MY_INTENT.

For more information on how to specify Actions, see the Build documentation.

Dialog intents

After your agent receives an initial request to carry out an Action, it must respond back. Typically, a conversation involves many back and forth turns and expects requests to come in after a response. These requests are represented by the actions.intent.TEXT intent, which represents a generic user utterance after your agent has been invoked. The user utterances that are associated with these intents are matched to the corresponding Dialogflow intent in your agent. From there, your agent respond back accordingly.

Any intent in your Dialogflow agent can behave like a dialog intent, as long as the user utterance matches the Dialogflow intent's language model. For more information on how to build dialogs, see the Build documentation.

Helper intents

Helpers are small dialogs or tasks that you can ask the Assistant to carry out on your fulfillment's behalf. Helpers let you call on standard logic to carry out common tasks like asking users for their email address or location.

To request a helper, you specify a helper intent in a response back to the Assistant instead of the generic actions.intent.TEXT intent. When the Assistant receives this intent, it carries out the corresponding dialog, gets the information it needs from the user, and returns it back to you in the subsequent request to your fulfillment. In this request, a helper event is sent to your agent, along with the data returned from the helper. The corresponding intent is matched and your agent's fulfillment can process the helper data.

For more information on how to use helpers, see the Build documentation.