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.

This table summarizes message formatting support by integration channel.

Supported message formatting by 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
WhatsApp Yes No No Yes Yes
Twitter No No No No No
Viber No No No Yes Yes
Telegram No No No Yes Yes
Line No No No Yes Yes
Instagram 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.

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:

  1. A user engages with the virtual assistant.
  2. The response from the virtual assistant contains one or more hyperlinks.
  3. 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.
  4. The virtual assistant responds with a message, such as: I opened that page for you.
  5. 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 for hyperlinks in messages
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.

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.

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”.

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.