Dynamic messages

You can create a dynamic message by adding annotations that represent variables, entities, or the active intent’s value, literal or confidence score, to be inserted in the message at runtime.

Annotations that represent variables or entities of certain types (date, time, temperature, and so on) support output formatting.

In dialog designs that support the Audio Script modality, messages can also include dynamic audio file references.

Runtime behavior for dynamic messages

In message nodes, dynamic messages are evaluated before assignments. If you want to set a variable (or entity) and use the new value in a message, make the assignment in a separate node (for example a decision node), upstream to the message node where you want to use the variable or entity value.

For dynamic messages, building your dialog application generates separate parts, that are concatenated at runtime. Depending on when the Mix project was created, and on the type of environment (Nuance-hosted, or self-hosted) where it was created, the runtime concatenation behavior may or may not involve the automatic injection of spaces around the dynamic parts in Rich Text messages.

Default concatenation behavior

Self-hosted environments: This behavior requires engine pack 2.1 (or later) for Speech Suite deployments; engine pack 3.9 (or later) for self-hosted Mix deployments.

Nuance-hosted environments: This behavior applies to Mix projects created after April 13, 2022.

By default, if there are spaces before or after an annotation, in the original message resource, the same number of spaces will be present in the corresponding static part generated from the message. Conversely, if there aren’t any spaces before or after an annotation, the Dialog service will not automatically adds spaces at runtime between the message parts.

It is possible to migrate existing dialog projects, to take advantage of this change: see Disable the legacy concatenation behavior.

Legacy concatenation behavior

With the legacy behavior, the dialog service automatically adds spaces between the message parts, except where an annotation appears before a basic punctuation sign (., ?, !, ,, ;, :).

This behavior may introduce unwanted spaces—for example, if you want to include a dynamically generated URL in a message. In such cases, a workaround is to first use a variable assignment to concatenate the elements between which a space must not appear, and then use this variable for the annotation in your message. (Remember that the execution order of messages and assignments is different, between question and answer nodes and message nodes.)

Annotation colors and naming conventions

Message annotations have distinctive (text or background) colors:

Color Annotation type
Blue Variable
Sea blue Entity value
Sea blue with quotes Entity literal
Green Active intent value or confidence score
Green with quotes Active intent literal

Output formatting options

The formatting options available for variables and entities used in dynamic messages depend on the data type, message format, and current language:

Annotations that represent variables or entities of these types support output formatting:

Variable data type Entity data type Entity types (collection methods) Formatting options
Alphanumeric Alphanumeric Text, TTS, recorded audio
Amount Amount nuance_AMOUNT Text, TTS, recorded audio
Date Date DATE Text, TTS, recorded audio
Decimal nuance_DOUBLE (in existing project with entity data type not set, or in environments that have version 1.2 or earlier of the Dialog service) Text, TTS, recorded audio
Digits Digits Text, TTS, recorded audio
Distance Distance nuance_DISTANCE Text, TTS
Integer Number nuance_CARDINAL_NUMBER, nuance_DOUBLE, nuance_NUMBER Text, recorded audio
String Generic List, Regex, Rule-based, nuance_EXPIRY_DATE TTS
Temperature Temperature nuance_TEMPERATURE Text, TTS
Time Time TIME Text, TTS, recorded audio

For these data types, when you add an annotation, among various supported methods (or entity attributes), you can choose Formatted value. It is possible to customize the formatting for annotations that represent a formatted value, or to add formatting for an annotation that represents an unformatted value (see Configure output formatting for an annotation).

For entities with data type Number that use nuance_DOUBLE for the collection method, if you need formatted values with decimals in dynamic messages, store the value in an intermediate variable of type Decimal and use this variable in your messages.

Likewise, for entities with data type Generic to be collected as nuance_EXPIRY_DATE and formatted as a date (for example, as MM/yy), store the value in an intermediate variable of type Date and use this variable in your messages.

Text output formatting

Alphanumeric display

Set a pattern to show groups of characters of specified length with delimiters. The default format is 123-12-12345, that is: 3 characters, hyphen, 2 characters, hyphen, 5 characters.

Turn on Advanced, to use the advanced format editor, if desired.

  Output formatting options example for alphanumeric display  

Amount display

Parameter Description
Currency For display purposes only: choose any currency to show on the annotation. At runtime (and in preview) the currency is part of the value.
Thousands separator Turn on (default) to show the value with the applicable thousands separator; turn off to show the value without thousands separator.
  Output formatting options example for amount display  

