# Google Cloud Dialogflow V2 Client - Class WebhookResponse (2.4.0)

2.4.0 (latest) 2.3.1 2.2.1 2.1.2 2.0.1 1.17.2 1.16.0 1.15.1 1.14.0 1.13.0 1.12.3 1.11.0 1.10.2 1.9.0 1.8.0 1.7.2 1.6.0 1.5.0 1.4.0 1.3.2 1.2.0 1.1.1 1.0.1 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 the
[QueryResult.diagnostic_info](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getDiagnosticInfo__)
field. Setting JSON fields to an empty value with the wrong type is a common
error. To avoid this error:

- Use `""` for empty strings
- Use `}` or `null` for empty objects
- Use `[]` or `null` for empty arrays For more information, see the [Protocol Buffers Language
  Guide](https://developers.google.com/protocol-buffers/docs/proto3#json).

Generated from protobuf message `google.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 use `fulfillment_messages.text.text[0]` instead. When provided, Dialogflow uses this field to populate [QueryResult.fulfillment_text](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getFulfillmentText__) sent to the integration or API caller. |
| `↳ fulfillment_messages` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Intent.Message>` Optional. The rich response messages intended for the end-user. When provided, Dialogflow uses this field to populate [QueryResult.fulfillment_messages](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getFulfillmentMessages__) sent 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 populate [QueryResult.webhook_source](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getWebhookSource__) sent to the integration or API caller. |
| `↳ payload` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Struct` 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 populate [QueryResult.webhook_payload](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getWebhookPayload__) sent to the integration or API caller. This field is also used by the [Google Assistant integration](https://cloud.google.com/dialogflow/docs/integrations/aog) for rich response messages. See the format definition at [Google Assistant Dialogflow webhook format](https://developers.google.com/assistant/actions/build/json/dialogflow-webhook-json) |
| `↳ output_contexts` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Context>` 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 populate [QueryResult.output_contexts](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getOutputContexts__) sent to the integration or API caller. |
| `↳ followup_event_input` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.EventInput` Optional. Invokes the supplied events. When this field is set, Dialogflow ignores the `fulfillment_text`, `fulfillment_messages`, and `payload` fields. |
| `↳ session_entity_types` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.SessionEntityType>` 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 using `detectIntent`, `streamingDetectIntent` or [SessionEntityType](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.SessionEntityType) management methods. |

### getFulfillmentText

Optional. The text response message intended for the end-user.

It is recommended to use `fulfillment_messages.text.text[0]` instead.
When provided, Dialogflow uses this field to populate
[QueryResult.fulfillment_text](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getFulfillmentText__)
sent 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 use `fulfillment_messages.text.text[0]` instead.
When provided, Dialogflow uses this field to populate
[QueryResult.fulfillment_text](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getFulfillmentText__)
sent 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.

When provided, Dialogflow uses this field to populate
[QueryResult.fulfillment_messages](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getFulfillmentMessages__)
sent to the integration or API caller.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Intent.Message>` |   |

### setFulfillmentMessages

Optional. The rich response messages intended for the end-user.

When provided, Dialogflow uses this field to populate
[QueryResult.fulfillment_messages](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getFulfillmentMessages__)
sent to the integration or API caller.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Intent.Message>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSource

Optional. A custom field used to identify the webhook source.

Arbitrary strings are supported.
When provided, Dialogflow uses this field to populate
[QueryResult.webhook_source](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getWebhookSource__)
sent 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 populate
[QueryResult.webhook_source](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getWebhookSource__)
sent 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 populate
[QueryResult.webhook_payload](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getWebhookPayload__)
sent to the integration or API caller. This field is also used by the
[Google Assistant
integration](https://cloud.google.com/dialogflow/docs/integrations/aog)
for rich response messages.

See the format definition at [Google Assistant Dialogflow webhook
format](https://developers.google.com/assistant/actions/build/json/dialogflow-webhook-json)

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Struct|null` |   |

### hasPayload

### clearPayload

### setPayload

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 populate
[QueryResult.webhook_payload](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getWebhookPayload__)
sent to the integration or API caller. This field is also used by the
[Google Assistant
integration](https://cloud.google.com/dialogflow/docs/integrations/aog)
for rich response messages.

See the format definition at [Google Assistant Dialogflow webhook
format](https://developers.google.com/assistant/actions/build/json/dialogflow-webhook-json)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Struct` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getOutputContexts

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 populate
[QueryResult.output_contexts](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getOutputContexts__)
sent to the integration or API caller.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Context>` |   |

### setOutputContexts

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 populate
[QueryResult.output_contexts](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.QueryResult#_Google_Cloud_Dialogflow_V2_QueryResult__getOutputContexts__)
sent to the integration or API caller.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.Context>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getFollowupEventInput

Optional. Invokes the supplied events.

When this field is set, Dialogflow ignores the `fulfillment_text`,
`fulfillment_messages`, and `payload` fields.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.EventInput|null` |   |

### hasFollowupEventInput

### clearFollowupEventInput

### setFollowupEventInput

Optional. Invokes the supplied events.

When this field is set, Dialogflow ignores the `fulfillment_text`,
`fulfillment_messages`, and `payload` fields.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.EventInput` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSessionEntityTypes

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 using `detectIntent`,
`streamingDetectIntent` or
[SessionEntityType](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.SessionEntityType)
management methods.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.SessionEntityType>` |   |

### setSessionEntityTypes

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 using `detectIntent`,
`streamingDetectIntent` or
[SessionEntityType](https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.SessionEntityType)
management methods.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-dialogflow/latest/V2.SessionEntityType>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |