Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.

Virtual Agent Designer bot responses

Log in to subscribe to topics and get notified when content changes.

Virtual Agent Designer bot responses

Virtual Agent Designer offers various controls for displaying bot responses in a conversation. Because the bot responses occur in third-party platforms, the format for each output may vary.

Text bot response control

Use the Text bot response control in a Virtual Agent topic to display a text bot response.

Example Text bot response control

Table 1.
Response properties Text bot response output
Text bot response control properties
Figure 1. Web UI Text bot response output
Text bot response output in the web UI
Figure 2. Slack Text bot response output
Text bot response output in Slack
Figure 3. Microsoft Teams Text bot response output
Text bot response output in Microsoft Teams
Figure 4. Workplace Text bot response output
Text bot response output in Workplace

Text bot response properties

Property Description
Name The name that identifies the Text bot response node in the topic flow.
Response message The Text bot response to the user, either a text string or a script that returns a text string. The script can include Glide record variables or script variables.
Condition A script that specifies a condition for presenting this response in the conversation. The condition must return a value of true to display the text.

Example Text bot response script

(function execute() {
    return 'Hello ' + gs.getUser().getFirstName();
})()

In this example, the script returns a string that greets the user. The gs.getUser().getFirstName() property is used to append the current user's first name.

Image Output bot response control

Use the Image Output bot response control in a Virtual Agent topic to display an image from a URL link. The image aspect ratio determines how the image is sized in the bot chat bubble.

Example Image Output bot response control

Table 2.
Response properties Image Output bot response output
Image Output bot response control properties
Figure 5. Web UI Image Output bot response output
Image Output bot response output in the web UI
Figure 6. Slack Image Output bot response output
Image Output bot response output in Slack
Figure 7. Microsoft Teams Image Output bot response output
Image Output bot response output in Microsoft Teams
Figure 8. Workplace Image Output bot response output
Image Output bot response in Workplace

Image Output bot response control properties

Property Description
Name Required. The name that identifies the Image Output bot response control node in the topic flow.
Image URL Link The URL link to an image file.
Condition A script that specifies a condition for presenting this image in the conversation. The condition must return a value of true to display the image.
Note: Third-party messaging applications might place restrictions on the maximum size of an image displayed within a conversation. For details on the maximum image size allowed, check the documentation for the messaging application. For example, Microsoft Teams supports a maximum image size of 1024 x 1024 pixels and 1 MB file size for PNG, JPEG, and GIF files. For more information, see the Microsoft Teams Developer documentation on conversations. Note also that sometimes in Microsoft Teams bot conversations, images might not fully render and appear cropped. The user has to scroll up and down in the messaging window to view the image.

HTML bot response control

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

Note: If you created conversations in the London release 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.

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.

Table 4.
HTML bot response properties HTML bot response output
HTML bot response control properties
Figure 13. Web UI HTML output
HTML output in the web UI
Figure 14. Slack HTML output
HTML output in Slack
Figure 15. Microsoft Teams HTML output
HTML output in Microsoft Teams
Figure 16. Workplace HTML output
HTML output in Workplace

HTML bot response control properties

Property Description
Name The name that identifies the HTML bot response control node in the topic flow.
HTML Message The HTML output to be displayed. Click the Edit icon to open the HTML editor.
Height (Pixel) The maximum height of the area for displaying HTML output in third-party messaging applications.
Width (Pixel) The maximum width of the bot bubble for displaying HTML output in third-party messaging applications.
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 values, previewing the HTML output in the messaging applications you intend to use, and then adjusting the height and width values.

Multi-flow Output bot response control

Use the Multi-flow Output bot response control in a Virtual Agent topic to sequentially display two or more outputs (text, image, link, or HTML). Users can move from one output to the next through a provided navigation button.

Example Multi-flow Output bot response control

Table 5.
Output properties Multi-flow Output bot response output
Multi-flow Output control properties
Figure 17. Web UI Multi-flow Output bot response output
Multi-flow Output bot response output in the web UI
Figure 18. Slack Multi-flow Output bot response output
Multi-flow Output bot response output in Slack
Figure 19. Microsoft Teams Multi-flow Output bot response output
Multi-flow Output bot response output in Microsoft Teams
Figure 20. Workplace Multi-flow Output bot response output
Multi-flow Output bot response output in Workplace.

Multi-flow Output bot response control properties