Date display

Parameter Description
Order Choose between Month/Day/Year (default), Day/Month/Year, or Year/Month/Day.
Day of Week Choose between the long form (Monday), the short form (Mon), or choose None (default) to omit the day of the week.
Day Format Choose between the long form with leading zero (default), the short form without leading zero, or choose None to omit the day.
Month Format Choose between the long form with leading zero (default), the short form without leading zero, the long month name (July), the short month name (Jul), or choose None to omit the month.
Year Format Choose between the long form with four digits (default), the short form with two digits, or choose None to omit the year.
Delimiter Choose between -, / (default), ., a space, or no delimiter.

Use the advanced date format editor, if desired. When you switch to the advanced editor, the pattern reflects the current format—for example, MM/dd/yyyy for the default format. The pattern string must comply with the SimpleDateFormat Java class. To go back to the basic date format editor, clear the pattern string, and then turn off Advanced.

  Output formatting options example for date display  

Decimal display

Parameter Description
Decimal places Choose the number of decimal places to show (0–7). Default: 2.
Thousands separator Turn on (default) to show the value with the applicable thousands separator; turn off to show the value without thousands separator.
  Output formatting options example for decimal display  

Digits display

Set a pattern to show groups of characters of specified length with delimiters. The default format is 123-12-12345, that is: 3 characters, hyphen, 2 characters, hyphen, 5 characters.

Turn on Advanced, to use the advanced format editor, if desired.

Distance display

Parameter Description
Decimal places Choose the number of decimal places to show (0–7). Default: 2.
Thousands separator Turn on (default) to show the value with the applicable thousands separator; turn off to show the value without thousands separator.
  Output formatting options example for distance display  

Integer display

Choose whether to show the value with the applicable thousands separator (default), or to show the value without thousands separator.

Temperature display

Parameter Description
Decimal places Choose the number of decimal places to show (0–7). Default: 2.
Thousands separator Turn on (default) to show the value with the applicable thousands separator; turn off to show the value without thousands separator.
  Output formatting options example for temperature display  

Time display

Choose the hour format: 12-hour clock (default), or 24-hour clock.

Use the advanced date format editor, if desired. When you switch to the advanced editor, the pattern reflects the current format—for example, h:mm a for the default format. The pattern string must comply with the SimpleDateFormat Java class. To go back to the basic time format editor, clear the pattern string, and then turn off Advanced.

  Output formatting options example for time display  

TTS for playback

Alphanumeric TTS playback

Set a pattern to show groups of characters of specified length. The default format is 123 12 1234, that is: 3 characters, pause, 2 characters, pause, 4 characters.

Turn on Advanced, to use the advanced format editor, if desired.

Amount TTS playback

Parameter Description
Currency For display purposes only: choose any currency to show on the annotation. At runtime (and in preview) the currency is part of the value.
Play zero cents Turn on (default) to play “zero cents” (in the session language), when the number of cents (or sub-unit for the specified currency) is zero.
  Output formatting options example for amount TTS playback  

Date TTS playback

Parameter Description
Order Choose between Month/Day/Year (default), Day/Month/Year, or Year/Month/Day.
Day of week Turn on to play the day of the week (for example, “Sunday”); otherwise, turn off (default).
Day Turn on to play the day of the month (default).
Month Turn on to play the month (default).
Year Turn on to play the year (default).
  Output formatting options example for date TTS playback  

Decimal TTS playback

Parameter Description
Decimal places Choose the number of decimal places to show (0–7). Default: 2.
Play zero decimals Turn on (default) to play “point zero” (in the session language), when the value after the decimal point (or comma) is zero.
  Output formatting options example for decimal TTS playback  

Digits TTS playback

Set a pattern to show groups of characters of specified length. The default format is 123 12 1234, that is: 3 characters, pause, 2 characters, pause, 4 characters.

Turn on Advanced, to use the advanced format editor, if desired.

Distance TTS playback

Choose the number of decimal places to play (0–7). Default: 2.

  Output formatting options example for distance TTS playback  

Integer TTS playback

No TTS formatting options for integer values in TTS and Audio Script messages.

String TTS playback

Parameter Description
Before Annotation Freeform SSML tag to insert before the annotation (for example, <say-as interpret-as="phone">).
After Annotation Freeform SSML tag to insert after the annotation (for example, </say-as>).
  Output formatting options example for string TTS playback  

