REST Resource: projects.agent.intents

Resource: Intent

An intent categorizes an end-user's intention for one conversation turn. For each agent, you define many intents, where your combined intents can handle a complete conversation. When an end-user writes or says something, referred to as an end-user expression or end-user input, Dialogflow matches the end-user input to the best intent in your agent. Matching an intent is also known as intent classification.

For more information, see the intent guide.

JSON representation
{
  "name": string,
  "displayName": string,
  "webhookState": enum (WebhookState),
  "priority": integer,
  "isFallback": boolean,
  "mlEnabled": boolean,
  "mlDisabled": boolean,
  "liveAgentHandoff": boolean,
  "endInteraction": boolean,
  "inputContextNames": [
    string
  ],
  "events": [
    string
  ],
  "trainingPhrases": [
    {
      object (TrainingPhrase)
    }
  ],
  "action": string,
  "outputContexts": [
    {
      object (Context)
    }
  ],
  "resetContexts": boolean,
  "parameters": [
    {
      object (Parameter)
    }
  ],
  "messages": [
    {
      object (Message)
    }
  ],
  "defaultResponsePlatforms": [
    enum (Platform)
  ],
  "rootFollowupIntentName": string,
  "parentFollowupIntentName": string,
  "followupIntentInfo": [
    {
      object (FollowupIntentInfo)
    }
  ]
}
Fields
name

string

Optional. The unique identifier of this intent. Required for Intents.UpdateIntent and Intents.BatchUpdateIntents methods. Supported formats:

  • projects/<Project ID>/agent/intents/<Intent ID>
  • projects/<Project ID>/locations/<Location ID>/agent/intents/<Intent ID>
displayName

string

Required. The name of this intent.

webhookState

enum (WebhookState)

Optional. Indicates whether webhooks are enabled for the intent.

priority

integer

Optional. The priority of this intent. Higher numbers represent higher priorities.

  • If the supplied value is unspecified or 0, the service translates the value to 500,000, which corresponds to the Normal priority in the console.
  • If the supplied value is negative, the intent is ignored in runtime detect intent requests.
isFallback

boolean

Optional. Indicates whether this is a fallback intent.

mlEnabled
(deprecated)

boolean

Optional. Indicates whether Machine Learning is enabled for the intent. Note: If mlEnabled setting is set to false, then this intent is not taken into account during inference in ML ONLY match mode. Also, auto-markup in the UI is turned off. DEPRECATED! Please use mlDisabled field instead. NOTE: If both mlEnabled and mlDisabled are either not set or false, then the default value is determined as follows:

  • Before April 15th, 2018 the default is: mlEnabled = false / mlDisabled = true.
  • After April 15th, 2018 the default is: mlEnabled = true / mlDisabled = false.
mlDisabled

boolean

Optional. Indicates whether Machine Learning is disabled for the intent. Note: If mlDisabled setting is set to true, then this intent is not taken into account during inference in ML ONLY match mode. Also, auto-markup in the UI is turned off.

liveAgentHandoff

boolean

Optional. Indicates that a live agent should be brought in to handle the interaction with the user. In most cases, when you set this flag to true, you would also want to set endInteraction to true as well. Default is false.

endInteraction

boolean

Optional. Indicates that this intent ends an interaction. Some integrations (e.g., Actions on Google or Dialogflow phone gateway) use this information to close interaction with an end user. Default is false.

inputContextNames[]

string

Optional. The list of context names required for this intent to be triggered. Formats:

  • projects/<Project ID>/agent/sessions/-/contexts/<Context ID>
  • projects/<Project ID>/locations/<Location ID>/agent/sessions/-/contexts/<Context ID>
events[]

string

Optional. The collection of event names that trigger the intent. If the collection of input contexts is not empty, all of the contexts must be present in the active user session for an event to trigger this intent. Event names are limited to 150 characters.

trainingPhrases[]

object (TrainingPhrase)

Optional. The collection of examples that the agent is trained on.

action

string

Optional. The name of the action associated with the intent. Note: The action name must not contain whitespaces.

outputContexts[]

object (Context)

Optional. The collection of contexts that are activated when the intent is matched. Context messages in this collection should not set the parameters field. Setting the lifespanCount to 0 will reset the context when the intent is matched. Format: projects/<Project ID>/agent/sessions/-/contexts/<Context ID>.

resetContexts

boolean

Optional. Indicates whether to delete all contexts in the current session when this intent is matched.

parameters[]

object (Parameter)

Optional. The collection of parameters associated with the intent.

messages[]

object (Message)

Optional. The collection of rich messages corresponding to the Response field in the Dialogflow console.

defaultResponsePlatforms[]

enum (Platform)

Optional. The list of platforms for which the first responses will be copied from the messages in PLATFORM_UNSPECIFIED (i.e. default platform).

rootFollowupIntentName

string

Output only. The unique identifier of the root intent in the chain of followup intents. It identifies the correct followup intents chain for this intent.

Format: projects/<Project ID>/agent/intents/<Intent ID>.

parentFollowupIntentName

string

