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:
- Use
""
for empty strings - Use
}
ornull
for empty objects - Use
[]
ornull
for empty arrays For more information, see the Protocol Buffers Language Guide.
Generated from protobuf message google.cloud.dialogflow.v2.WebhookResponse
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 |
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 |
↳ 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 |
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 | |
---|---|
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
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 sent to the integration or API caller.
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
var |
array<Google\Cloud\Dialogflow\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 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 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 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 | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
var |
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 sent to the integration or API caller.
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
var |
array<Google\Cloud\Dialogflow\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 |
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 | |
---|---|
Name | Description |
var |
Google\Cloud\Dialogflow\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
management methods.
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
var |
array<Google\Cloud\Dialogflow\V2\SessionEntityType>
|
Returns | |
---|---|
Type | Description |
$this |