Google Assistant Developer
Google Actions
Published in
7 min readMar 1, 2017

--

Google Action Previews

Action preview is the mechanism for developer to start a trial on Google Assistant even before the agent is registered or approved.

It is the main entry point for developers’ submissions is the action package.

Each action preview has a list of actions and each one can be a one-shot action, or a multi-turn conversation, so an action instance refers to a single-shot action or a multi-turn action.

Uber has been using developing their Google Assistant using account linking, which requires users are signed-in using their own OAuth2 provider.

They have been using a set of “trigger phrases” used to match user’s queries only when the user is in the middle of a dialog.

— “Take me to $SchemaOrg_Location:dest” —

Triggers indicates whether it’s an initial trigger or a follow-up trigger while the intent is captured by the grammar match:

— BOOK_A_CAB —

Grammar patterns developed for requests are in the form of: [token|Type:name]+.

This allows phrases such as “book a cab to $SchemaOrg_Location:destination” to provide parsing needed to establish which action(s) are desired as its result.

source: actionPreviews.create.__doc__Creates an Action Preview. Given a timeout and an Action Package w/o action_package_id provided, we assign a UUID for the action_package_id, insert it into the Action Package and return the Action Preview object.

Args:
body: object, The request body. (required)
The object takes the form of:

{ # The main entry point for developer's submission.
"actionPackageId": "A String", # Unique ID for this Action Package, developer invokes GetActionPackageID to
# request this ID.
"applicationInfo": { # Global application info for this agent. # Metadata for the application, like app name, ACL.
"voiceName": "A String", # Used to define voice type for current application. Must be set for 3p
# developers.
"appName": "A String", # The unique App name for the Application, developer submits an gets approval
# from Pantheon front-end, the name can't include space, e.g., "com.uber".
"voiceType": "A String", # Used to define voice type for current application. Must be set for 3p
# actions.
"displayName": "A String", # Developer friendly name for this agent.
},
"customType": [ # Developer defined custom types, e.g., Uber type from uber.
{ # Tye defined by Developer such as list of colors, or list of uber types.
"isDynamicDefined": True or False, # Indicates the type is runtime defined. Prefer is_user_defined instead. This
# field will be deprecated.
"name": "A String", # Name of the custom type, in the format of "$Type".
"isUserDefined": True or False, # Whether the values are user-defined (different for every user).
"entityCategory": "A String", # Semantic built-in type that is a hypernym of the entity type. Must be a
# built-in type.
"items": [ # List of items for this type. Each includes a key and list of synonyms.
{ # Each Item corresponds a unique entity for this type, it has a unique key
# and list of synonyms which are used to trigger.
"synonyms": [ # List of synonyms which can be used to refer to this item.
"A String",
],
"key": "A String", # Unique key for this item.
},
],
},
],
"action": [ # Each AP has list of actions, each could be an one-shot action, or a
# multiturn conversation.
{ # Action is an instance for a single-shot action or a multi-turn action.
"initialTrigger": { # Trigger indicates whether it's initial trigger or follow-on trigger. # Trigger phrases to activate developer's backend when user is not in any
# dialog, e.g., [OK Google, book a cab].
"intent": "A String", # Intent captured by the grammar match, e.g., BOOK_A_CAB.
"example": [ # List of trigger query pattern.
{ # Example captures an instance of annotated query example.
"queryPattern": "A String", # Grammar pattern developer requests, in the form of [token|Type:name]+ such
# as "book a cab to $SchemaOrg_Location:destination".
},
],
},
"language": "A String",
"description": "A String", # Describes what the action is doing.
"signInRequired": True or False, # Indicates whether to require user to sign-in before using the feature. This
# is set to true by default for APs requiring account linking such as Uber.
"inDialogTrigger": [ # Trigger phrases used to match user's queries only when user is in the
# middle of a dialog, e.g., [take me to $SchemaOrg_Location:dest].
{ # Trigger indicates whether it's initial trigger or follow-on trigger.
"intent": "A String", # Intent captured by the grammar match, e.g., BOOK_A_CAB.
"example": [ # List of trigger query pattern.
{ # Example captures an instance of annotated query example.
"queryPattern": "A String", # Grammar pattern developer requests, in the form of [token|Type:name]+ such
# as "book a cab to $SchemaOrg_Location:destination". },
],
},
],
"execution": { # Execution indicates how to execute the Action, as of Nov 2016, only HTTP is # Indicates the cloud endpoint which manages the actual dialog.
# allowed.
"httpMethod": "A String", # The HTTP method to execute the HTTP endpoint.
"url": "A String", # Cloud endpoint, could be Google Cloud Function or self-hosting endpoint.
},
},
],
}

timeoutInMins: string, How long developer wants to make this preview valid. If unspecified, a
default timeout 10 mins will be used.
x__xgafv: string, V1 error format.
Allowed values
1 - v1 error format
2 - v2 error format

Returns:
An object of the form:

{ # Action Preview is the mechanism for developer to start a tial on Gooogle
# Assistant even before the agent is registered or approved.
"createTime": "A String", # Creation time of an Action Preview.
"expireTime": "A String", # Expiration time of an Action Preview, it will be removed automatically.
"actionPackage": { # The main entry point for developer's submission. # The actual Action Package developer wants to preview. When she creates the
# preview, initially she does not have the action_package_id which will be
# assigned in CreateActionPreview request.
"actionPackageId": "A String", # Unique ID for this Action Package, developer invokes GetActionPackageID to
# request this ID.
"applicationInfo": { # Global application info for this agent. # Metadata for the application, like app name, ACL.
"voiceName": "A String", # Used to define voice type for current application. Must be set for 3p
# developers.
"appName": "A String", # The unique App name for the Application, developer submits an gets approval
# from Pantheon front-end, the name can't include space, e.g., "com.uber".
"voiceType": "A String", # Used to define voice type for current application. Must be set for 3p
# actions.
"displayName": "A String", # Developer friendly name for this agent.
},
"customType": [ # Developer defined custom types, e.g., Uber type from uber.
{ # Tye defined by Developer such as list of colors, or list of uber types.
"isDynamicDefined": True or False, # Indicates the type is runtime defined. Prefer is_user_defined instead. This
# field will be deprecated.
"name": "A String", # Name of the custom type, in the format of "$Type".
"isUserDefined": True or False, # Whether the values are user-defined (different for every user).
"entityCategory": "A String", # Semantic built-in type that is a hypernym of the entity type. Must be a
# built-in type.
"items": [ # List of items for this type. Each includes a key and list of synonyms.
{ # Each Item corresponds a unique entity for this type, it has a unique key
# and list of synonyms which are used to trigger.
"synonyms": [ # List of synonyms which can be used to refer to this item.
"A String",
],
"key": "A String", # Unique key for this item.
},
],
},
],
"action": [ # Each AP has list of actions, each could be an one-shot action, or a
# multiturn conversation.
{ # Action is an instance for a single-shot action or a multi-turn action.
"initialTrigger": { # Trigger indicates whether it's initial trigger or follow-on trigger. # Trigger phrases to activate developer's backend when user is not in any
# dialog, e.g., [OK Google, book a cab].
"intent": "A String", # Intent captured by the grammar match, e.g., BOOK_A_CAB.
"example": [ # List of trigger query pattern.
{ # Example captures an instance of annotated query example.
"queryPattern": "A String", # Grammar pattern developer requests, in the form of [token|Type:name]+ such
# as "book a cab to $SchemaOrg_Location:destination".
},
],
},
"language": "A String",
"description": "A String", # Describes what the action is doing.
"signInRequired": True or False, # Indicates whether to require user to sign-in before using the feature. This
# is set to true by default for APs requiring account linking such as Uber.
"inDialogTrigger": [ # Trigger phrases used to match user's queries only when user is in the
# middle of a dialog, e.g., [take me to $SchemaOrg_Location:dest].
{ # Trigger indicates whether it's initial trigger or follow-on trigger.
"intent": "A String", # Intent captured by the grammar match, e.g., BOOK_A_CAB.
"example": [ # List of trigger query pattern.
{ # Example captures an instance of annotated query example.
"queryPattern": "A String", # Grammar pattern developer requests, in the form of [token|Type:name]+ such
# as "book a cab to $SchemaOrg_Location:destination".
},
],
},
],
"execution": { # Execution indicates how to execute the Action, as of Nov 2016, only HTTP is # Indicates the cloud endpoint which manages the actual dialog.
# allowed.
"httpMethod": "A String", # The HTTP method to execute the HTTP endpoint.
"url": "A String", # Cloud endpoint, could be Google Cloud Function or self-hosting endpoint.
},
},
],
},
}

--

--