Compartir vía


Conversational Elements

From sending prompt messages to getting answers from the user to specific questions, interaction with end users is a mandatory functionality in any chat bot conversation. The healthcare agent service provides a simple interface to allow communication with the user in scenarios and data flows.

A screenshot of the conversational elements

Prompt

Prompts are used to create two way interactions with user. An author should configure the displayed message such that it guides the user and helps to provide the expected value.

"a screenshot of a prompt"

  • Display Text: (Optional) The text presented to the user, prompting value entry. Provide plain text, a string literal or a valid JavaScript expression that evaluates to a string.
  • Input variable: (Required) The name of the conversation variable that will store the user's response.
  • Input Type: (Required) The variable type for storing the user response(for example, Number, String, Boolean, Date, Time, Object or a Choice).
  • Suggestions: (Optional) provide suggestions to the user.
  • Is Active: (Optional) A valid Boolean expression that determines whether the step is executed during runtime or not.
  • Maximum number of retries: (Optional) In cases the user response isn't compatible with the data type, the bot will repeat the prompt until the user input is valid. You can limit the number of attempts or leave this field empty for unlimited retries.
  • Message metadata: (Optional) Use this field if you want to send metadata to channels such as metadata to process in the background

Prompt choice Input Type

Selecting an option from a predefined list in many cases is preferable to forcing the user to enter plain text. For this purpose, we recommend using the Prompt element and select the choice data type, as shown below:

"a screenshot of the prompt input types"

When selecting Choice or Multi-Choice two new fields are revealed: Choice Array and Show Choices as. These can contain valid JavaScript string array literal (for example, ["Red", "Blue", "Green"]), or alternatively can be linked to a variable set to a string array.

"a screenshot of the prompt choices"

There are several display options for the choice list. One should carefully select the most suitable option considering the target conversation channel. For example, buttons won't appear in an SMS channel. You may select auto and let the chealthcare agent service instance decide the best option based on the channel and device.

While responding to the prompt, the user may choose to either type the option index, or the text on the button label. When the user selects a choice, the text is sent to the healthcare agent service instance as the answer. In case the user response is not aligned with the different options, the prompt will be presented again. The result of the prompt will be available once the selection has been made and will be assigned to the variable defined for this prompt by the author.

Note: The value returned from the choice prompt isn't a plain string or number but rather it's an object containing the following components:

  • score: The probability the choice was identified (0-1) (for example, the user provided a textual answer, which is almost identical to one of the options but not exactly, the score may be less than 1.
  • index: Index of the selection made -- zero based
  • entity: The context of the array item selected. For example, "Blue" if the "Blue" option is selected.

Yes No Prompt

The Yes/No prompt is essentially a Boolean prompt combined with a decision step. It allows the author to ask boolean questions and branch according to the answer.

Notice the resemblance to the prompt configuration pane, including the Display Text and Variable name

"a screenshot of the yes no dialog element"

The component is visualized in the scenario editor as a branch.

"a screenshot of the yes no dialog element in the scenario editor"

Now you can connect the yes/no nodes to other steps in your flow.

Statement

Statements are used to display and send messages to the user without requiring any feedback or interaction from the user.

Notice that the configuration pane is simple. Both the Display Text and the Is Active field can contain static values and refer to valid JavaScript expressions that include variable data.

"a screenshot of a statement dialog element"

Next steps

Authoring custom scenarios