Optional. The unique identifier of the parent intent in the chain of followup intents. You can set this field when creating an intent, for example with intents.create or intents.batchUpdate, in order to make this intent a followup intent.

It identifies the parent followup intent. Format: projects/<Project ID>/agent/intents/<Intent ID>.

followupIntentInfo[]

object (FollowupIntentInfo)

Output only. Information about all followup intents that have this intent as a direct or indirect parent. We populate this field only in the output.

WebhookState

Represents the different states that webhooks can be in.

Enums
WEBHOOK_STATE_UNSPECIFIED Webhook is disabled in the agent and in the intent.
WEBHOOK_STATE_ENABLED Webhook is enabled in the agent and in the intent.
WEBHOOK_STATE_ENABLED_FOR_SLOT_FILLING Webhook is enabled in the agent and in the intent. Also, each slot filling prompt is forwarded to the webhook.

TrainingPhrase

Represents an example that the agent is trained on.

JSON representation
{
  "name": string,
  "type": enum (Type),
  "parts": [
    {
      object (Part)
    }
  ],
  "timesAddedCount": integer
}
Fields
name

string

Output only. The unique identifier of this training phrase.

type

enum (Type)

Required. The type of the training phrase.

parts[]

object (Part)

Required. The ordered list of training phrase parts. The parts are concatenated in order to form the training phrase.

Note: The API does not automatically annotate training phrases like the Dialogflow Console does.

Note: Do not forget to include whitespace at part boundaries, so the training phrase is well formatted when the parts are concatenated.

If the training phrase does not need to be annotated with parameters, you just need a single part with only the Part.text field set.

If you want to annotate the training phrase, you must create multiple parts, where the fields of each part are populated in one of two ways:

  • Part.text is set to a part of the phrase that has no parameters.
  • Part.text is set to a part of the phrase that you want to annotate, and the entityType, alias, and userDefined fields are all set.
timesAddedCount

integer

Optional. Indicates how many times this example was added to the intent. Each time a developer adds an existing sample by editing an intent or training, this counter is increased.

Type

Represents different types of training phrases.

Enums
TYPE_UNSPECIFIED Not specified. This value should never be used.
EXAMPLE Examples do not contain @-prefixed entity type names, but example parts can be annotated with entity types.
TEMPLATE

Templates are not annotated with entity types, but they can contain @-prefixed entity type names as substrings. Note: Template mode has been deprecated. Example mode is the only supported way to create new training phrases. If you have existing training phrases in template mode, they will be removed during training and it can cause a drop in agent performance.

Part

Represents a part of a training phrase.

JSON representation
{
  "text": string,
  "entityType": string,
  "alias": string,
  "userDefined": boolean
}
Fields
text

string

Required. The text for this part.

entityType

string

Optional. The entity type name prefixed with @. This field is required for annotated parts of the training phrase.

alias

string

Optional. The parameter name for the value extracted from the annotated part of the example. This field is required for annotated parts of the training phrase.

userDefined

boolean

Optional. Indicates whether the text was manually annotated. This field is set to true when the Dialogflow Console is used to manually annotate the part. When creating an annotated part with the API, you must set this to true.

Parameter

Represents intent parameters.

JSON representation
{
  "name": string,
  "displayName": string,
  "value": string,
  "defaultValue": string,
  "entityTypeDisplayName": string,
  "mandatory": boolean,
  "prompts": [
    string
  ],
  "isList": boolean
}
Fields
name

string

The unique identifier of this parameter.

displayName

string

Required. The name of the parameter.

value

string

Optional. The definition of the parameter value. It can be:

  • a constant string,
  • a parameter value defined as $parameter_name,
  • an original parameter value defined as $parameter_name.original,
  • a parameter value from some context defined as #context_name.parameter_name.
defaultValue

string

Optional. The default value to use when the value yields an empty result. Default values can be extracted from contexts by using the following syntax: #context_name.parameter_name.

entityTypeDisplayName

string

Optional. The name of the entity type, prefixed with @, that describes values of the parameter. If the parameter is required, this must be provided.

mandatory

boolean

Optional. Indicates whether the parameter is required. That is, whether the intent cannot be completed without collecting the parameter value.

prompts[]

string

Optional. The collection of prompts that the agent can present to the user in order to collect a value for the parameter.

isList

boolean

Optional. Indicates whether the parameter represents a list of values.

FollowupIntentInfo

Represents a single followup intent in the chain.

JSON representation
{
  "followupIntentName": string,
  "parentFollowupIntentName": string
}
Fields
followupIntentName

string

The unique identifier of the followup intent. Format: projects/<Project ID>/agent/intents/<Intent ID>.

parentFollowupIntentName

string

The unique identifier of the followup intent's parent. Format: projects/<Project ID>/agent/intents/<Intent ID>.

Methods

batchDelete

Deletes intents in the specified agent.

batchUpdate

Updates/Creates multiple intents in the specified agent.

create

Creates an intent in the specified agent.

delete

Deletes the specified intent and its direct or indirect followup intents.

get

Retrieves the specified intent.

list

Returns the list of all intents in the specified agent.

patch

Updates the specified intent.