webhook.proto 6.5 KB

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