Reference documentation and code samples for the Google Cloud Dialogflow V2 Client class WebhookResponse.
The response message for a webhook call.
This response is validated by the Dialogflow server. If validation fails,
an error will be returned in theQueryResult.diagnostic_infofield. Setting JSON fields to an empty value with the wrong type is a common
error. To avoid this error:
Generated from protobuf messagegoogle.cloud.dialogflow.v2.WebhookResponse
Namespace
Google \ Cloud \ Dialogflow \ V2
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ fulfillment_text
string
Optional. The text response message intended for the end-user. It is recommended to usefulfillment_messages.text.text[0]instead. When provided, Dialogflow uses this field to populateQueryResult.fulfillment_textsent to the integration or API caller.
Optional. The rich response messages intended for the end-user. When provided, Dialogflow uses this field to populateQueryResult.fulfillment_messagessent to the integration or API caller.
↳ source
string
Optional. A custom field used to identify the webhook source. Arbitrary strings are supported. When provided, Dialogflow uses this field to populateQueryResult.webhook_sourcesent to the integration or API caller.
Optional. This field can be used to pass custom data from your webhook to the integration or API caller. Arbitrary JSON objects are supported. When provided, Dialogflow uses this field to populateQueryResult.webhook_payloadsent to the integration or API caller. This field is also used by theGoogle Assistant integrationfor rich response messages. See the format definition atGoogle Assistant Dialogflow webhook format
Optional. The collection of output contexts that will overwrite currently active contexts for the session and reset their lifespans. When provided, Dialogflow uses this field to populateQueryResult.output_contextssent to the integration or API caller.
Optional. Additional session entity types to replace or extend developer entity types with. The entity synonyms apply to all languages and persist for the session. Setting this data from a webhook overwrites the session entity types that have been set usingdetectIntent,streamingDetectIntentorSessionEntityTypemanagement methods.
getFulfillmentText
Optional. The text response message intended for the end-user.
It is recommended to usefulfillment_messages.text.text[0]instead.
When provided, Dialogflow uses this field to populateQueryResult.fulfillment_textsent to the integration or API caller.
Returns
Type
Description
string
setFulfillmentText
Optional. The text response message intended for the end-user.
It is recommended to usefulfillment_messages.text.text[0]instead.
When provided, Dialogflow uses this field to populateQueryResult.fulfillment_textsent to the integration or API caller.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getFulfillmentMessages
Optional. The rich response messages intended for the end-user.
Optional. A custom field used to identify the webhook source.
Arbitrary strings are supported.
When provided, Dialogflow uses this field to populateQueryResult.webhook_sourcesent to the integration or API caller.
Returns
Type
Description
string
setSource
Optional. A custom field used to identify the webhook source.
Arbitrary strings are supported.
When provided, Dialogflow uses this field to populateQueryResult.webhook_sourcesent to the integration or API caller.
Parameter
Name
Description
var
string
Returns
Type
Description
$this
getPayload
Optional. This field can be used to pass custom data from your webhook to
the integration or API caller. Arbitrary JSON objects are supported. When
provided, Dialogflow uses this field to populateQueryResult.webhook_payloadsent to the integration or API caller. This field is also used by theGoogle Assistant
integrationfor rich response messages.
Optional. This field can be used to pass custom data from your webhook to
the integration or API caller. Arbitrary JSON objects are supported. When
provided, Dialogflow uses this field to populateQueryResult.webhook_payloadsent to the integration or API caller. This field is also used by theGoogle Assistant
integrationfor rich response messages.
Optional. Additional session entity types to replace or extend developer
entity types with. The entity synonyms apply to all languages and persist
for the session. Setting this data from a webhook overwrites
the session entity types that have been set usingdetectIntent,streamingDetectIntentorSessionEntityTypemanagement methods.
Optional. Additional session entity types to replace or extend developer
entity types with. The entity synonyms apply to all languages and persist
for the session. Setting this data from a webhook overwrites
the session entity types that have been set usingdetectIntent,streamingDetectIntentorSessionEntityTypemanagement methods.
[[["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 WebhookResponse (2.1.2)\n\nVersion latestkeyboard_arrow_down\n\n- [2.1.2 (latest)](/php/docs/reference/cloud-dialogflow/latest/V2.WebhookResponse)\n- [2.1.1](/php/docs/reference/cloud-dialogflow/2.1.1/V2.WebhookResponse)\n- [2.0.1](/php/docs/reference/cloud-dialogflow/2.0.1/V2.WebhookResponse)\n- [1.17.2](/php/docs/reference/cloud-dialogflow/1.17.2/V2.WebhookResponse)\n- [1.16.0](/php/docs/reference/cloud-dialogflow/1.16.0/V2.WebhookResponse)\n- [1.15.1](/php/docs/reference/cloud-dialogflow/1.15.1/V2.WebhookResponse)\n- [1.14.0](/php/docs/reference/cloud-dialogflow/1.14.0/V2.WebhookResponse)\n- [1.13.0](/php/docs/reference/cloud-dialogflow/1.13.0/V2.WebhookResponse)\n- [1.12.3](/php/docs/reference/cloud-dialogflow/1.12.3/V2.WebhookResponse)\n- [1.11.0](/php/docs/reference/cloud-dialogflow/1.11.0/V2.WebhookResponse)\n- [1.10.2](/php/docs/reference/cloud-dialogflow/1.10.2/V2.WebhookResponse)\n- [1.9.0](/php/docs/reference/cloud-dialogflow/1.9.0/V2.WebhookResponse)\n- [1.8.0](/php/docs/reference/cloud-dialogflow/1.8.0/V2.WebhookResponse)\n- [1.7.2](/php/docs/reference/cloud-dialogflow/1.7.2/V2.WebhookResponse)\n- [1.6.0](/php/docs/reference/cloud-dialogflow/1.6.0/V2.WebhookResponse)\n- [1.5.0](/php/docs/reference/cloud-dialogflow/1.5.0/V2.WebhookResponse)\n- [1.4.0](/php/docs/reference/cloud-dialogflow/1.4.0/V2.WebhookResponse)\n- [1.3.2](/php/docs/reference/cloud-dialogflow/1.3.2/V2.WebhookResponse)\n- [1.2.0](/php/docs/reference/cloud-dialogflow/1.2.0/V2.WebhookResponse)\n- [1.1.1](/php/docs/reference/cloud-dialogflow/1.1.1/V2.WebhookResponse)\n- [1.0.1](/php/docs/reference/cloud-dialogflow/1.0.1/V2.WebhookResponse) \nReference documentation and code samples for the Google Cloud Dialogflow V2 Client class WebhookResponse.\n\nThe response message for a webhook call.\n\nThis response is validated by the Dialogflow server. If validation fails,\nan error will be returned in the\n[QueryResult.diagnostic_info](/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getDiagnosticInfo__)\nfield. Setting JSON fields to an empty value with the wrong type is a common\nerror. To avoid this error:\n\n- Use `\"\"` for empty strings\n- Use `}` or `null` for empty objects\n- Use `[]` or `null` for empty arrays For more information, see the [Protocol Buffers Language\n Guide](https://developers.google.com/protocol-buffers/docs/proto3#json).\n\nGenerated from protobuf message `google.cloud.dialogflow.v2.WebhookResponse`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Dialogflow \\\\ V2\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getFulfillmentText\n\nOptional. The text response message intended for the end-user.\n\nIt is recommended to use `fulfillment_messages.text.text[0]` instead.\nWhen provided, Dialogflow uses this field to populate\n[QueryResult.fulfillment_text](/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getFulfillmentText__)\nsent to the integration or API caller.\n\n### setFulfillmentText\n\nOptional. The text response message intended for the end-user.\n\nIt is recommended to use `fulfillment_messages.text.text[0]` instead.\nWhen provided, Dialogflow uses this field to populate\n[QueryResult.fulfillment_text](/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getFulfillmentText__)\nsent to the integration or API caller.\n\n### getFulfillmentMessages\n\nOptional. The rich response messages intended for the end-user.\n\nWhen provided, Dialogflow uses this field to populate\n[QueryResult.fulfillment_messages](/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getFulfillmentMessages__)\nsent to the integration or API caller.\n\n### setFulfillmentMessages\n\nOptional. The rich response messages intended for the end-user.\n\nWhen provided, Dialogflow uses this field to populate\n[QueryResult.fulfillment_messages](/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getFulfillmentMessages__)\nsent to the integration or API caller.\n\n### getSource\n\nOptional. A custom field used to identify the webhook source.\n\nArbitrary strings are supported.\nWhen provided, Dialogflow uses this field to populate\n[QueryResult.webhook_source](/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getWebhookSource__)\nsent to the integration or API caller.\n\n### setSource\n\nOptional. A custom field used to identify the webhook source.\n\nArbitrary strings are supported.\nWhen provided, Dialogflow uses this field to populate\n[QueryResult.webhook_source](/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getWebhookSource__)\nsent to the integration or API caller.\n\n### getPayload\n\nOptional. This field can be used to pass custom data from your webhook to\nthe integration or API caller. Arbitrary JSON objects are supported. When\nprovided, Dialogflow uses this field to populate\n[QueryResult.webhook_payload](/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getWebhookPayload__)\nsent to the integration or API caller. This field is also used by the\n[Google Assistant\nintegration](https://cloud.google.com/dialogflow/docs/integrations/aog)\nfor rich response messages.\n\nSee the format definition at [Google Assistant Dialogflow webhook\nformat](https://developers.google.com/assistant/actions/build/json/dialogflow-webhook-json)\n\n### hasPayload\n\n### clearPayload\n\n### setPayload\n\nOptional. This field can be used to pass custom data from your webhook to\nthe integration or API caller. Arbitrary JSON objects are supported. When\nprovided, Dialogflow uses this field to populate\n[QueryResult.webhook_payload](/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getWebhookPayload__)\nsent to the integration or API caller. This field is also used by the\n[Google Assistant\nintegration](https://cloud.google.com/dialogflow/docs/integrations/aog)\nfor rich response messages.\n\nSee the format definition at [Google Assistant Dialogflow webhook\nformat](https://developers.google.com/assistant/actions/build/json/dialogflow-webhook-json)\n\n### getOutputContexts\n\nOptional. The collection of output contexts that will overwrite currently\nactive contexts for the session and reset their lifespans.\n\nWhen provided, Dialogflow uses this field to populate\n[QueryResult.output_contexts](/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getOutputContexts__)\nsent to the integration or API caller.\n\n### setOutputContexts\n\nOptional. The collection of output contexts that will overwrite currently\nactive contexts for the session and reset their lifespans.\n\nWhen provided, Dialogflow uses this field to populate\n[QueryResult.output_contexts](/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getOutputContexts__)\nsent to the integration or API caller.\n\n### getFollowupEventInput\n\nOptional. Invokes the supplied events.\n\nWhen this field is set, Dialogflow ignores the `fulfillment_text`,\n`fulfillment_messages`, and `payload` fields.\n\n### hasFollowupEventInput\n\n### clearFollowupEventInput\n\n### setFollowupEventInput\n\nOptional. Invokes the supplied events.\n\nWhen this field is set, Dialogflow ignores the `fulfillment_text`,\n`fulfillment_messages`, and `payload` fields.\n\n### getSessionEntityTypes\n\nOptional. Additional session entity types to replace or extend developer\nentity types with. The entity synonyms apply to all languages and persist\nfor the session. Setting this data from a webhook overwrites\nthe session entity types that have been set using `detectIntent`,\n`streamingDetectIntent` or\n[SessionEntityType](/php/docs/reference/cloud-dialogflow/latest/V2.SessionEntityType)\nmanagement methods.\n\n### setSessionEntityTypes\n\nOptional. Additional session entity types to replace or extend developer\nentity types with. The entity synonyms apply to all languages and persist\nfor the session. Setting this data from a webhook overwrites\nthe session entity types that have been set using `detectIntent`,\n`streamingDetectIntent` or\n[SessionEntityType](/php/docs/reference/cloud-dialogflow/latest/V2.SessionEntityType)\nmanagement methods."]]