...
1/**
2 * Copyright 2022 Google LLC
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17```hcl
18resource "google_dialogflow_cx_agent" "agent" {
19 display_name = "dialogflowcx-agent"
20 location = "global"
21 default_language_code = "en"
22 supported_language_codes = ["fr","de","es"]
23 time_zone = "America/New_York"
24 description = "Example description."
25 avatar_uri = "https://cloud.google.com/_static/images/cloud/icons/favicons/onecloud/super_cloud.png"
26 enable_stackdriver_logging = true
27 enable_spell_correction = true
28 speech_to_text_settings {
29 enable_speech_adaptation = true
30 }
31}
32
33
34resource "google_dialogflow_cx_page" "basic_page" {
35 parent = google_dialogflow_cx_agent.agent.start_flow
36 display_name = "MyPage"
37
38 entry_fulfillment {
39 messages {
40 text {
41 text = ["Welcome to page"]
42 }
43 }
44 }
45
46 form {
47 parameters {
48 display_name = "param1"
49 entity_type = "projects/-/locations/-/agents/-/entityTypes/sys.date"
50 fill_behavior {
51 initial_prompt_fulfillment {
52 messages {
53 text {
54 text = ["Please provide param1"]
55 }
56 }
57 }
58 }
59 required = "true"
60 redact = "true"
61 }
62 }
63
64 transition_routes {
65 condition = "$page.params.status = 'FINAL'"
66 trigger_fulfillment {
67 messages {
68 text {
69 text = ["information completed, navigating to page 2"]
70 }
71 }
72 }
73 target_page = google_dialogflow_cx_page.my_page2.id
74 }
75}
76
77resource "google_dialogflow_cx_page" "my_page2" {
78 parent = google_dialogflow_cx_agent.agent.start_flow
79 display_name = "MyPage2"
80}
81```
View as plain text