Formatting messages
This topic lists supported formatting possibilities for messages, by communication channel. It also describes how to extend hyperlinks to set reporting variables and other data.
Message structure and formatting
Mix.dialog allows you to use messages (with embedded markup for formatting) to define the system output, and interactive elements to offer a set of selectable items for the end user to choose from. When you enter a message for the Rich Text modality, Mix.dialog accepts any type of markup. However, the actual messaging channel might not (refer to the table below for details). Other types of formatting require a dedicated approach, either via rich media widgets or via NDEP script commands.
In general, even when developing for the Web channel, the recommended practice is to limit HTML usage to hyperlinks. For messages that require line breaks, use Shift+Enter (or Shift+Return), as described in the Mix.dialog documentation. Alternatively, you can type the message text in any text editor, and then copy and paste it into the message editor of Mix.dialog. This will preserve at least the text layout, should you decide to use the same messages across multiple channels.
Notes:
- All standard channels support plain text messages.
- Apple Messages for Business, Facebook Messenger, Google Business Messenger, and WhatsApp support channel-specific embedded markup for rich text formatting (such as italic, bold, links).
- Desktop and mobile applications don’t support HTML. However, some messaging channels can use Nuance’s rich media format, or their own native format for structured messages.
- Web apps for the legacy chat interface (via the Web channel) can support HTML images and video but not Nuance rich media.
- CEAPI apps (designed for the App channel) can accept any formatting, but this requires configuration on the app side.
This table summarizes message formatting support by integration channel.
Channel | Rich text | HTML formatting | HTML images / video | Native structured messages | Nuance rich media |
---|---|---|---|---|---|
Web | No | Yes | No | N/A | Yes |
App | No | No | No | N/A | Yes |
SMS | No | No | No | No | No |
ABC | Yes | No | No | Yes | No |
FB Messenger | Yes | No | No | Yes | No |
GBM | Yes | No | No | Yes | Yes |
Yes | No | No | Yes | Yes | |
No | No | No | No | No | |
Viber | No | No | No | Yes | Yes |
Telegram | No | No | No | Yes | Yes |
Line | No | No | No | Yes | Yes |
No | No | No | Yes | Yes |
Message sequences
In some cases, you might want your virtual assistant to show a sequence of messages without expecting intermediate responses from the end user. In Mix.dialog, if you set up a single message node with multiple messages, they will all appear in the same chat bubble in the chat interface. Therefore, to make messages appear in separate chat bubbles, you must use multiple message nodes—one for each chat bubble—in the desired sequence.
Hyperlinks
When a virtual assistant shows messages that include hyperlinks, it is often important for reporting purposes to keep track of whether the end users actually used these links. The dialog flow logic can also use this information. Consider this sample scenario:
- A user engages with the virtual assistant.
- The response from the virtual assistant contains one or more hyperlinks.
- The user clicks a specific hyperlink.
Depending on the type of link or protocol (http, https, mailto, tel), some handling occurs. For example, the link target might open in a new tab, or in the current tab. - The virtual assistant responds with a message, such as: I opened that page for you.
- The virtual assistant then asks: Was this helpful?
To support such use cases, hyperlinks in your messages can include specific attributes that NDEP will use to determine additional information to return to the virtual assistant, or to to set a reporting variable, for example. Remember to use a blank href attribute (href=""
), or one with only a pound sign (href="#"
), for hyperlinks that are not meant to generate click or touch events.
Attributes | Description |
---|---|
data-nuance-message-text | Text to show in the transcript after the user clicked the link. |
data-nuance-message-data | JSON string containing one or more key-value pairs for reporting purposes; for example, to identify the specific link that the user clicked. Cannot be used by itself: data-nuance-message-text must also be specified. |
data-nuance-datapass | JSON string to fill a Mix.dialog variable of type string with the specified value. |
Notes:
- Key-value pairs inside
data-nuance-message-data
anddata-nuance-datapass
JSON strings must use single quotation marks (apostrophes) escaped with a backslash. - The equal sign (
=
), and braces ({
,}
) are part of the declaration format, and thus are not allowed inside these JSON strings.
Hyperlink example with response feedback
When the anchor tag of a hyperlink includes the attribute data-nuance-message-text
, NDEP relays the content of this attribute to the virtual assistant.
For example, given a message with this hyperlink: <a href="#" data-nuance-message-text="Yes">Yes, this response was helpful</a>
, after the user has selected the link “Yes, this response was helpful”, “Yes” appears in the transcript, as if the user had typed it as their response.
Hyperlink example with response feedback and reporting data
If the anchor tag also includes the attribute data-nuance-message-data
, NDEP also relays this content to the virtual assistant for setting the specified reporting variables. For example, given this hyperlink: <a href="#" data-nuance-message-text="Yes" data-nuance-message-data="{\'selected\': \'Yes\'}">Yes, this response was helpful</a>
, after the user has selected the link, in addition to making “Yes” appear in the transcript, this would also set the reporting variable selected to “Yes”.
Hyperlink example with reporting data
If the anchor tag contains the attribute data-nuance-datapass
, NDEP relays this content to the virtual assistant, which will use each key-value pair to set reporting variables as specified. For example, given this hyperlink: <a href="http://www.contoso.com/my-contoso" data-nuance-datapass="{\'linkSelected\': \'true\'}">Visit My Contoso</a>
, after the user has selected the link, the virtual assistant receives the key-value pair and sets linkSelected to true
.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.