xref: /aosp_15_r20/external/googleapis/google/cloud/dialogflow/v2beta1/webhook.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.cloud.dialogflow.v2beta1;
18
19import "google/cloud/dialogflow/v2beta1/context.proto";
20import "google/cloud/dialogflow/v2beta1/intent.proto";
21import "google/cloud/dialogflow/v2beta1/session.proto";
22import "google/cloud/dialogflow/v2beta1/session_entity_type.proto";
23import "google/protobuf/struct.proto";
24
25option cc_enable_arenas = true;
26option csharp_namespace = "Google.Cloud.Dialogflow.V2Beta1";
27option go_package = "cloud.google.com/go/dialogflow/apiv2beta1/dialogflowpb;dialogflowpb";
28option java_multiple_files = true;
29option java_outer_classname = "WebhookProto";
30option java_package = "com.google.cloud.dialogflow.v2beta1";
31option objc_class_prefix = "DF";
32
33// The request message for a webhook call.
34message WebhookRequest {
35  // The unique identifier of detectIntent request session.
36  // Can be used to identify end-user inside webhook implementation.
37  // Supported formats:
38  // - `projects/<Project ID>/agent/sessions/<Session ID>,
39  // - `projects/<Project ID>/locations/<Location ID>/agent/sessions/<Session
40  //   ID>`,
41  // - `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
42  //   ID>/sessions/<Session ID>`,
43  // - `projects/<Project ID>/locations/<Location
44  //   ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session
45  //   ID>`,
46  string session = 4;
47
48  // The unique identifier of the response. Contains the same value as
49  // `[Streaming]DetectIntentResponse.response_id`.
50  string response_id = 1;
51
52  // The result of the conversational query or event processing. Contains the
53  // same value as `[Streaming]DetectIntentResponse.query_result`.
54  QueryResult query_result = 2;
55
56  // Alternative query results from KnowledgeService.
57  repeated QueryResult alternative_query_results = 5;
58
59  // Optional. The contents of the original request that was passed to
60  // `[Streaming]DetectIntent` call.
61  OriginalDetectIntentRequest original_detect_intent_request = 3;
62}
63
64// The response message for a webhook call.
65//
66// This response is validated by the Dialogflow server. If validation fails,
67// an error will be returned in the
68// [QueryResult.diagnostic_info][google.cloud.dialogflow.v2beta1.QueryResult.diagnostic_info]
69// field. Setting JSON fields to an empty value with the wrong type is a common
70// error. To avoid this error:
71//
72// - Use `""` for empty strings
73// - Use `{}` or `null` for empty objects
74// - Use `[]` or `null` for empty arrays
75//
76// For more information, see the
77// [Protocol Buffers Language
78// Guide](https://developers.google.com/protocol-buffers/docs/proto3#json).
79message WebhookResponse {
80  // Optional. The text response message intended for the end-user.
81  // It is recommended to use `fulfillment_messages.text.text[0]` instead.
82  // When provided, Dialogflow uses this field to populate
83  // [QueryResult.fulfillment_text][google.cloud.dialogflow.v2beta1.QueryResult.fulfillment_text]
84  // sent to the integration or API caller.
85  string fulfillment_text = 1;
86
87  // Optional. The rich response messages intended for the end-user.
88  // When provided, Dialogflow uses this field to populate
89  // [QueryResult.fulfillment_messages][google.cloud.dialogflow.v2beta1.QueryResult.fulfillment_messages]
90  // sent to the integration or API caller.
91  repeated Intent.Message fulfillment_messages = 2;
92
93  // Optional. A custom field used to identify the webhook source.
94  // Arbitrary strings are supported.
95  // When provided, Dialogflow uses this field to populate
96  // [QueryResult.webhook_source][google.cloud.dialogflow.v2beta1.QueryResult.webhook_source]
97  // sent to the integration or API caller.
98  string source = 3;
99
100  // Optional. This field can be used to pass custom data from your webhook to
101  // the integration or API caller. Arbitrary JSON objects are supported. When
102  // provided, Dialogflow uses this field to populate
103  // [QueryResult.webhook_payload][google.cloud.dialogflow.v2beta1.QueryResult.webhook_payload]
104  // sent to the integration or API caller. This field is also used by the
105  // [Google Assistant
106  // integration](https://cloud.google.com/dialogflow/docs/integrations/aog)
107  // for rich response messages.
108  // See the format definition at [Google Assistant Dialogflow webhook
109  // format](https://developers.google.com/assistant/actions/build/json/dialogflow-webhook-json)
110  google.protobuf.Struct payload = 4;
111
112  // Optional. The collection of output contexts that will overwrite currently
113  // active contexts for the session and reset their lifespans.
114  // When provided, Dialogflow uses this field to populate
115  // [QueryResult.output_contexts][google.cloud.dialogflow.v2beta1.QueryResult.output_contexts]
116  // sent to the integration or API caller.
117  repeated Context output_contexts = 5;
118
119  // Optional. Invokes the supplied events.
120  // When this field is set, Dialogflow ignores the `fulfillment_text`,
121  // `fulfillment_messages`, and `payload` fields.
122  EventInput followup_event_input = 6;
123
124  // Indicates that a live agent should be brought in to handle the
125  // interaction with the user. In most cases, when you set this flag to true,
126  // you would also want to set end_interaction to true as well. Default is
127  // false.
128  bool live_agent_handoff = 7;
129
130  // Optional. Indicates that this intent ends an interaction. Some integrations
131  // (e.g., Actions on Google or Dialogflow phone gateway) use this information
132  // to close interaction with an end user. Default is false.
133  bool end_interaction = 8;
134
135  // Optional. Additional session entity types to replace or extend developer
136  // entity types with. The entity synonyms apply to all languages and persist
137  // for the session. Setting this data from a webhook overwrites
138  // the session entity types that have been set using `detectIntent`,
139  // `streamingDetectIntent` or
140  // [SessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityType]
141  // management methods.
142  repeated SessionEntityType session_entity_types = 10;
143}
144
145// Represents the contents of the original request that was passed to
146// the `[Streaming]DetectIntent` call.
147message OriginalDetectIntentRequest {
148  // The source of this request, e.g., `google`, `facebook`, `slack`. It is set
149  // by Dialogflow-owned servers.
150  string source = 1;
151
152  // Optional. The version of the protocol used for this request.
153  // This field is AoG-specific.
154  string version = 2;
155
156  // Optional. This field is set to the value of the `QueryParameters.payload`
157  // field passed in the request. Some integrations that query a Dialogflow
158  // agent may provide additional information in the payload.
159  //
160  // In particular, for the Dialogflow Phone Gateway integration, this field has
161  // the form:
162  // <pre>{
163  //  "telephony": {
164  //    "caller_id": "+18558363987"
165  //  }
166  // }</pre>
167  // Note: The caller ID field (`caller_id`) will be redacted for Trial
168  // Edition agents and populated with the caller ID in [E.164
169  // format](https://en.wikipedia.org/wiki/E.164) for Essentials Edition agents.
170  google.protobuf.Struct payload = 3;
171}
172