webhook.proto 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. // Copyright 2021 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. syntax = "proto3";
  15. package google.cloud.dialogflow.v2beta1;
  16. import "google/cloud/dialogflow/v2beta1/context.proto";
  17. import "google/cloud/dialogflow/v2beta1/intent.proto";
  18. import "google/cloud/dialogflow/v2beta1/session.proto";
  19. import "google/cloud/dialogflow/v2beta1/session_entity_type.proto";
  20. import "google/protobuf/struct.proto";
  21. import "google/api/annotations.proto";
  22. option cc_enable_arenas = true;
  23. option csharp_namespace = "Google.Cloud.Dialogflow.V2beta1";
  24. option go_package = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1;dialogflow";
  25. option java_multiple_files = true;
  26. option java_outer_classname = "WebhookProto";
  27. option java_package = "com.google.cloud.dialogflow.v2beta1";
  28. option objc_class_prefix = "DF";
  29. // The request message for a webhook call.
  30. message WebhookRequest {
  31. // The unique identifier of detectIntent request session.
  32. // Can be used to identify end-user inside webhook implementation.
  33. // Supported formats:
  34. // - `projects/<Project ID>/agent/sessions/<Session ID>,
  35. // - `projects/<Project ID>/locations/<Location ID>/agent/sessions/<Session
  36. // ID>`,
  37. // - `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
  38. // ID>/sessions/<Session ID>`,
  39. // - `projects/<Project ID>/locations/<Location
  40. // ID>/agent/environments/<Environment ID>/users/<User ID>/sessions/<Session
  41. // ID>`,
  42. string session = 4;
  43. // The unique identifier of the response. Contains the same value as
  44. // `[Streaming]DetectIntentResponse.response_id`.
  45. string response_id = 1;
  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. // Alternative query results from KnowledgeService.
  50. repeated QueryResult alternative_query_results = 5;
  51. // Optional. The contents of the original request that was passed to
  52. // `[Streaming]DetectIntent` call.
  53. OriginalDetectIntentRequest original_detect_intent_request = 3;
  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 [QueryResult.diagnostic_info][google.cloud.dialogflow.v2beta1.QueryResult.diagnostic_info] field.
  59. // Setting JSON fields to an empty value with the wrong type is a common error.
  60. // To avoid this error:
  61. //
  62. // - Use `""` for empty strings
  63. // - Use `{}` or `null` for empty objects
  64. // - Use `[]` or `null` for empty arrays
  65. //
  66. // For more information, see the
  67. // [Protocol Buffers Language
  68. // Guide](https://developers.google.com/protocol-buffers/docs/proto3#json).
  69. message WebhookResponse {
  70. // Optional. The text response message intended for the end-user.
  71. // It is recommended to use `fulfillment_messages.text.text[0]` instead.
  72. // When provided, Dialogflow uses this field to populate
  73. // [QueryResult.fulfillment_text][google.cloud.dialogflow.v2beta1.QueryResult.fulfillment_text] sent to the integration or API caller.
  74. string fulfillment_text = 1;
  75. // Optional. The rich response messages intended for the end-user.
  76. // When provided, Dialogflow uses this field to populate
  77. // [QueryResult.fulfillment_messages][google.cloud.dialogflow.v2beta1.QueryResult.fulfillment_messages] sent to the integration or API caller.
  78. repeated Intent.Message fulfillment_messages = 2;
  79. // Optional. A custom field used to identify the webhook source.
  80. // Arbitrary strings are supported.
  81. // When provided, Dialogflow uses this field to populate
  82. // [QueryResult.webhook_source][google.cloud.dialogflow.v2beta1.QueryResult.webhook_source] sent to the integration or API caller.
  83. string source = 3;
  84. // Optional. This field can be used to pass custom data from your webhook to the
  85. // integration or API caller. Arbitrary JSON objects are supported.
  86. // When provided, Dialogflow uses this field to populate
  87. // [QueryResult.webhook_payload][google.cloud.dialogflow.v2beta1.QueryResult.webhook_payload] sent to the integration or API caller.
  88. // This field is also used by the
  89. // [Google Assistant
  90. // integration](https://cloud.google.com/dialogflow/docs/integrations/aog)
  91. // for rich response messages.
  92. // See the format definition at [Google Assistant Dialogflow webhook
  93. // format](https://developers.google.com/assistant/actions/build/json/dialogflow-webhook-json)
  94. google.protobuf.Struct payload = 4;
  95. // Optional. The collection of output contexts that will overwrite currently
  96. // active contexts for the session and reset their lifespans.
  97. // When provided, Dialogflow uses this field to populate
  98. // [QueryResult.output_contexts][google.cloud.dialogflow.v2beta1.QueryResult.output_contexts] sent to the integration or API caller.
  99. repeated Context output_contexts = 5;
  100. // Optional. Invokes the supplied events.
  101. // When this field is set, Dialogflow ignores the `fulfillment_text`,
  102. // `fulfillment_messages`, and `payload` fields.
  103. EventInput followup_event_input = 6;
  104. // Indicates that a live agent should be brought in to handle the
  105. // interaction with the user. In most cases, when you set this flag to true,
  106. // you would also want to set end_interaction to true as well. Default is
  107. // false.
  108. bool live_agent_handoff = 7;
  109. // Optional. Indicates that this intent ends an interaction. Some integrations
  110. // (e.g., Actions on Google or Dialogflow phone gateway) use this information
  111. // to close interaction with an end user. Default is false.
  112. bool end_interaction = 8;
  113. // Optional. Additional session entity types to replace or extend developer
  114. // entity types with. The entity synonyms apply to all languages and persist
  115. // for the session. Setting this data from a webhook overwrites
  116. // the session entity types that have been set using `detectIntent`,
  117. // `streamingDetectIntent` or [SessionEntityType][google.cloud.dialogflow.v2beta1.SessionEntityType] management methods.
  118. repeated SessionEntityType session_entity_types = 10;
  119. }
  120. // Represents the contents of the original request that was passed to
  121. // the `[Streaming]DetectIntent` call.
  122. message OriginalDetectIntentRequest {
  123. // The source of this request, e.g., `google`, `facebook`, `slack`. It is set
  124. // by Dialogflow-owned servers.
  125. string source = 1;
  126. // Optional. The version of the protocol used for this request.
  127. // This field is AoG-specific.
  128. string version = 2;
  129. // Optional. This field is set to the value of the `QueryParameters.payload`
  130. // field passed in the request. Some integrations that query a Dialogflow
  131. // agent may provide additional information in the payload.
  132. //
  133. // In particular, for the Dialogflow Phone Gateway integration, this field has
  134. // the form:
  135. // <pre>{
  136. // "telephony": {
  137. // "caller_id": "+18558363987"
  138. // }
  139. // }</pre>
  140. // Note: The caller ID field (`caller_id`) will be redacted for Trial
  141. // Edition agents and populated with the caller ID in [E.164
  142. // format](https://en.wikipedia.org/wiki/E.164) for Essentials Edition agents.
  143. google.protobuf.Struct payload = 3;
  144. }