| --- |
| # ---------------------------------------------------------------------------- |
| # |
| # *** AUTO GENERATED CODE *** Type: MMv1 *** |
| # |
| # ---------------------------------------------------------------------------- |
| # |
| # This file is automatically generated by Magic Modules and manual |
| # changes will be clobbered when the file is regenerated. |
| # |
| # Please read more about how to change this file in |
| # .github/CONTRIBUTING.md. |
| # |
| # ---------------------------------------------------------------------------- |
| subcategory: "Dialogflow CX" |
| description: |- |
| Webhooks host the developer's business logic. |
| --- |
| |
| # google_dialogflow_cx_webhook |
| |
| Webhooks host the developer's business logic. During a session, webhooks allow the developer to use the data extracted by Dialogflow's natural language processing to generate dynamic responses, validate collected data, or trigger actions on the backend. |
| |
| |
| To get more information about Webhook, see: |
| |
| * [API documentation](https://cloud.google.com/dialogflow/cx/docs/reference/rest/v3/projects.locations.agents.webhooks) |
| * How-to Guides |
| * [Official Documentation](https://cloud.google.com/dialogflow/cx/docs) |
| |
| <div class = "oics-button" style="float: right; margin: 0 0 -15px"> |
| <a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=dialogflowcx_webhook_full&open_in_editor=main.tf" target="_blank"> |
| <img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> |
| </a> |
| </div> |
| ## Example Usage - Dialogflowcx Webhook Full |
| |
| |
| ```hcl |
| resource "google_dialogflow_cx_agent" "agent" { |
| display_name = "dialogflowcx-agent" |
| location = "global" |
| default_language_code = "en" |
| supported_language_codes = ["it","de","es"] |
| time_zone = "America/New_York" |
| description = "Example description." |
| avatar_uri = "https://cloud.google.com/_static/images/cloud/icons/favicons/onecloud/super_cloud.png" |
| enable_stackdriver_logging = true |
| enable_spell_correction = true |
| speech_to_text_settings { |
| enable_speech_adaptation = true |
| } |
| } |
| |
| |
| resource "google_dialogflow_cx_webhook" "basic_webhook" { |
| parent = google_dialogflow_cx_agent.agent.id |
| display_name = "MyFlow" |
| generic_web_service { |
| uri = "https://example.com" |
| } |
| } |
| ``` |
| |
| ## Argument Reference |
| |
| The following arguments are supported: |
| |
| |
| * `display_name` - |
| (Required) |
| The human-readable name of the webhook, unique within the agent. |
| |
| |
| - - - |
| |
| |
| * `timeout` - |
| (Optional) |
| Webhook execution timeout. |
| |
| * `disabled` - |
| (Optional) |
| Indicates whether the webhook is disabled. |
| |
| * `generic_web_service` - |
| (Optional) |
| Configuration for a generic web service. |
| Structure is [documented below](#nested_generic_web_service). |
| |
| * `service_directory` - |
| (Optional) |
| Configuration for a Service Directory service. |
| Structure is [documented below](#nested_service_directory). |
| |
| * `security_settings` - |
| (Optional) |
| Name of the SecuritySettings reference for the agent. Format: projects/<Project ID>/locations/<Location ID>/securitySettings/<Security Settings ID>. |
| |
| * `enable_stackdriver_logging` - |
| (Optional) |
| Determines whether this agent should log conversation queries. |
| |
| * `enable_spell_correction` - |
| (Optional) |
| Indicates if automatic spell correction is enabled in detect intent requests. |
| |
| * `parent` - |
| (Optional) |
| The agent to create a webhook for. |
| Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>. |
| |
| |
| <a name="nested_generic_web_service"></a>The `generic_web_service` block supports: |
| |
| * `uri` - |
| (Required) |
| Whether to use speech adaptation for speech recognition. |
| |
| * `request_headers` - |
| (Optional) |
| The HTTP request headers to send together with webhook requests. |
| |
| * `allowed_ca_certs` - |
| (Optional) |
| Specifies a list of allowed custom CA certificates (in DER format) for HTTPS verification. |
| |
| <a name="nested_service_directory"></a>The `service_directory` block supports: |
| |
| * `service` - |
| (Required) |
| The name of Service Directory service. |
| |
| * `generic_web_service` - |
| (Required) |
| The name of Service Directory service. |
| Structure is [documented below](#nested_generic_web_service). |
| |
| |
| <a name="nested_generic_web_service"></a>The `generic_web_service` block supports: |
| |
| * `uri` - |
| (Required) |
| Whether to use speech adaptation for speech recognition. |
| |
| * `request_headers` - |
| (Optional) |
| The HTTP request headers to send together with webhook requests. |
| |
| * `allowed_ca_certs` - |
| (Optional) |
| Specifies a list of allowed custom CA certificates (in DER format) for HTTPS verification. |
| |
| ## Attributes Reference |
| |
| In addition to the arguments listed above, the following computed attributes are exported: |
| |
| * `id` - an identifier for the resource with format `{{parent}}/webhooks/{{name}}` |
| |
| * `name` - |
| The unique identifier of the webhook. |
| Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/webhooks/<Webhook ID>. |
| |
| * `start_flow` - |
| Name of the start flow in this agent. A start flow will be automatically created when the agent is created, and can only be deleted by deleting the agent. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/flows/<Flow ID>. |
| |
| |
| ## Timeouts |
| |
| This resource provides the following |
| [Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options: |
| |
| - `create` - Default is 40 minutes. |
| - `update` - Default is 40 minutes. |
| - `delete` - Default is 20 minutes. |
| |
| ## Import |
| |
| |
| Webhook can be imported using any of these accepted formats: |
| |
| * `{{parent}}/webhooks/{{name}}` |
| * `{{parent}}/{{name}}` |
| |
| |
| In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Webhook using one of the formats above. For example: |
| |
| ```tf |
| import { |
| id = "{{parent}}/webhooks/{{name}}" |
| to = google_dialogflow_cx_webhook.default |
| } |
| ``` |
| |
| When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), Webhook can be imported using one of the formats above. For example: |
| |
| ``` |
| $ terraform import google_dialogflow_cx_webhook.default {{parent}}/webhooks/{{name}} |
| $ terraform import google_dialogflow_cx_webhook.default {{parent}}/{{name}} |
| ``` |