Skip to content

googleDialogflowCxPage

A Dialogflow CX conversation (session) can be described and visualized as a state machine. The states of a CX session are represented by pages.

To get more information about Page, see:

Example Usage - Dialogflowcx Page Full

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleDialogflowCxAgentAgent =
  new google.dialogflowCxAgent.DialogflowCxAgent(this, "agent", {
    avatar_uri:
      "https://cloud.google.com/_static/images/cloud/icons/favicons/onecloud/super_cloud.png",
    default_language_code: "en",
    description: "Example description.",
    display_name: "dialogflowcx-agent",
    enable_spell_correction: true,
    enable_stackdriver_logging: true,
    location: "global",
    speech_to_text_settings: [
      {
        enable_speech_adaptation: true,
      },
    ],
    supported_language_codes: ["fr", "de", "es"],
    time_zone: "America/New_York",
  });
const googleDialogflowCxPageMyPage2 =
  new google.dialogflowCxPage.DialogflowCxPage(this, "my_page2", {
    display_name: "MyPage2",
    parent: googleDialogflowCxAgentAgent.startFlow,
  });
new google.dialogflowCxPage.DialogflowCxPage(this, "basic_page", {
  display_name: "MyPage",
  entry_fulfillment: [
    {
      messages: [
        {
          text: [
            {
              text: ["Welcome to page"],
            },
          ],
        },
      ],
    },
  ],
  form: [
    {
      parameters: [
        {
          display_name: "param1",
          entity_type: "projects/-/locations/-/agents/-/entityTypes/sys.date",
          fill_behavior: [
            {
              initial_prompt_fulfillment: [
                {
                  messages: [
                    {
                      text: [
                        {
                          text: ["Please provide param1"],
                        },
                      ],
                    },
                  ],
                },
              ],
            },
          ],
          redact: "true",
          required: "true",
        },
      ],
    },
  ],
  parent: googleDialogflowCxAgentAgent.startFlow,
  transition_routes: [
    {
      condition: "$page.params.status = 'FINAL'",
      target_page: googleDialogflowCxPageMyPage2.id,
      trigger_fulfillment: [
        {
          messages: [
            {
              text: [
                {
                  text: ["information completed, navigating to page 2"],
                },
              ],
            },
          ],
        },
      ],
    },
  ],
});

Argument Reference

The following arguments are supported:

  • displayName - (Required) The human-readable name of the page, unique within the agent.

  • entryFulfillment - (Optional) The fulfillment to call when the session is entering the page. Structure is documented below.

  • form - (Optional) The form associated with the page, used for collecting parameters relevant to the page. Structure is documented below.

  • transitionRouteGroups - (Optional) Ordered list of TransitionRouteGroups associated with the page. Transition route groups must be unique within a page. If multiple transition routes within a page scope refer to the same intent, then the precedence order is: page's transition route -> page's transition route group -> flow's transition routes. If multiple transition route groups within a page contain the same intent, then the first group in the ordered list takes precedence. Format:projects//locations//agents//flows//transitionRouteGroups/.

  • transitionRoutes - (Optional) A list of transitions for the transition rules of this page. They route the conversation to another page in the same flow, or another flow. When we are in a certain page, the TransitionRoutes are evalauted in the following order: TransitionRoutes defined in the page with intent specified. TransitionRoutes defined in the transition route groups with intent specified. TransitionRoutes defined in flow with intent specified. TransitionRoutes defined in the transition route groups with intent specified. TransitionRoutes defined in the page with only condition specified. TransitionRoutes defined in the transition route groups with only condition specified. Structure is documented below.

  • eventHandlers - (Optional) Handlers associated with the page to handle events such as webhook errors, no match or no input. Structure is documented below.

  • parent - (Optional) The flow to create a page for. Format: projects//locations//agents//flows/.

  • languageCode - (Optional) The language of the following fields in page: Page.entry_fulfillment.messages Page.entry_fulfillment.conditional_cases Page.event_handlers.trigger_fulfillment.messages Page.event_handlers.trigger_fulfillment.conditional_cases Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases Page.form.parameters.fill_behavior.reprompt_event_handlers.messages Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases Page.transition_routes.trigger_fulfillment.messages Page.transition_routes.trigger_fulfillment.conditional_cases If not specified, the agent's default language is used. Many languages are supported. Note: languages must be enabled in the agent before they can be used.

The entryFulfillment block supports:

  • messages - (Optional) The list of rich message responses to present to the user. Structure is documented below.

  • webhook - (Optional) The webhook to call. Format: projects//locations//agents//webhooks/.

  • returnPartialResponses - (Optional) Whether Dialogflow should return currently queued fulfillment response messages in streaming APIs. If a webhook is specified, it happens before Dialogflow invokes webhook. Warning: 1) This flag only affects streaming API. Responses are still queued and returned once in non-streaming API. 2) The flag can be enabled in any fulfillment but only the first 3 partial responses will be returned. You may only want to apply it to fulfillments that have slow webhooks.

  • tag - (Optional) The tag used by the webhook to identify which fulfillment is being called. This field is required if webhook is specified.

The messages block supports:

The text block supports:

  • text - (Optional) A collection of text responses.

  • allowPlaybackInterruption - (Output) Whether the playback of this message can be interrupted by the end user's speech and the client can then starts the next Dialogflow request.

The form block supports:

  • parameters - (Optional) Parameters to collect from the user. Structure is documented below.

