HTML bot response control
Summarize
Summary of HTML bot response control
The HTML bot response control in ServiceNow’s Virtual Agent allows you to display static HTML content as part of a bot’s response. This enables richer, formatted messages including images, headings, and text within Virtual Agent conversations. It is ideal for presenting customized content directly in the chat interface.
Show less
Note that previous uses of this control for card layouts are now better handled by the Card bot response control, which dynamically displays record data with links.
Security Considerations
To prevent cross-site scripting (XSS) attacks, an automatic HTML sanitizer script runs on all HTML markup in the instance, including Virtual Agent conversations. This script removes unsafe elements and attributes. You can customize the sanitizer’s behavior by editing its inclusion and exclusion lists or disable it for Virtual Agent conversations via a system property.
Properties and Configuration
- Node name: Identifies the HTML response node within the conversation flow.
- HTML message: The static HTML code to display. An HTML editor is provided for editing this content.
- Height and Width (pixels): Define the maximum display size of the HTML content bubble, especially important for third-party messaging apps.
- Advanced - Hide this node: Allows conditional display of the HTML response based on a no-code or low-code condition.
Channel Support and Limitations
The HTML bot response is supported on multiple platforms, but behavior varies:
- Web UI, Mobile UI, Now Assist panel, Slack, Workplace: Fully supported with HTML rendered as intended.
- Microsoft Teams: HTML is rendered as an image, so use of alternative controls (images, cards) is recommended.
- Alexa: Partial support on screen devices; non-screen devices receive a link message.
- Unsupported Channels: Facebook Messenger, SMS Twilio, LINE, WhatsApp, Apple Messages for Business do not support this control.
When designing for third-party messaging apps, preview the HTML output and adjust height and width settings accordingly to ensure proper display.
Practical Use
This control lets ServiceNow customers enhance Virtual Agent conversations with customized, formatted HTML content, improving user interaction and information presentation. When used appropriately and with security settings in mind, it helps create engaging and visually rich bot responses.
Use the HTML bot response control to display static HTML text in the Virtual Agent bot response.
Security considerations for HTML markup
For security reasons, an HTML sanitizer script runs automatically and checks all HTML markup used in the instance, including Virtual Agent conversations. The sanitizer script removes elements or attributes that might enable cross-site scripting attacks. You can edit the HTML sanitizer script to change the list of markup items to be preserved or removed. For details, see HTML sanitizer. For examples of adding markup items to the exclusion or inclusion lists, see Configure HTML sanitizer.
To disable the HTML sanitizer script only for Virtual Agent conversations, add the com.glide.cs.html.sanitizer.enabled system property and set the value to false. For details about creating a system property, see Add a system property.
HTML bot response control properties
| Property | Description |
|---|---|
| Node name | Name that identifies this HTML bot response control node in the topic flow. |
| HTML message | HTML output to be displayed. Select the Script icon |
| Height (Pixel) | Maximum height of the area for displaying HTML output in third-party messaging applications. |
| Width (Pixel) | Maximum width of the bot bubble for displaying HTML output in third-party messaging applications. |
| Advanced | |
| Hide this node | |
| Conditionally show this node if | No-code condition statement or low-code script that specifies a condition for presenting this node in the conversation. The condition must evaluate to true. |
Channel support
| Channel | Support | Constraints |
|---|---|---|
| Web UI | Supported | None |
| Mobile UI | Supported | None |
| Now Assist panel | Supported | None |
| Microsoft Teams | Supported | Since HTML is rendered as an image in Microsoft Teams, other controls are recommended. For example, use images or cards instead of HTML for Microsoft Teams. |
| Slack | Supported | None |
| Workplace | Supported | None |
| Facebook Messenger | Not supported | Not applicable |
| SMS Twilio | Not supported | Not applicable |
| LINE | Not supported | Not applicable |
| Not supported | Not applicable | |
| Apple Messages for Business | Not supported | Not applicable |
| Alexa (Voice) | Partial support | Supported on devices with screens. For nonscreen devices, the user receives a message: We found a link. For details, see Fine-tune Virtual Agent settings and topics for the best Alexa voice chat experience. |
Example HTML bot response output
The HTML bot response shows a static HTML as a chat response. This example includes an image, headings, and paragraph text. The web UI presents this content as HTML. The Slack, Microsoft Teams, and Workplace user interfaces display the same content as a PNG image. URL links within the HTML are extracted and displayed below the image. The URL can be either an absolute or a relative link. If you use a relative link, it must be relative to the ServiceNow instance.
| HTML bot response properties | HTML bot response output |
|---|---|