Default input and output rich controls for a custom chat integration

  • Release version: Xanadu
  • Updated August 1, 2024
  • 3 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 Default input and output rich controls for a custom chat integration

    ServiceNow customers integrating custom chat solutions must map input and output rich controls to their custom chat integration using theCustom Adapter Configurations [syscscustomadapterconfig]table. Proper mapping ensures that rich controls function correctly, providing users with a smooth chat experience. Missing outbound transformer implementations for any rich control can result in no response being served, negatively impacting user satisfaction.

    Show full answer Show less

    Key Features

    • ActionRichControl: Handles multiple action message types generated by Virtual Agent (e.g., spinner actions, switching conversations, subscribing to support queues). One outbound transformer manages all these messages; no inbound transformer is needed. When messages originate from a live agent, an agentInfo attribute is included to indicate this.
    • DefaultPicker: Maps to File Picker, Topic Picker, and Boolean controls, supporting options with labels, values, descriptions, attachments, and enablement flags. It also supports ordering of promoted topics to control display sequence.
    • DefaultText: Supports Input Text, Output Text, and File Upload controls with properties like required fields, masking types (SECURE, SENSITIVE, NONE), and NLU text enablement.
    • DefaultDate: Supports Date, DateTime, and Time controls with parameters for required inputs and NLU text enablement.
    • DefaultOutputLink/DefaultOutputImage/DefaultOutputCard/DefaultOutputHtml/DefaultOutputTable: Maps to various output response types including links, images, cards, HTML content, and tables, each with specific attributes like labels, headers, styles, sizes, and data content.
    • DefaultGroupedPartsOutputControl and DefaultMultiPartOutput: Handle multi-response outputs allowing grouping of links or HTML content with navigation controls.
    • DefaultCustomControl: Supports user-defined custom controls with attributes defining the control name, whether input is required, component definitions, and serialized control data for flexible customization.

    Practical Application for ServiceNow Customers

    By leveraging these default rich controls, customers can efficiently map and implement various input and output components in their custom chat interfaces, ensuring compatibility and enhanced user interactions. The detailed properties and examples assist in configuring controls that match specific use cases such as file uploads, date/time inputs, multi-part responses, and more.

    Ensuring each rich control has an outbound transformer implementation mapped prevents failures in serving responses, which is critical for maintaining a positive chat experience with end users.

    Input and output rich controls must be mapped to your custom chat integration in the Custom Adapter Configurations [sys_cs_custom_adapter_config] table. If a rich control is missing an outbound transformer implementation, a response is not served to the end user and that user may get an unsatisfactory chat experience.

    The following default rich controls map to input and output rich controls. The uiType parameter refers to a topic control used to build conversations in Virtual Agent Designer.

    Table 1. Default input and output rich controls
    Rich control Description
    ActionRichControl This component handles the different events and actions that occur in a conversation. Some actions may not apply to all channels. For example, StartSpinnerActionMsg is ignored in SMS.

    ServiceNow® Virtual Agent produces the following types of action messages through this framework. The custom chat interface only recognizes certain action message types.

    • SeparatorActionMsg ||actionMsg instanceof
    • SystemActionMsg ||actionMsg instanceof
    • TopicFinishedActionMsg ||actionMsg instanceof
    • SwitchToVirtualAgentActionMsg ||actionMsg instanceof
    • SwitchConversationActionMsg ||actionMsg instanceof
    • ChatSubHeaderActionMsg ||actionMsg instanceof
    • StartSpinnerActionMsg ||actionMsg instanceof EndSpinnerActionMsg
    • SubscribetoSupportQueue ||actionMsg instanceof
    • SubscribeToChatPresence ||actionMsg instanceof
    • SwitchToLiveAgentActionMsg ||actionMsg instanceof

    ActionRichControl wraps these messages inside the actionMsg element. So, a single outbound transformer for ActionRichControl can handle all of these messages. There is no need for an inbound transformer for this component.

    agentInfo parameter If the rich control is sent from a live agent, then the agentInfo attribute is added to the rich control.
    Example:
    {
         uiType: "someType",
         group: "someGroup"
         agentInfo: { sentFromAgent: true }  // please note that this object may contain more info in subsequent releases.
         ...
    } 
    DefaultPicker Maps to File Picker, Topic Picker, and Boolean controls.
    Example:
    {
        uiType: "Picker/TopicPicker/Boolean",
        group: "DefaultPicker",  
        nluTextEnabled: true/false,
        promptMsg: "", // optional (needed for TopicPicker)
        label: "The question for the list",   // always filled
        itemType: "Picture/List"  // needed to user key to expect picture attached
        options: [
            {
                label: "display label prompt",
                value: "the value required to satisfy the question",
                description: "a description of value_1 item"
    	    attachment: "www.foo",
                enabled: true/false
            }, 
    	...
        ]
    }

    The optional order parameter lets you specify the order in which promoted topics should display. For example:

    "options": [
        {
          label: "Check IT Ticket Status",
          value: "55720b465bf0201024f11fc40a81c72d",
          order: 100,
          enabled: true
        },
        {
          label: "Live Agent Support",
          value: "ce2ee85053130010cf8cddeeff7b12bf",
          order: 200,
          enabled: true
        },
        {
          label: "Open IT Ticket 2",
          value: "2a46cffbc7602010v088bbf603c260a7",
          order: 300,
          enabled: true
        }
    ]
    DefaultText Maps to Input Text, Output Text, and File Upload controls.
    Example:
    {
        uiType: "InputText/OutputText/FileUpload/Picture",
        group: "DefaultText", 
        required: true/false,
        nluTextEnabled: true/false,
        itemType: "file/image/inputtext/outputtext",
        maskType: "SECURE/SENSITIVE/NONE"  // null except for InputText/OutputText
        label: "The Question?"        
    }
    DefaultDate Maps to Date and Time controls.
    {
        uiType: "Date/DateTime/Time",
        group: "DefaultDate", 
        required: true/false,
        nluTextEnabled: true/false,   
        label: "The Question?"
         
    }
    DefaultOutputLink Maps to link response controls.
    Example:
    {
        uiType: "OutputLink",
        group: "DefaultOutputLink",
        label: "link label",
        header: "link header",
        type: "link",
        value: {
            action: "www.foo",
        }	
    }
         
    }
    DefaultOutputImage Maps to image response controls.
    Example:
    {
        uiType: "OutputImage",
        group: "DefaultOutputImage",
        value: "www.foo"
    }
    DefaultOutputCard Maps to card response controls.
    Example:
    {
        uiType: "OutputCard",
        group: "DefaultOutputCard",
        templateName: "Card",
        data: "some json data string"
    }
    DefaultOutputHtml Maps to HTML response controls.
    Example:
    {
        uiType: "OutputHtml",
        group: "DefaultOutputHtml",
        style: "inline",
        height: 100,
        width: 100,
        value: "<div>html</div>"
    }
    DefaultOutputTable Maps to table response controls.
    Example:
    {
        uiType: "OutputTable",
        group: "DefaultOutputTable",
        label: "Table Title",
        headers: ["Column 1", "Column 2"],
        navigationBtnLabel: "See next",
        data: [
            ["foo1", "foo2"],
            ["bar1", "bar2"]
        ]
    }
    DefaultGroupedPartsOutputControl Maps to multi-response controls.
    Example:
    {
        uiType: "GroupedPartsOutputControl",
        group: "DefaultGroupedPartsOutputControl"
        groupPartType: "Link",
        header: "header message",
        values: [
    	{
    	    action: "www.foo",
    	    description: "description",
    	    label: "link_1 label",
    	    context: "ITSM"
    	},
    	...
        ]
    }
    DefaultMultiPartOutput Maps to multi-response controls.
    Example:
    {
        uiType: "MultiPartOutput",
        group: "DefaultMultiPartOutput"
        navigationBtnLabel: "Go next",
        content: {
            uiType: "OutputHtml",
            style: "inline",
            type: "html",
            height: 100,
            width: 100,
            value: "<div>html</div>"
         }
    }
    DefaultCustomControl Maps to custom controls.
    Example:
    {
        uiType: "CustomControl",
        group: "DefaultCustomControl",
        name: "The name of the Custom Control (sys_cs_custom_control.name)",
        required: true/false,
        uxComponentDefinitionSysId: "seismicComponentId" // or null if not
        isInput: true/false, // whether to wait for a response value or if just output
        serializedControlData: "User defined JSON from generateControlData function";    
    }