The parameters block supports:

  • displayName - (Optional) The human-readable name of the parameter, unique within the form.

  • required - (Optional) Indicates whether the parameter is required. Optional parameters will not trigger prompts; however, they are filled if the user specifies them. Required parameters must be filled before form filling concludes.

  • entityType - (Optional) The entity type of the parameter. Format: projects/-/locations/-/agents/-/entityTypes/ for system entity types (for example, projects/-/locations/-/agents/-/entityTypes/sys.date), or projects//locations//agents//entityTypes/ for developer entity types.

  • isList - (Optional) Indicates whether the parameter represents a list of values.

  • fillBehavior - (Optional) Defines fill behavior for the parameter. Structure is documented below.

  • redact - (Optional) Indicates whether the parameter content should be redacted in log. If redaction is enabled, the parameter content will be replaced by parameter name during logging. Note: the parameter content is subject to redaction if either parameter level redaction or entity type level redaction is enabled.

The fillBehavior block supports:

  • initialPromptFulfillment - (Optional) The fulfillment to provide the initial prompt that the agent can present to the user in order to fill the parameter. Structure is documented below.

The initialPromptFulfillment block supports:

  • messages - (Optional) The list of rich message responses to present to the user. Structure is documented below.

  • webhook - (Optional) The webhook to call. Format: projects//locations//agents//webhooks/.

  • returnPartialResponses - (Optional) Whether Dialogflow should return currently queued fulfillment response messages in streaming APIs. If a webhook is specified, it happens before Dialogflow invokes webhook. Warning: 1) This flag only affects streaming API. Responses are still queued and returned once in non-streaming API. 2) The flag can be enabled in any fulfillment but only the first 3 partial responses will be returned. You may only want to apply it to fulfillments that have slow webhooks.

  • tag - (Optional) The tag used by the webhook to identify which fulfillment is being called. This field is required if webhook is specified.

The messages block supports:

The text block supports:

  • text - (Optional) A collection of text responses.

  • allowPlaybackInterruption - (Output) Whether the playback of this message can be interrupted by the end user's speech and the client can then starts the next Dialogflow request.

The transitionRoutes block supports:

  • name - (Output) The unique identifier of this transition route.

  • intent - (Optional) The unique identifier of an Intent. Format: projects//locations//agents//intents/. Indicates that the transition can only happen when the given intent is matched. At least one of intent or condition must be specified. When both intent and condition are specified, the transition can only happen when both are fulfilled.

  • condition - (Optional) The condition to evaluate against form parameters or session parameters. At least one of intent or condition must be specified. When both intent and condition are specified, the transition can only happen when both are fulfilled.

  • triggerFulfillment - (Optional) The fulfillment to call when the event occurs. Handling webhook errors with a fulfillment enabled with webhook could cause infinite loop. It is invalid to specify such fulfillment for a handler handling webhooks. Structure is documented below.

  • targetPage - (Optional) The target page to transition to. Format: projects//locations//agents//flows//pages/.

  • targetFlow - (Optional) The target flow to transition to. Format: projects//locations//agents//flows/.

The triggerFulfillment block supports:

  • messages - (Optional) The list of rich message responses to present to the user. Structure is documented below.

  • webhook - (Optional) The webhook to call. Format: projects//locations//agents//webhooks/.

  • returnPartialResponses - (Optional) Whether Dialogflow should return currently queued fulfillment response messages in streaming APIs. If a webhook is specified, it happens before Dialogflow invokes webhook. Warning: 1) This flag only affects streaming API. Responses are still queued and returned once in non-streaming API. 2) The flag can be enabled in any fulfillment but only the first 3 partial responses will be returned. You may only want to apply it to fulfillments that have slow webhooks.

  • tag - (Optional) The tag used by the webhook to identify which fulfillment is being called. This field is required if webhook is specified.

The messages block supports:

The text block supports:

  • text - (Optional) A collection of text responses.

  • allowPlaybackInterruption - (Output) Whether the playback of this message can be interrupted by the end user's speech and the client can then starts the next Dialogflow request.

The eventHandlers block supports:

  • name - (Output) The unique identifier of this event handler.

  • event - (Optional) The name of the event to handle.

  • triggerFulfillment - (Optional) The fulfillment to call when the event occurs. Handling webhook errors with a fulfillment enabled with webhook could cause infinite loop. It is invalid to specify such fulfillment for a handler handling webhooks. Structure is documented below.

  • targetPage - (Optional) The target page to transition to. Format: projects//locations//agents//flows//pages/.

  • targetFlow - (Optional) The target flow to transition to. Format: projects//locations//agents//flows/.

The triggerFulfillment block supports:

  • messages - (Optional) The list of rich message responses to present to the user. Structure is documented below.

  • webhook - (Optional) The webhook to call. Format: projects//locations//agents//webhooks/.

  • returnPartialResponses - (Optional) Whether Dialogflow should return currently queued fulfillment response messages in streaming APIs. If a webhook is specified, it happens before Dialogflow invokes webhook. Warning: 1) This flag only affects streaming API. Responses are still queued and returned once in non-streaming API. 2) The flag can be enabled in any fulfillment but only the first 3 partial responses will be returned. You may only want to apply it to fulfillments that have slow webhooks.

  • tag - (Optional) The tag used by the webhook to identify which fulfillment is being called. This field is required if webhook is specified.

The messages block supports:

The text block supports:

  • text - (Optional) A collection of text responses.

  • allowPlaybackInterruption - (Output) Whether the playback of this message can be interrupted by the end user's speech and the client can then starts the next Dialogflow request.

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format {{parent}}/pages/{{name}}

  • name - The unique identifier of the page. Format: projects//locations//agents//flows//pages/.

Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 40 minutes.
  • update - Default is 40 minutes.
  • delete - Default is 20 minutes.

Import

Page can be imported using any of these accepted formats:

$ terraform import google_dialogflow_cx_page.default {{parent}}/pages/{{name}}
$ terraform import google_dialogflow_cx_page.default {{parent}}/{{name}}