Google Cloud Dialogflow V2 Client - Class WebhookResponse (1.8.0)

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 field. Setting JSON fields to an empty value with the wrong type is a common error. To avoid this error:

Generated from protobuf message google.cloud.dialogflow.v2.WebhookResponse

Namespace

Google \ Cloud \ Dialogflow \ V2

Methods

__construct

Constructor.

Parameters
NameDescription
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 sent to the integration or API caller.

↳ fulfillment_messages array<Google\Cloud\Dialogflow\V2\Intent\Message>

Optional. The rich response messages intended for the end-user. When provided, Dialogflow uses this field to populate QueryResult.fulfillment_messages 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 sent to the integration or API caller.

↳ payload 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 sent to the integration or API caller. This field is also used by the Google Assistant integration for rich response messages. See the format definition at Google Assistant Dialogflow webhook format

↳ output_contexts array<Google\Cloud\Dialogflow\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 sent to the integration or API caller.

↳ followup_event_input Google\Cloud\Dialogflow\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<Google\Cloud\Dialogflow\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 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 sent to the integration or API caller.

Returns
TypeDescription
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 sent to the integration or API caller.

Parameter
NameDescription
var string
Returns
TypeDescription
$this

getFulfillmentMessages

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

When provided, Dialogflow uses this field to populate QueryResult.fulfillment_messages sent to the integration or API caller.

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

setFulfillmentMessages

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

When provided, Dialogflow uses this field to populate QueryResult.fulfillment_messages sent to the integration or API caller.

Parameter
NameDescription
var array<Google\Cloud\Dialogflow\V2\Intent\Message>
Returns
TypeDescription
$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 sent to the integration or API caller.

Returns
TypeDescription
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 sent to the integration or API caller.

Parameter
NameDescription
var string
Returns
TypeDescription
$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 sent to the integration or API caller. This field is also used by the Google Assistant integration for rich response messages.

See the format definition at Google Assistant Dialogflow webhook format

Returns
TypeDescription
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 sent to the integration or API caller. This field is also used by the Google Assistant integration for rich response messages.

See the format definition at Google Assistant Dialogflow webhook format

Parameter
NameDescription
var Google\Protobuf\Struct
Returns
TypeDescription
$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 sent to the integration or API caller.

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

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 sent to the integration or API caller.

Parameter
NameDescription
var array<Google\Cloud\Dialogflow\V2\Context>
Returns
TypeDescription
$this

getFollowupEventInput

Optional. Invokes the supplied events.

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

Returns
TypeDescription
Google\Cloud\Dialogflow\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
NameDescription
var Google\Cloud\Dialogflow\V2\EventInput
Returns
TypeDescription
$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 management methods.

Returns
TypeDescription
Google\Protobuf\Internal\RepeatedField

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 management methods.

Parameter
NameDescription
var array<Google\Cloud\Dialogflow\V2\SessionEntityType>
Returns
TypeDescription
$this