Google Cloud Dialogflow V2 Client - Class WebhookResponse (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 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

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.

Generated from protobuf field string fulfillment_text = 1;

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.

Generated from protobuf field string fulfillment_text = 1;

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.

Generated from protobuf field repeated .google.cloud.dialogflow.v2.Intent.Message fulfillment_messages = 2;

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.

Generated from protobuf field repeated .google.cloud.dialogflow.v2.Intent.Message fulfillment_messages = 2;

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.

Generated from protobuf field string source = 3;

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.

Generated from protobuf field string source = 3;

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

Generated from protobuf field .google.protobuf.Struct payload = 4;

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

Generated from protobuf field .google.protobuf.Struct payload = 4;

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.

Generated from protobuf field repeated .google.cloud.dialogflow.v2.Context output_contexts = 5;

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.

Generated from protobuf field repeated .google.cloud.dialogflow.v2.Context output_contexts = 5;

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.

Generated from protobuf field .google.cloud.dialogflow.v2.EventInput followup_event_input = 6;

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.

Generated from protobuf field .google.cloud.dialogflow.v2.EventInput followup_event_input = 6;

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.

Generated from protobuf field repeated .google.cloud.dialogflow.v2.SessionEntityType session_entity_types = 10;

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.

Generated from protobuf field repeated .google.cloud.dialogflow.v2.SessionEntityType session_entity_types = 10;

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