Property Description
Name The name that identifies this Multi-flow Output bot response control node in the topic flow.
Condition A script that specifies a condition for presenting this output in the conversation. The condition must return a value of true to display the output.
Response messages
Navigation Label The label for the button displayed below the output. The button enables the user to move to the next output in the flow.
Add a response For each output type, click + Add a Response to specify the output and define the output properties.
  1. In the Add a Response dialog box, select the Type, and specify the associated values:
    • Text — Enter the text to be displayed in the response.
    • Image — Enter the Header, Prompt (label for the link), and the URL link to the image.
    • Link — Enter the Header, Prompt (label for the link), and the URL link.
    • HTML — Enter the Height and Width, in pixels, to set the dimensions of the HTML block. In the HTML editor, enter the HTML markup to be displayed.
  2. Click Save.

Script Output bot response control

Use Script Output bot response control in a Virtual Agent topic to run a script that returns a single response or a multi-part response.

Example Script Output bot response control

Use the Script Output bot response control when creating a more complex response that relies on scripted calculations or requires a multi-part response. Scripted output can include text, image, cards, links, and HTML to create a versatile response.

Table 6.
Script Output properties Script Output bot response output
Script Output bot response control properties
Figure 21. Web UI Script Output bot response output
Script Output bot response output in the web UI
Figure 22. Slack Script Output bot response output
Script Output bot response output in Slack
Figure 23. Microsoft Teams Script Output bot response output
Script Output bot response output in Microsoft Teams
Figure 24. Workplace Script Output bot response output
Script Output bot response output in Workplace

Script Output bot response control properties

Property Description
Name The name that identifies the Script Output bot response control node in the topic flow.
Script Output Type The type of output returned by the script: single-part or multi-part.
Script Response Message The script that generates the selected output type (single or multi-part).
Condition A script that specifies a condition for presenting this output in the conversation. The condition must return a value of true to display the output.

Example script

(function execute() {
      var gdt = new GlideDateTime();
      var gt = new GlideTime();
      gdt.addSeconds(7200);
      gt = gdt.getTime();
      var multiOutMsg = new sn_cs.MultiPartOutMsg();
      multiOutMsg.addPlainTextPart('Thank you for submitting an incident.');
      multiOutMsg.addPlainTextPart('You should receive a response from a technician by ' + gt.getByFormat('HH:mm'));
      return multiOutMsg;
})()

In this example, the script calculates the time two hours from the current time and outputs a multi-part message that includes this information.

Card bot response control

Use the Card bot response control in a Virtual Agent topic to display selected information from a record on your instance, such as an incident.

Note: If you created conversations in the London release that use the HTML 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.

Example Card bot response output

The Card response shows content from a record in a compact format designed for readability within the chat window. The record content includes the display field for the table at the top of the card followed by any other fields specified by the properties of the bot response.
Table 7.
Response properties Card output
Card control properties
Figure 25. Web UI Card output
Card output in the web UI
Figure 26. Slack Card output
Card output in Slack
Figure 27. Microsoft Teams Card output
Card output in Microsoft Teams
Figure 28. Workplace Card output
Card output in Workplace

Card bot response control properties

The contents of the card must come from a single record on your instance. This record can be referenced from variables in the flow or queried using a script that returns a single Glide record from a selected table. Use the Card control properties to define which record is used and the fields that are displayed from that record.

Property Description
Name The name that identifies the Card bot response control node in the topic flow.
Reference Type The reference to a specific record in a table. Choose one of the following options:
  • Record — Data for the card comes from a record referenced in a variable from another node in the flow, for example, a Choice List or Glide Action.
  • Script — Data for the card comes from a script that returns a single Glide record from a specified table.
Record

When the Reference Type property is set to Record, this property appears as a list. Use this list to select a variable from the current flow that contains a record object. Information from this record is shown in the card.

When the Reference Type field is set to script, use this field to input a script that returns the record. Information from this record is shown in the card.

Table If the Reference Type is Script, select the table containing the record.
Fields The fields from the ServiceNow record to be displayed in the card. Click +Add Field to specify each field.
Note: If you are using Workplace, a maximum of four fields is rendered on the card. If you have more than four fields, the remaining fields are displayed on a subsequent card (up to four fields per card).
Condition A condition statement or script that specifies a condition for presenting this card in the conversation. The condition must return a value of true to display the card.

Example Glide record query

(function execute(table) {
    /* Write a glide record query, and return the glide record.
       For example:
       
       var gr = new GlideRecord(table);
       gr.addEncodedQuery('active=true^number=INC0010099');
       gr.query();
       if(gr.next()) {
          return gr;
    }
    */
})(table)

In this example, the script creates a GlideRecord object, populates this object using a query that should return a single result, then returns the object. The Table property defines the table used in this query.

Feedback