HTML bot response control

  • Release version: Yokohama
  • Updated January 30, 2025
  • 2 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    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 the bot’s chat responses. This feature is useful for embedding formatted text, images, and links directly within conversations to enhance interaction and present rich information.

    Show full answer Show less

    Note that if you previously used this control to create card layouts, it is recommended to transition to the Card bot response control, which dynamically displays information from records and includes direct links.

    Security Considerations

    To protect against cross-site scripting (XSS) attacks, an automatic HTML sanitizer runs on all HTML markup, including Virtual Agent conversations. This sanitizer removes unsafe elements and attributes. You can customize the sanitizer’s behavior by editing its configuration or disabling it for Virtual Agent conversations via a system property.

    Key Properties and Configuration

    • Node name: Identifies the HTML response node within the conversation flow.
    • HTML message: The HTML content to display; editable via an HTML editor.
    • Height and Width (Pixels): Define the maximum display size of the HTML output in third-party messaging apps to ensure proper rendering.
    • Advanced option - Hide this node: Allows conditional display of the HTML response based on no-code conditions or scripts.

    Channel Support and Rendering Behavior

    The HTML bot response control supports multiple channels with some rendering variations:

    • Fully supported: Web UI, Mobile UI, Now Assist panel, Slack, Workplace.
    • Microsoft Teams: HTML renders as an image; therefore, using cards or images is better for Teams.
    • Not supported: Facebook Messenger, SMS (Twilio), LINE, WhatsApp, Apple Messages for Business.
    • Alexa Voice: Partial support on devices with screens; nonscreen devices receive a link message instead.

    Because HTML output can vary across messaging platforms, it is important to set and preview height and width values appropriately to achieve optimal display.

    Practical Use and Example

    The control enables inclusion of images, headings, paragraphs, and links within the bot responses. While the Web UI renders HTML natively, platforms like Slack and Teams display the content as images with extracted URLs shown separately. Relative links must be relative to the ServiceNow instance.

    This control is ideal for presenting rich and styled information in conversations, but when targeting Microsoft Teams or unsupported channels, consider alternative controls for better compatibility and user experience.

    Use the HTML bot response control to display static HTML text in the Virtual Agent bot response.

    Note:
    If you created conversations in earlier releases that use this bot response control to generate card layouts, consider updating your conversations to use the Card bot response control. The Card displays information from a record in your instance and contains a link to that related record.

    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 Script icon. to open the HTML editor and enter the HTML text.
    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

    Note:
    As shown in the examples, HTML output can vary in third-party messaging applications. Determine an appropriate Height and Width area by setting initial height and width values, previewing the HTML output in the messaging applications you intend to use, and then adjusting the height and width values.
    Table 1. Channel support for the HTML bot response control
    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
    WhatsApp 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.

    Note:
    Virtual Agent Designer controls may display and function differently in other channels.
    HTML bot response properties HTML bot response output
    Figure 1. HTML bot response control basic properties
    Basic properties include the node name, HTML message, height, and width.
    Figure 2. Web UI HTML output
    A chat window shows the company logo with a header, subheader, and body text.