Temperature TTS playback

Choose the number of decimal places to play (0–7). Default: 2.

Time TTS playback

Choose the hour format: 12-hour clock (default), or 24-hour clock.

Dynamic concatenated audio for playback

VoiceXML applications can use concatenated static and dynamic audio files to play Audio Script messages, for certain languages. They can also use TTS playback.

Support for concatenated audio recordings is limited to these languages: English (Australia), English (United Kingdom), English (United States), French (Canada), German (Germany), Portuguese (Brazil), and Spanish (Latin America).

For German, dynamic concatenated audio support for grammatical cases is limited to nominative (default) and dative.

For languages without support for recorded audio playback, only TTS playback output formatting options are available. String values in Audio Script messages support TTS playback (see String TTS playback).

Alphanumeric concatenated audio playback

Set a pattern to play groups of characters of specified length. The default format is 123 12 1234, that is: 3 characters, pause, 2 characters, pause, 4 characters.

Choose the appropriate intonation, based on the position of the annotation in the message: Medial (default), or Final.

Turn on Advanced, to use the advanced format editor, if desired.

  Output formatting options example for alphanumeric audio playback  

Amount concatenated audio playback

Support is limited to one currency per language. The available currency for a language depends on the recorded audio package that was set up for that language in your Mix environment. At runtime, amounts in a currency that the package for the session language doesn’t support are played as dollars.

Parameter Description
Currency For display purposes only: choose any currency to show on the annotation. At runtime (and in preview) the currency is part of the value.
Intonation Choose the appropriate intonation, based on the position of the annotation in the message: Medial (default), or Final.
Case Available for German only: Choose the appropriate case, based on the grammatical function of the annotation in the message: Nominative (default), or Dative.
Play zero dollars Turn on (default) to play “zero dollars” (in the session language), when the number of dollars (or selected currency) is zero.
Play zero cents Turn on (default) to play “zero cents” (in the session language), when the number of cents (or sub-unit for the selected currency) is zero.
Play pre-hundred Available for English (United States) only: Turn on to use different audio recordings for hundreds prior to millions/thousands, and for hundreds prior to tens; turn off (default) to use the same audio recording for hundreds regardless of their position in amounts.
  Output formatting options example for amount audio playback  

Date concatenated audio playback

The order that the specified date parts are played at runtime is determined by the recorded audio package for the session language. Dynamic concatenated audio playback always includes the month.

Parameter Description
Day of week Turn on to play the day of the week (for example, “Sunday”); otherwise, turn off (default).
Day Turn on to play the day of the month (default).
Year Turn on to play the year (default).
Intonation Choose the appropriate intonation, based on the position of the annotation in the message: Medial (default), or Final.
Case Available for German only: Choose the appropriate case, based on the grammatical function of the annotation in the message: Nominative (default), or Dative.
  Output formatting options example for date audio playback  

Decimal concatenated audio playback

Parameter Description
Intonation Choose the appropriate intonation, based on the position of the annotation in the message: Medial (default), or Final.
Case Available for German only: Choose the appropriate case, based on the grammatical function of the annotation in the message: Nominative (default), or Dative.
Play zero units Turn on (default) to play “zero point” (in the session language), when the value before the decimal point (or comma) is zero.
Play zero decimals Turn on (default) to play “point zero” (in the session language), when the value after the decimal point (or comma) is zero.
  Output formatting options example for decimal audio playback in German message  

Digits concatenated audio playback

Set a pattern to play groups of characters of specified length. The default format is 123 12 1234, that is: 3 characters, pause, 2 characters, pause, 4 characters.

Choose the appropriate intonation, based on the position of the annotation in the message: Medial (default), or Final.

Turn on Advanced, to use the advanced format editor, if desired.

Distance concatenated audio playback

No concatenated audio playback formatting options for distances in Audio Script messages.

Integer concatenated audio playback

Choose the appropriate intonation, based on the position of the annotation in the message: Medial (default), or Final.

Temperature concatenated audio playback

No concatenated audio playback formatting options for temperatures in Audio Script messages.

Time concatenated audio playback

Parameter Description
Hour Format Choose between a 12-hour clock (default), or a 24-hour clock.
Intonation Choose the appropriate intonation, based on the position of the annotation in the message: Medial (default), or Final.
  Output formatting options example for time audio playback