webhook.proto 6.5 KB

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