#[non_exhaustive]pub struct WebhookResponse {
pub fulfillment_text: String,
pub fulfillment_messages: Vec<Message>,
pub source: String,
pub payload: Option<Struct>,
pub output_contexts: Vec<Context>,
pub followup_event_input: Option<EventInput>,
pub session_entity_types: Vec<SessionEntityType>,
/* private fields */
}agents and answer-records and contexts and conversation-datasets and conversation-models and conversation-profiles and conversations and documents and encryption-spec-service and entity-types and environments and fulfillments and generator-evaluations and generators and intents and knowledge-bases and participants and session-entity-types and sessions and sip-trunks and tools and versions only.Expand description
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
{}ornullfor empty objects - Use
[]ornullfor empty arrays
For more information, see the Protocol Buffers Language Guide.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.fulfillment_text: StringOptional. 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: Vec<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: StringOptional. 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: Option<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: Vec<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: Option<EventInput>Optional. Invokes the supplied events.
When this field is set, Dialogflow ignores the fulfillment_text,
fulfillment_messages, and payload fields.
session_entity_types: Vec<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.
Implementations§
Source§impl WebhookResponse
impl WebhookResponse
pub fn new() -> Self
Sourcepub fn set_fulfillment_text<T: Into<String>>(self, v: T) -> Self
pub fn set_fulfillment_text<T: Into<String>>(self, v: T) -> Self
Sets the value of fulfillment_text.
§Example
let x = WebhookResponse::new().set_fulfillment_text("example");Sourcepub fn set_fulfillment_messages<T, V>(self, v: T) -> Self
pub fn set_fulfillment_messages<T, V>(self, v: T) -> Self
Sets the value of fulfillment_messages.
§Example
use google_cloud_dialogflow_v2::model::intent::Message;
let x = WebhookResponse::new()
.set_fulfillment_messages([
Message::default()/* use setters */,
Message::default()/* use (different) setters */,
]);Sourcepub fn set_source<T: Into<String>>(self, v: T) -> Self
pub fn set_source<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_payload<T>(self, v: T) -> Self
pub fn set_payload<T>(self, v: T) -> Self
Sourcepub fn set_or_clear_payload<T>(self, v: Option<T>) -> Self
pub fn set_or_clear_payload<T>(self, v: Option<T>) -> Self
Sourcepub fn set_output_contexts<T, V>(self, v: T) -> Self
pub fn set_output_contexts<T, V>(self, v: T) -> Self
Sets the value of output_contexts.
§Example
use google_cloud_dialogflow_v2::model::Context;
let x = WebhookResponse::new()
.set_output_contexts([
Context::default()/* use setters */,
Context::default()/* use (different) setters */,
]);Sourcepub fn set_followup_event_input<T>(self, v: T) -> Selfwhere
T: Into<EventInput>,
pub fn set_followup_event_input<T>(self, v: T) -> Selfwhere
T: Into<EventInput>,
Sets the value of followup_event_input.
§Example
use google_cloud_dialogflow_v2::model::EventInput;
let x = WebhookResponse::new().set_followup_event_input(EventInput::default()/* use setters */);Sourcepub fn set_or_clear_followup_event_input<T>(self, v: Option<T>) -> Selfwhere
T: Into<EventInput>,
pub fn set_or_clear_followup_event_input<T>(self, v: Option<T>) -> Selfwhere
T: Into<EventInput>,
Sets or clears the value of followup_event_input.
§Example
use google_cloud_dialogflow_v2::model::EventInput;
let x = WebhookResponse::new().set_or_clear_followup_event_input(Some(EventInput::default()/* use setters */));
let x = WebhookResponse::new().set_or_clear_followup_event_input(None::<EventInput>);Sourcepub fn set_session_entity_types<T, V>(self, v: T) -> Self
pub fn set_session_entity_types<T, V>(self, v: T) -> Self
Sets the value of session_entity_types.
§Example
use google_cloud_dialogflow_v2::model::SessionEntityType;
let x = WebhookResponse::new()
.set_session_entity_types([
SessionEntityType::default()/* use setters */,
SessionEntityType::default()/* use (different) setters */,
]);Trait Implementations§
Source§impl Clone for WebhookResponse
impl Clone for WebhookResponse
Source§fn clone(&self) -> WebhookResponse
fn clone(&self) -> WebhookResponse
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more