webhook.proto 7.4 KB

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