xref: /aosp_15_r20/external/googleapis/google/cloud/dialogflow/v2/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.v2;
18
19import "google/cloud/dialogflow/v2/context.proto";
20import "google/cloud/dialogflow/v2/intent.proto";
21import "google/cloud/dialogflow/v2/session.proto";
22import "google/cloud/dialogflow/v2/session_entity_type.proto";
23import "google/protobuf/struct.proto";
24
25option cc_enable_arenas = true;
26option csharp_namespace = "Google.Cloud.Dialogflow.V2";
27option go_package = "cloud.google.com/go/dialogflow/apiv2/dialogflowpb;dialogflowpb";
28option java_multiple_files = true;
29option java_outer_classname = "WebhookProto";
30option java_package = "com.google.cloud.dialogflow.v2";
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  // Format: `projects/<Project ID>/agent/sessions/<Session ID>`, or
38  // `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
39  // ID>/sessions/<Session ID>`.
40  string session = 4;
41
42  // The unique identifier of the response. Contains the same value as
43  // `[Streaming]DetectIntentResponse.response_id`.
44  string response_id = 1;
45
46  // The result of the conversational query or event processing. Contains the
47  // same value as `[Streaming]DetectIntentResponse.query_result`.
48  QueryResult query_result = 2;
49
50  // Optional. The contents of the original request that was passed to
51  // `[Streaming]DetectIntent` call.
52  OriginalDetectIntentRequest original_detect_intent_request = 3;
53}
54
55// The response message for a webhook call.
56//
57// This response is validated by the Dialogflow server. If validation fails,
58// an error will be returned in the
59// [QueryResult.diagnostic_info][google.cloud.dialogflow.v2.QueryResult.diagnostic_info]
60// field. Setting JSON fields to an empty value with the wrong type is a common
61// error. To avoid this error:
62//
63// - Use `""` for empty strings
64// - Use `{}` or `null` for empty objects
65// - Use `[]` or `null` for empty arrays
66//
67// For more information, see the
68// [Protocol Buffers Language
69// Guide](https://developers.google.com/protocol-buffers/docs/proto3#json).
70message WebhookResponse {
71  // Optional. The text response message intended for the end-user.
72  // It is recommended to use `fulfillment_messages.text.text[0]` instead.
73  // When provided, Dialogflow uses this field to populate
74  // [QueryResult.fulfillment_text][google.cloud.dialogflow.v2.QueryResult.fulfillment_text]
75  // sent to the integration or API caller.
76  string fulfillment_text = 1;
77
78  // Optional. The rich response messages intended for the end-user.
79  // When provided, Dialogflow uses this field to populate
80  // [QueryResult.fulfillment_messages][google.cloud.dialogflow.v2.QueryResult.fulfillment_messages]
81  // sent to the integration or API caller.
82  repeated Intent.Message fulfillment_messages = 2;
83
84  // Optional. A custom field used to identify the webhook source.
85  // Arbitrary strings are supported.
86  // When provided, Dialogflow uses this field to populate
87  // [QueryResult.webhook_source][google.cloud.dialogflow.v2.QueryResult.webhook_source]
88  // sent to the integration or API caller.
89  string source = 3;
90
91  // Optional. This field can be used to pass custom data from your webhook to
92  // the integration or API caller. Arbitrary JSON objects are supported. When
93  // provided, Dialogflow uses this field to populate
94  // [QueryResult.webhook_payload][google.cloud.dialogflow.v2.QueryResult.webhook_payload]
95  // sent to the integration or API caller. This field is also used by the
96  // [Google Assistant
97  // integration](https://cloud.google.com/dialogflow/docs/integrations/aog)
98  // for rich response messages.
99  // See the format definition at [Google Assistant Dialogflow webhook
100  // format](https://developers.google.com/assistant/actions/build/json/dialogflow-webhook-json)
101  google.protobuf.Struct payload = 4;
102
103  // Optional. The collection of output contexts that will overwrite currently
104  // active contexts for the session and reset their lifespans.
105  // When provided, Dialogflow uses this field to populate
106  // [QueryResult.output_contexts][google.cloud.dialogflow.v2.QueryResult.output_contexts]
107  // sent to the integration or API caller.
108  repeated Context output_contexts = 5;
109
110  // Optional. Invokes the supplied events.
111  // When this field is set, Dialogflow ignores the `fulfillment_text`,
112  // `fulfillment_messages`, and `payload` fields.
113  EventInput followup_event_input = 6;
114
115  // Optional. Additional session entity types to replace or extend developer
116  // entity types with. The entity synonyms apply to all languages and persist
117  // for the session. Setting this data from a webhook overwrites
118  // the session entity types that have been set using `detectIntent`,
119  // `streamingDetectIntent` or
120  // [SessionEntityType][google.cloud.dialogflow.v2.SessionEntityType]
121  // management methods.
122  repeated SessionEntityType session_entity_types = 10;
123}
124
125// Represents the contents of the original request that was passed to
126// the `[Streaming]DetectIntent` call.
127message OriginalDetectIntentRequest {
128  // The source of this request, e.g., `google`, `facebook`, `slack`. It is set
129  // by Dialogflow-owned servers.
130  string source = 1;
131
132  // Optional. The version of the protocol used for this request.
133  // This field is AoG-specific.
134  string version = 2;
135
136  // Optional. This field is set to the value of the `QueryParameters.payload`
137  // field passed in the request. Some integrations that query a Dialogflow
138  // agent may provide additional information in the payload.
139  //
140  // In particular, for the Dialogflow Phone Gateway integration, this field has
141  // the form:
142  // <pre>{
143  //  "telephony": {
144  //    "caller_id": "+18558363987"
145  //  }
146  // }</pre>
147  // Note: The caller ID field (`caller_id`) will be redacted for Trial
148  // Edition agents and populated with the caller ID in [E.164
149  // format](https://en.wikipedia.org/wiki/E.164) for Essentials Edition agents.
150  google.protobuf.Struct payload = 3;
151}
152