Reference documentation and code samples for the Google Cloud Dialogflow V2 Client class DetectIntentRequest.
The request to detect user's intent.
Generated from protobuf message google.cloud.dialogflow.v2.DetectIntentRequest
Namespace
Google \ Cloud \ Dialogflow \ V2
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ session
string
Required. The name of the session this query is sent to. Format: projects/<Project ID>/agent/sessions/<Session ID>, or projects/<Project ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session ID>. If Environment ID is not specified, we assume default 'draft' environment (Environment ID might be referred to as environment name at some places). If User ID is not specified, we are using "-". It's up to the API caller to choose an appropriate Session ID and User Id. They can be a random number or some type of user and session identifiers (preferably hashed). The length of the Session ID and User ID must not exceed 36 characters. For more information, see the API interactions guide. Note: Always use agent versions for production traffic. See Versions and environments.
Required. The input specification. It can be set to: 1. an audio config which instructs the speech recognizer how to process the speech audio, 2. a conversational query in the form of text, or 3. an event that specifies which intent to trigger.
Instructs the speech synthesizer how to generate the output audio. If this field is not set and agent-level speech synthesizer is not configured, no output audio is generated.
Mask for output_audio_config indicating which settings in this request-level config should override speech synthesizer settings defined at agent-level. If unspecified or empty, output_audio_config replaces the agent-level config in its entirety.
↳ input_audio
string
The natural language speech audio to be processed. This field should be populated iff query_input is set to an input audio config. A single request can contain up to 1 minute of speech audio data.
getSession
Required. The name of the session this query is sent to. Format:
projects/<Project ID>/agent/sessions/<Session ID>, or
projects/<Project ID>/agent/environments/<Environment ID>/users/<User
ID>/sessions/<Session ID>. If Environment ID is not specified, we assume
default 'draft' environment (Environment ID might be referred to as
environment name at some places). If User ID is not specified, we are
using "-". It's up to the API caller to choose an appropriate Session ID
and User Id. They can be a random number or some type of user and session
identifiers (preferably hashed). The length of the Session ID and
User ID must not exceed 36 characters.
Required. The name of the session this query is sent to. Format:
projects/<Project ID>/agent/sessions/<Session ID>, or
projects/<Project ID>/agent/environments/<Environment ID>/users/<User
ID>/sessions/<Session ID>. If Environment ID is not specified, we assume
default 'draft' environment (Environment ID might be referred to as
environment name at some places). If User ID is not specified, we are
using "-". It's up to the API caller to choose an appropriate Session ID
and User Id. They can be a random number or some type of user and session
identifiers (preferably hashed). The length of the Session ID and
User ID must not exceed 36 characters.
Instructs the speech synthesizer how to generate the output
audio. If this field is not set and agent-level speech synthesizer is not
configured, no output audio is generated.
Instructs the speech synthesizer how to generate the output
audio. If this field is not set and agent-level speech synthesizer is not
configured, no output audio is generated.
Mask for
output_audio_config
indicating which settings in this request-level config should override
speech synthesizer settings defined at agent-level.
If unspecified or empty,
output_audio_config
replaces the agent-level config in its entirety.
Mask for
output_audio_config
indicating which settings in this request-level config should override
speech synthesizer settings defined at agent-level.
If unspecified or empty,
output_audio_config
replaces the agent-level config in its entirety.
The natural language speech audio to be processed. This field
should be populated iff query_input is set to an input audio config.
A single request can contain up to 1 minute of speech audio data.
Returns
Type
Description
string
setInputAudio
The natural language speech audio to be processed. This field
should be populated iff query_input is set to an input audio config.
A single request can contain up to 1 minute of speech audio data.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
static::build
Parameters
Name
Description
session
string
Required. The name of the session this query is sent to. Format:
projects/<Project ID>/agent/sessions/<Session ID>, or
projects/<Project ID>/agent/environments/<Environment ID>/users/<User
ID>/sessions/<Session ID>. If Environment ID is not specified, we assume
default 'draft' environment (Environment ID might be referred to as
environment name at some places). If User ID is not specified, we are
using "-". It's up to the API caller to choose an appropriate Session ID
and User Id. They can be a random number or some type of user and session
identifiers (preferably hashed). The length of the Session ID and
User ID must not exceed 36 characters.
Note: Always use agent versions for production traffic.
See Versions and
environments. Please see
SessionsClient::sessionName() for help formatting this field.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# Google Cloud Dialogflow V2 Client - Class DetectIntentRequest (2.1.2)\n\nVersion latestkeyboard_arrow_down\n\n- [2.1.2 (latest)](/php/docs/reference/cloud-dialogflow/latest/V2.DetectIntentRequest)\n- [2.1.1](/php/docs/reference/cloud-dialogflow/2.1.1/V2.DetectIntentRequest)\n- [2.0.1](/php/docs/reference/cloud-dialogflow/2.0.1/V2.DetectIntentRequest)\n- [1.17.2](/php/docs/reference/cloud-dialogflow/1.17.2/V2.DetectIntentRequest)\n- [1.16.0](/php/docs/reference/cloud-dialogflow/1.16.0/V2.DetectIntentRequest)\n- [1.15.1](/php/docs/reference/cloud-dialogflow/1.15.1/V2.DetectIntentRequest)\n- [1.14.0](/php/docs/reference/cloud-dialogflow/1.14.0/V2.DetectIntentRequest)\n- [1.13.0](/php/docs/reference/cloud-dialogflow/1.13.0/V2.DetectIntentRequest)\n- [1.12.3](/php/docs/reference/cloud-dialogflow/1.12.3/V2.DetectIntentRequest)\n- [1.11.0](/php/docs/reference/cloud-dialogflow/1.11.0/V2.DetectIntentRequest)\n- [1.10.2](/php/docs/reference/cloud-dialogflow/1.10.2/V2.DetectIntentRequest)\n- [1.9.0](/php/docs/reference/cloud-dialogflow/1.9.0/V2.DetectIntentRequest)\n- [1.8.0](/php/docs/reference/cloud-dialogflow/1.8.0/V2.DetectIntentRequest)\n- [1.7.2](/php/docs/reference/cloud-dialogflow/1.7.2/V2.DetectIntentRequest)\n- [1.6.0](/php/docs/reference/cloud-dialogflow/1.6.0/V2.DetectIntentRequest)\n- [1.5.0](/php/docs/reference/cloud-dialogflow/1.5.0/V2.DetectIntentRequest)\n- [1.4.0](/php/docs/reference/cloud-dialogflow/1.4.0/V2.DetectIntentRequest)\n- [1.3.2](/php/docs/reference/cloud-dialogflow/1.3.2/V2.DetectIntentRequest)\n- [1.2.0](/php/docs/reference/cloud-dialogflow/1.2.0/V2.DetectIntentRequest)\n- [1.1.1](/php/docs/reference/cloud-dialogflow/1.1.1/V2.DetectIntentRequest)\n- [1.0.1](/php/docs/reference/cloud-dialogflow/1.0.1/V2.DetectIntentRequest) \nReference documentation and code samples for the Google Cloud Dialogflow V2 Client class DetectIntentRequest.\n\nThe request to detect user's intent.\n\nGenerated from protobuf message `google.cloud.dialogflow.v2.DetectIntentRequest`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Dialogflow \\\\ V2\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getSession\n\nRequired. The name of the session this query is sent to. Format:\n`projects/\u003cProject ID\u003e/agent/sessions/\u003cSession ID\u003e`, or\n`projects/\u003cProject ID\u003e/agent/environments/\u003cEnvironment ID\u003e/users/\u003cUser\nID\u003e/sessions/\u003cSession ID\u003e`. If `Environment ID` is not specified, we assume\ndefault 'draft' environment (`Environment ID` might be referred to as\nenvironment name at some places). If `User ID` is not specified, we are\nusing \"-\". It's up to the API caller to choose an appropriate `Session ID`\nand `User Id`. They can be a random number or some type of user and session\nidentifiers (preferably hashed). The length of the `Session ID` and\n`User ID` must not exceed 36 characters.\n\nFor more information, see the [API interactions\nguide](https://cloud.google.com/dialogflow/docs/api-overview).\nNote: Always use agent versions for production traffic.\nSee [Versions and\nenvironments](https://cloud.google.com/dialogflow/es/docs/agents-versions).\n\n### setSession\n\nRequired. The name of the session this query is sent to. Format:\n`projects/\u003cProject ID\u003e/agent/sessions/\u003cSession ID\u003e`, or\n`projects/\u003cProject ID\u003e/agent/environments/\u003cEnvironment ID\u003e/users/\u003cUser\nID\u003e/sessions/\u003cSession ID\u003e`. If `Environment ID` is not specified, we assume\ndefault 'draft' environment (`Environment ID` might be referred to as\nenvironment name at some places). If `User ID` is not specified, we are\nusing \"-\". It's up to the API caller to choose an appropriate `Session ID`\nand `User Id`. They can be a random number or some type of user and session\nidentifiers (preferably hashed). The length of the `Session ID` and\n`User ID` must not exceed 36 characters.\n\nFor more information, see the [API interactions\nguide](https://cloud.google.com/dialogflow/docs/api-overview).\nNote: Always use agent versions for production traffic.\nSee [Versions and\nenvironments](https://cloud.google.com/dialogflow/es/docs/agents-versions).\n\n### getQueryParams\n\nThe parameters of this query.\n\n### hasQueryParams\n\n### clearQueryParams\n\n### setQueryParams\n\nThe parameters of this query.\n\n### getQueryInput\n\nRequired. The input specification. It can be set to:\n\n1. an audio config which instructs the speech recognizer how to process the speech audio,\n2. a conversational query in the form of text, or\n3. an event that specifies which intent to trigger.\n\n### hasQueryInput\n\n### clearQueryInput\n\n### setQueryInput\n\nRequired. The input specification. It can be set to:\n\n1. an audio config which instructs the speech recognizer how to process the speech audio,\n2. a conversational query in the form of text, or\n3. an event that specifies which intent to trigger.\n\n### getOutputAudioConfig\n\nInstructs the speech synthesizer how to generate the output\naudio. If this field is not set and agent-level speech synthesizer is not\nconfigured, no output audio is generated.\n\n### hasOutputAudioConfig\n\n### clearOutputAudioConfig\n\n### setOutputAudioConfig\n\nInstructs the speech synthesizer how to generate the output\naudio. If this field is not set and agent-level speech synthesizer is not\nconfigured, no output audio is generated.\n\n### getOutputAudioConfigMask\n\nMask for\n[output_audio_config](/php/docs/reference/cloud-dialogflow/latest/V2.DetectIntentRequest#_Google_Cloud_Dialogflow_V2_DetectIntentRequest__getOutputAudioConfig__)\nindicating which settings in this request-level config should override\nspeech synthesizer settings defined at agent-level.\n\nIf unspecified or empty,\n[output_audio_config](/php/docs/reference/cloud-dialogflow/latest/V2.DetectIntentRequest#_Google_Cloud_Dialogflow_V2_DetectIntentRequest__getOutputAudioConfig__)\nreplaces the agent-level config in its entirety.\n\n### hasOutputAudioConfigMask\n\n### clearOutputAudioConfigMask\n\n### setOutputAudioConfigMask\n\nMask for\n[output_audio_config](/php/docs/reference/cloud-dialogflow/latest/V2.DetectIntentRequest#_Google_Cloud_Dialogflow_V2_DetectIntentRequest__getOutputAudioConfig__)\nindicating which settings in this request-level config should override\nspeech synthesizer settings defined at agent-level.\n\nIf unspecified or empty,\n[output_audio_config](/php/docs/reference/cloud-dialogflow/latest/V2.DetectIntentRequest#_Google_Cloud_Dialogflow_V2_DetectIntentRequest__getOutputAudioConfig__)\nreplaces the agent-level config in its entirety.\n\n### getInputAudio\n\nThe natural language speech audio to be processed. This field\nshould be populated iff `query_input` is set to an input audio config.\n\nA single request can contain up to 1 minute of speech audio data.\n\n### setInputAudio\n\nThe natural language speech audio to be processed. This field\nshould be populated iff `query_input` is set to an input audio config.\n\nA single request can contain up to 1 minute of speech audio data.\n\n### static::build"]]