Embedded Service 26B

Embedded Service is an Oracle Digital Customer Service product to embed automated or live chat into any website, including your DCS Portal.

Table of Contents

Usage

Complete the following steps to deploy Embedded Service (ES):

  1. Begin with the Required setup for Embedded Service.
  2. Customize and publish your own Embedded Service application from the "Embedded Service 26B" reference implementation template in Oracle Visual Builder (VB).
  3. Use the DCS Rules Engine to load Embedded Service on any web page.

Architecture

Embedded Service has a layered architecture with a presence in both the host page where it is embedded and the iframe containing the ES Visual Builder application. From the top-down, these layers include:

  1. Rules Engine
  2. Embedded Service SDK
  3. Embedded Service Application

Outer API

The Outer API is a JavaScript API exposed by the Embedded Service SDK on the host page.

Properties

Many Embedded Service features are configured by properties, which are summarized in the table below. ES properties can be used per the following rules:

When customizing properties, it generally make sense to first set them in the inner load method, which will set custom defaults for all instances of your ES application. For many properties this is enough. For those that require further customization based on page context, you can additionally change them at runtime via the outer load and update methods. In the Rules Engine, these are available in the loadES and updateES actions, respectively. See the Property Lifecycle section for more details on how ES properties can be set and changed.

Key Default Inner Update Description
appUrl No No The only required property, the appUrl is the fully qualified URL of your published Embedded Service Visual Builder application. E.g. https://<visual-builder-host>/ic/builder/rt/<ES_app_id>/live/webApps/es.
businessUnitId Yes No Business unit id of the Embedded Service application
chat Yes Mixed Chat related properties. See chat for more.
context Yes Yes Optional context from the host page. See Context for more.
css Yes No CSS properties. See css for more.
custom Yes Yes Pass any custom data from the host page as key/value pairs. Then read them in your ES application code (e.g. in the LoadHandler or UpdateHandler) to trigger custom runtime behavior. Not to be confused with custom fields supported in the context property and Chat Launch Form.
drag Yes No Properties related to dragging. See drag for more.
icons Yes No Icons used on the host page. See icons for more.
locale en No No Locale of Embedded Service (e.g. es, fr-CA). If not specified, ES will inherit the locale from the host page via the lang attribute on the html tag. If this is empty, ES will then try the user's browser language setting. If that is also unspecified, it will default to English.
styles Yes Yes Style properties to manage the look and feel of the Embedded Service elements on the host page. See Styles for more.
strings Yes Yes All translatable strings used in Embedded Service. See Strings for more.
usageCode Yes No Product catalog usage code of the Embedded Service application.
variables Yes Yes A subset of application variables that can be set at runtime. See Variables for more.
view minimized Yes Yes The initial view of Embedded Service on load, or the updated view when used with update. See Views for more.
wcfs Yes Yes Settings to pass directly to Web Chat for Service (deprecated). See wcfs for more.

Property Lifecycle

When customizing ES properties, it's important to understand their lifecycle from load through potentially multiple updates.

When first loading Embedded Service, any properties you specify in the outer load (or RE loadES action) and inner load methods are merged with the default properties defined within the ES SDK. When the same property is set in both methods, the outer property takes precedence. When not set at all, the Embedded service defaults are used. This combined set of custom and default properties become the initial current properties used by Embedded Service.

When updating properties with the outer update method (or RE updateES action), the properties you pass are merged with the current properties rather than the defaults. I.e. updates are incremental and sparse. This means that an update will not override properties already customized unless explicitly specified in the update itself.

This can lead to unexpected behavior with nested properties such as context and styles. E.g. If a load or previous update sets one context property and a subsequent update sets a second context property, the current properties now have both context properties set. If the intention is to remove the initial property in the latest update, it must be explicitly set with an empty value.

With styles, the same rule applies. If you customize a subset of style properties, then the current properties include a merged set of defaults and your customizations. When updating, you are merging into this set of already merged styles. E.g. if you want to switch between multiple custom maximized views at runtime, it is best to use custom views rather than continuing to update the one set of styles under the standard maximized view. Otherwise, you can end up with an unexpected mix of properties from multiple updates.

Note that this sparse merging behavior is consistent across all properties.

Chat

The chat property is an object with the following defaults:

{
  chat: {
    autoStart: 'noVisibleFields',
    linksMode: 'dynamicLinks',
    polling: 'off',
    pollingDetails: {
      minAgentSessions: 1
    }
  }
}

Of the following sub-properties, autoStart and linksMode are updatable but the others are not.

autoStart

The autoStart property controls if and how Embedded Service starts a chat automatically. The following values are supported:

linksMode

The linksMode setting configures how to handle chat links and ODA URL actions in ES. Valid options include:

Polling

Polling can be configured to show and hide Embedded Service based on agent availability, which can be useful when chat is handled by live agents. Two properties work together to configure this feature: polling and pollingDetails. The polling property can be on or off (default).

pollingDetails is an object with the following sub-properties:

Rules:

When polling is on, the default behavior is to keep ES hidden until agents are available. When an agent first becomes available, ES is displayed (or not) based on its view property:

In the application code, see the application AgentAvailabilityHandler action chain, which listens for the inner agentAvailability event and implements the default implementation.

Context

Use the context property to customize field values of the Chat Launch Form in the ES application. There is a one-to-one mapping between context properties and form field names, and even custom fields can be set. E.g.

{
  "context": {
    "Email": "first.last@example.com",
    "FirstName": "First",
    "LastName": "Last",
    "Product": {
      "productGroupId": 123,
      "inventoryItemId": 456
    },
    "ServiceRequestNumber": "789",
    "my_custom_field": "foo"
  }
}

If the target form field is:

In general, the context property can change the value of any field of the Chat Launch Form. However, when an end user is logged in, the user fields of Email, FirstName and LastName are auto-set to the authenticated user and may no longer be set by context.

CSS

CSS related properties include:

If this type of inheritance is not required, simply set cssVariableNamespaces to an empty array and the application will look as configured by the default CSS variable values in app.css. See Theming for more.

Drag

Drag related properties include:

Icons

Icons used on the host page include:

The icons used within the ES VB app are defined in application code.

Strings

All end-user-facing, translatable strings used in Embedded Service should be defined in the app bundles (app-strings.json files) under the locale directories in webApps/es/resources/strings/app/nls.

In the reference implementation, default strings are organized by prefix to group them by usage. While not a full list, a few prefixes worth highlighting include:

You're free to modify existing strings and add your own. However, if you support more than one locale, you're responsible for translating any new or updated strings. Any strings not defined in the current locale will fall back to the English strings in the root directory.

If you don't need different strings for different instances of Embedded Service, updating the app bundles in your VB application code should suffice. If you do need different strings per instance based on runtime context, any string (or subset of strings) in the app bundle can be set via the strings property. This applies to both default strings and your custom strings; simply use the same keys defined in the app bundle. Note that the strings property can only customize strings for the active locale (see the locale property).

Variables

The Embedded Service reference implementation uses Visual Builder application variables for various configuration and state management. In some cases, it may be useful to set one or more these configuration-type variables at runtime based on the context of the page or ES instance. The ES application maintains an allow list of supported variables in the APPLICATION_VARIABLES_ALLOW_LIST application constant, which is an array of variable names that can be set at runtime with the variables property.

To set an application variable at runtime, you can:

  1. Add the variable name to the APPLICATION_VARIABLES_ALLOW_LIST array
  2. Pass the custom variable value as an outer property via the top-level variables property.

The default ES reference implementation initializes the specified application variables with the provided values as ES loads. The following example sets the survey id and chatLaunchFormFields variables dynamically from the host page in the ES load outer method:

es.load({
  ...other outer properties,
  variables: {
    chatLaunchFormFields: [...updated fields]
    surveyIdBot: 123,
    surveyIdLiveAgent: 456
  }
});

See the Survey and Chat Launch Form sections for more details on their respective features.

Views

Views are different modes in which Embedded Service can appear (or not appear). The standard views include:

In addition to the out-of-the-box views above, one or more custom views can be added by adding a custom key to the styles property and setting any style properties specific to the view. Custom views have the following restrictions:

  1. Their names must begin with a custom prefix (e.g. customAI)
  2. They can only be maximized views, which means they must set widgetHide: false in their properties. Custom hidden and minimized views are not supported.

Keep in mind that if you only need one maximized view, you can simply customize the styles properties of the standard maximized view. I.e. Custom views are only necessary when you want to switch between two or more maximized views.

Standard and custom views alike can be set initially with the view property on load and then changed by one of the following:

Here's an example of a customAI view that takes up most of the screen:

{
  styles: {
    ...,
    customAI: {
      launchButtonHide: true,
      widgetBorderRadius: '10px 10px 0 0',
      widgetBottom: '0',
      widgetHeight: '90%',
      widgetHide: false,
      widgetMaxWidth: '90%',
      widgetRight: 'calc(50% - var(--es-widget-width)/2)',
      widgetWidth: '90%'
    }
  }
}

Styles

Style Properties

The styles properties configure the look and feel of the Embedded Service elements on the host page, including:

The properties are grouped and defined separately for each ES view in order to support different values for the same property as well as animations between views.

In general, most style properties are common to all views. Rather than duplicating these in each and every view, define them once in the common view instead. Though the common view is not a real view but rather a baseline (or abstract view) from which all other views inherit. Then only the differences from common need to be specified in the view specific styles.

The following table lists all supported styles properties. Note that by default the properties used by the skeleton for animations match the corresponding CSS properties defined in the ES application for a seamless experience.

Key Format Description
bodyBgColor background-color Background color of the widget body used for the skeleton.
brandBgColor background-color Brand background color used for key element background colors when not specified separately.
brandTextColor color Brand text color used for key element text colors when not specified separately.
fontFamily font-family Font family used on the launch button. Custom fonts are not supported.
fontSize font-size Root font size for Embedded Service, from which all font-sizes in rem units are based.
headerBgColor background-color Background color of the widget header used for the skeleton. Should match the application header.
headerHeight height Height of the widget header used for the skeleton. Should match the application header.
launchButtonAnimationDelay number in ms How long to wait to animate hiding and showing the launch button, if applicable. When customizing the launchButtonTransition property for animating view changes, it is recommended to set this to at least 50ms longer than the transition animation.
launchButtonBgColor background-color Background color of the launch button. Defaults to brandBgColor.
launchButtonBorderRadius border-radius Border radius of the launch button.
launchButtonBottom bottom Bottom position of the launch button.
launchButtonFontSize font-size Font size of the launch button. Defaults to fontSize.
launchButtonFontWeight font-weight Font weight of the launch button.
launchButtonHeight height Height of the launch button.
launchButtonHide boolean Whether to hide the launch button. Defaults to false when minimized and true when maximized and hidden.
launchButtonIconHeight height Height of the optional launch button icon.
launchButtonIconWidth width Width of the optional launch button icon.
launchButtonOpacity opacity Opacity of the launch button. Can be used with launchButtonTransition to fade the button in and out on view transitions.
launchButtonPadding padding Padding of the launch button.
launchButtonRight right Right position of the launch button.
launchButtonTextColor color Text color of the launch button. Defaults to brandTextColor.
launchButtonTransform transform Launch button transform. See Right Tab and Drawer for an example.
launchButtonTransition transition Launch button transition for animations.
launchButtonWidth width Width of the launch button.
widgetAnimationDelay number in ms How long to wait to animate the Embedded Service widget between view changes, if applicable. When customizing widgetTransition, it is recommended to set this to at least 50ms longer than the transition animation.
widgetBorder border Border of the Embedded Service widget.
widgetBorderRadius border-radius Border radius of the Embedded Service widget.
widgetBottom bottom Bottom position of the Embedded Service Widget.
widgetHeight height Height of the Embedded Service widget.
widgetHide boolean Whether to hide the Embedded Service widget. Defaults to false when maximized and true when minimized and hidden.
widgetMaxWidth width Maximum width of the Embedded Service widget.
widgetOpacity opacity Opacity of the Embedded Service widget.
widgetRight right Right position of the Embedded Service widget.
widgetTransition transition Embedded Service widget transition for animations.
widgetWidth width Width of the Embedded Service widget.
zIndex z-index The z-index of both the launch button and the Embedded Service widget.
Default Styles

In general, the default values of the majority of these style properties are suitable for most ES applications. Here are the full defaults for reference, though when customizing styles keep in mind that you only need to specify the differences from these defaults. See Property Lifecycle and the examples below.

{
  "styles": {
    "common": {
      "bodyBgColor": "rgb(249,249,249)",
      "brandBgColor": "rgb(90,118,158)",
      "brandTextColor": "#fff",
      "fontFamily": "-apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Helvetica Neue\", Arial, sans-serif",
      "fontSize": "1em",
      "headerBgColor": "",
      "headerHeight": "48px",
      "launchButtonAnimationDelay": 500,
      "launchButtonBgColor": "",
      "launchButtonBorderRadius": "4px",
      "launchButtonBottom": "10px",
      "launchButtonFontSize": "1rem",
      "launchButtonFontWeight": "400",
      "launchButtonHeight": "auto",
      "launchButtonHide": true,
      "launchButtonIconHeight": "24px",
      "launchButtonIconWidth": "24px",
      "launchButtonOpacity": "0",
      "launchButtonPadding": "8px 14px",
      "launchButtonRight": "10px",
      "launchButtonTextColor": "",
      "launchButtonTransform": "none",
      "launchButtonTransition": "opacity 400ms ease-in-out",
      "launchButtonWidth": "auto",
      "widgetAnimationDelay": 500,
      "widgetBorder": "1px solid #999",
      "widgetBorderRadius": "10px",
      "widgetBottom": "10px",
      "widgetHeight": "0px",
      "widgetHide": true,
      "widgetMaxWidth": "",
      "widgetOpacity": "1",
      "widgetRight": "10px",
      "widgetTransition": "all 400ms ease-in-out",
      "widgetWidth": "0px",
      "zIndex": "10000"
    },
    "hidden": {
      "launchButtonHide": true,
      "widgetBorder": "none",
      "widgetHide": true,
      "widgetOpacity": "0"
    },
    "maximized": {
      "launchButtonHide": true,
      "widgetHeight": "720px",
      "widgetHide": false,
      "widgetWidth": "480px"
    },
    "minimized": {
      "launchButtonHide": false,
      "launchButtonOpacity": "1",
      "widgetBorder": "none",
      "widgetHide": true,
      "widgetOpacity": "0"
    },
    "mobile": {
      "launchButtonHide": true,
      "widgetBorder": "none",
      "widgetBorderRadius": "0",
      "widgetBottom": "0",
      "widgetHeight": "100%",
      "widgetHide": false,
      "widgetRight": "0",
      "widgetWidth": "100%"
    }
  }
}
Style Examples

The following sections show examples of styling Embedded Service in different ways. If you'd like to switch between multiple of these at runtime, be sure to use custom views rather than just a plain update. See Property Lifecycle for more.

Example: Large Centered

The following example centers and expands the maximized view to cover most of the page.

{
  "styles": {
    "maximized": {
      "widgetBorderRadius": "10px 10px 0 0",
      "widgetBottom": "0",
      "widgetHeight": "90%",
      "widgetMaxWidth": "90%",
      "widgetRight": "calc(50% - var(--es-widget-width)/2)",
      "widgetWidth": "90%"
    }
  }
}

Note the use of --es-widget-width in the widgetRight property, which is a reference to the runtime CSS variable set internally by ES from the widgetWidth property. Each style property is written to a CSS variable following this pattern and can thus be used by other style properties if necessary.

Example: Right Tab and Drawer

The following example customizes the minimized view to a right tab and the maximized view to a right drawer, both of which slide in from the right.

{
  "styles": {
    "common": {
      "launchButtonBorderRadius": "10px 10px 0 0",
      "launchButtonBottom": "25%",
      "launchButtonHeight": "36px",
      "launchButtonOpacity": "1",
      "launchButtonRight": "-36px",
      "launchButtonTransform": "translateX(28px) rotate(-90deg)",
      "launchButtonTransition": "right 400ms ease-in-out",
      "launchButtonWidth": "90px",
      "widgetBorderRadius": "0px",
      "widgetBottom": "0px",
      "widgetHeight": "100%",
      "widgetOpacity": "1",
      "widgetRight": "0px",
      "widgetTransition": "width 400ms ease-in-out"
    },
    "hidden": {
      "widgetOpacity": "1"
    },
    "minimized": {
      "launchButtonRight": "0px",
      "widgetHeight": "100%",
      "widgetOpacity": "1"
    },
    "maximized": {
      "widgetHeight": "100%"
    }
  }
}
Example: Bottom Tab

The following example shows a bottom tab and widget that slide up from the bottom.

{
  "styles": {
    "common": {
      "launchButtonBorderRadius": "10px 10px 0 0",
      "launchButtonBottom": "-32px",
      "launchButtonHeight": "32px",
      "launchButtonPadding": "6px 10px",
      "launchButtonRight": "30px",
      "launchButtonTransition": "bottom 400ms ease-in-out",
      "widgetBorderRadius": "10px 10px 0 0",
      "widgetBottom": "0px",
      "widgetTransition": "all 400ms ease-in-out"
    },
    "minimized": {
      "launchButtonBottom": "0px"
    }
  }
}

WCFS

To implement its chat feature, Embedded Service currently uses Web Chat for Service (WCFS) and supports many WCFS settings in its wcfs property. However, please note that future versions of ES may migrate to a different chat client and thus it is discouraged to use these WCFS settings directly in ES as they may not be available in the future. If you are willing to take that risk, use the instructions below to see which WCFS settings are available in ES today.

Just as Embedded Service wraps WCFS, WCFS wraps the ODA WebSDK, which in turn has its own settings. Each layer supports many but not all of the settings of the layer below. Thus the WCFS settings supported in ES are the settings listed in both the WCFS and ODA WebSDK docs minus those listed in both of the unsupported lists.

Layer Version Unsupported Settings
Embedded Service 26.04.0 See Unsupported WCFS Settings
WCFS SDK 26.04.0 See Unsupported WebSDK Settings
ODA WebSDK 26.02 N/A

The ES reference implementation does set a few wcfs settings by default in the inner load method, and these must remain intact for the corresponding features to work. But the wcfs property can also be extended to add other supported WCFS and WebSDK settings as desired.

Unsupported WCFS Settings

The following WCFS settings are not supported in Embedded Service:

While some colors are supported, the following are not:

While some hotkeys are supported, the following are not:

While some icons are supported, the following are not:

Outer Methods

The ES SDK exposes the following methods to the host page. As noted in the table, some methods have corresponding Rules Engine (RE) actions, while others do not. In either case, all methods can be called directly on the es object added to window. E.g. window.es.minimize() or just es.minimize().

Signature RE Action Description
disconnect() Disconnect an active chat programmatically
getProperties(): {} Get the current properties of Embedded Service. See Property Lifecycle.
hasActiveSession(): boolean Check whether Embedded Service has an active chat session
hide() hideES Hide ES, which has the same effect as es.setView('hidden')
load(properties: {}): Promise loadES Load Embedded service onto the page with a configuration of Properties
maximize() maximizeES Expand ES, which restores the last used maximized view or the mobile view if at a mobile screen size
minimize() minimizeES Minimize ES, which has the same effect as es.setView('minimized')
off(eventType?: string, handler?: Function) Unsubscribe from one or more ES events. See Outer Events.
on(eventType: string, handler: Function) Subscribe to an ES event. See Outer Events.
setView(view: string) Set the view of ES. See Views.
show() showES Show ES, which restores the last used non-hidden view.
unload(): Promise Remove Embedded Service and all its artifacts from the page. If you plan to load ES again, it is recommended to use hide and show instead as they are more performant.
update(properties: {}) updateES Update Embedded Service with one or more updateable Properties, where only the properties changing need to be specified

Outer Events

For use in the Rules Engine, see Embedded Service events in the RE docs.

For direct use of the ES SDK, use the es.on and es.off methods to subscribe and unsubscribe custom event handlers. E.g.

// Attach multiple handlers to the same event
const handler1 = () => console.log(`Handler 1`);
const handler2 = () => console.log(`Handler 2`);
es.on('load', handler1);
es.on('load', handler2);

// Unsubscribe one handler at a time
es.off('load', handler1);
es.off('load', handler2);

// Unsubscribe all handlers for a specific event
es.off('load');

// Unsubscribe all handlers across all events
es.off();

Event Types

Embedded Service fires the following public events to the host page.

agentAvailability

When Polling is enabled, the agentAvailability event fires every 12 seconds with the following payload in the event detail:

{
  available: boolean,
}
agentJoin

Fires when an agent joins the chat with the following payload in the event detail:

{
  name?: string,
  role?: string,
  type: AgentType,
}
chatConnect

Fires when a chat is first connected.

chatDisconnect

Fires when a chat is disconnected.

Outer linkAction

When the linksMode property is set to its default value of dynamicLinks, ES will process Fusion Dynamic Links (and other links) in agent chat messages and fire linkAction events when they are clicked. By default, ES will handle these events by firing an inner linkAction event to the ES application, which will open the link in a new tab. However, when subscribing to this outer linkAction event, a custom handler can invoke event.preventDefault() to prevent this default behavior and instead customize what happens when such links are clicked. E.g.

const handler = (event) => {
  event.preventDefault();
  console.log(`linkAction event fired with payload: `, event.detail);
};
es.on('linkAction', handler);

As an example, the DCS Portal reference implementation defines a custom ES linkAction handler to navigate article and SR links to their respective pages within the same tab rather than opening a duplicate Portal in another tab as ES would do by default.

The linkAction event includes the following payload in the event detail:

{
  objectId: string,
  objectType: ObjectType,
  value: string
}
Outer load

Fires when Embedded Service completes loading after a call to the es.load method.

Inner API

The Inner API is a JavaScript API exposed by Embedded Service to the ES Visual Builder application.

Inner Properties

All inner properties (i.e. properties that can be passed to the inner load method) are documented in the Properties section above. In the ES reference implementation, see the call to es.load in the application LoadHandler action chain.

Inner Methods

The embedded part of the ES SDK includes the oj-dcs-es resource component, which exposes methods to the Embedded Service application. In various actions chains, you'll see this library injected as oj-dcs/es/es into a local es object from which the inner methods are called. See the table below for some example methods, though the list is not exhaustive.

Type Method Description
lifecycle initialize See initialize
lifecycle load Configure Embedded Service from the application, which is the second half of the loading process initiated by the host page. It takes an object of inner properties and returns a Promise that resolves with the merged properties when the load finishes.
lifecycle unload Remove Embedded Service entirely from the host page. By default, this is only done when the security checks fail on load.
chat startChat Initialize and connect a chat using hidden form fields set by application code and optionally visible fields submitted by the end user.
chat endChat Disconnect a chat, generally when the end user clicks the disconnect button.
chat hasChatInSession Will return true if there is a currently active chat or if persistence is enabled and the page was refreshed or navigated without disconnecting an active chat.
launchForm reloadEsFormFieldsFromFormData Save form field values to be reused across chats.
launchForm saveFormData Save the form data from the chat launch form everytime the form changes.
launchForm updateChatLaunchFromContext Update the chat launch form fields from the outer context property on load.
launchForm updateChatLaunchFromFormDataAndContext Update the chat launch form fields on update.
misc setView Change the view of Embedded service on the host page (see Views).

See the reference implemention code for the full method signatures and default implementation details. Search for es.<MethodName> (e.g. es.initialize) to find where a method is called.

initialize

The initialize method is called at the beginning of the application lifecycle and passes various options required to set up Embedded Service. It takes a single object parameter with the following customizable properties:

Property Type Default Description
secureEs boolean true Do not load ES unless in a valid ES context, which should be true for production. Optionally set to false in development to support the Visual Builder preview feature in order to quickly iterate the ES application in isolation (i.e. with default outer properties)

All other properties passed in the reference implementation are required for setting up ES and are not customizable. While most are simply VB libraries and variables used internally by the ES SDK, the following may benefit from further explanation:

Inner Events

The following inner events are raised by the ES SDK and should be handled by the application code.

Inner agentAvailability

Same as the outer agentAvailability event, except fired into the VB application for the default Polling behavior.

chatState

Fires when the internal chat client needs to communicate a change of chat state to the application. Includes the following payload in the event detail:

{
  chatState: ChatState
}

disconnect

Fires when the outer disconnect method is called.

Inner linkAction

Fires when an end user clicks a link in an agent message and a custom handler does not prevent the default behavior.

See the outer linkAction event for more.

Inner load

Fires when the load outer method is called and includes the following payload in the event detail:

{
  props: OuterProperties
}

update

Fires when the update outer method is invoked and includes the following payload in the event detail:

{
  old: MergedProperties,
  props: MergedProperties,
  updated: OuterProperties
}

viewChanged

Fires anytime the ES view changes with the following payload in the event detail:

{
  view: EsView | string
}

Survey

The ES reference implementation is preconfigured to offer an optional survey after a chat. Though at the moment surveys are only available for authenticated users. The following application variables control the default behavior:

Variable Default Description
surveyIdLiveAgent empty The id of the survey to offer after a chat with a live agent.
surveyIdBot empty The id of the survey to offer after a chat with a bot.
surveyMinimumTurns 1 The minimum number of agent messages required in order to offer a survey. Set it to 0 to always offer one.

Since surveyIdLiveAgent and surveyIdBot are both empty by default, no survey will appear out of the box. To have a survey appear for chats with live agents but not bots (or vice versa), set one variable and leave the other empty.

The survey loads in the background when the surveyMinimumTurns threshold is met based on the type of agent connected at that time. If a chat is later transferred from a bot to a live agent (or vice versa), the survey offered might not match the type of agent when the chat was disconnected.

See Variables to set any of these survey application variables at runtime.

Theming

Theming is the process of changing the look and feel of Embedded Service. In general, this is done to match the host page, whether that's the DCS Portal or any other website using ES.

The following layers all work together to theme ES:

  1. The JET Theme
  2. Application CSS variables
  3. Application Styling
  4. Applicable Properties

Chat Launch Form

The chat launch form can be configured to pass information via fields when initiating a chat. Fields can be standard or custom, visible or hidden, preloaded with default values and even updated with new values at runtime via the outer context property. Visible fields appear in the pre chat form for an end user to set while hidden fields are passed behind the scenes. If no visible fields are configured, the chat will start automatically without user input and pass any hidden fields specified.

In the reference implemenation, the chat launch form fields are configured in the chatLaunchFormFields application variable, which is an array of field objects. By default it has the following configuration, where all fields are required. Note that the FirstName, LastName and Email fields will be automatically hidden and set based on the authenticated user (from VB's $application.user object) when a user is logged in.

[
  {
    "enabled": "enabled",
    "name": "FirstName",
    "required": true
  },
  {
    "enabled": "enabled",
    "name": "LastName",
    "required": true
  },
  {
    "enabled": "enabled",
    "name": "Email",
    "required": true
  },
  {
    "enabled": "enabled",
    "name": "Title",
    "required": true
  }
]

See Field Dependencies for an example chatLaunchFormFields configuration with custom fields.

Field Properties

Different fields support a subset of the properties in the table below, where the Scope column is one the following values and indicates which fields support it:

Field Scope Type Default Description
dependency visible object Optional dependency on another field. See Field Dependencies.
displayType choiceList string singleSelect Specify 'singleSelect' for a dropdown menu and 'radioButtons' for a radio button set.
enabled all string Required. Specify 'enabled' for a visible field and 'hidden' for a hidden field.
invalidMessage visible string The message to show if the field value does not match the pattern property.
label visible string Recommended for visible custom fields, else the field name will be used and a warning logged. For a translatable label, add a custom string to the app-strings.json bundle with a chatLaunch_ prefix (e.g. "chatLaunch_myCustomFieldLabel": "My Field Label") and then specify the field label with a # prefix rather than chatLaunch_ (e.g. #myCustomFieldLabel). If translations are not required, you may also specify a plain string (e.g. My Label), though this is not recommended. Standard field labels will use the applicable string with a chatLaunch_ prefix from the app bundle.
listOfValues choiceList array An array of choiceListValue objects of type { enabled: string, label: string, value: any }. Required for custom choiceList fields.
maxLength text, longText number Maximum number of characters allowed in text and longText fields. Defaults to no limit.
name all string Required. One of the Standard Field names or a custom field name.
pattern text string Optionally validate standard or custom fields of type text with a regular expression pattern to determine if the value of the field is valid. E.g. '[a-zA-Z]{1,15}'.
required visible boolean false Is the field required?
rows longText number 10 Number of rows to display for standard or custom fields of type longtext.
type custom string Required for custom fields. See Field Types.
value all mixed The default value of the field. For visible fields this is the initial value the end user can change, whereas for hidden fields it is the fixed value. For the format of the value, see the Type column in Standard Fields or Field Types for custom fields.

Standard Fields

The following standard fields are supported.

Name Field Type Value Type Notes
ApplicationClassification text string
AssigneeId text string
Category category selector number
ChatPriority text string
ContactId text string
Description longText string Sent as the first user message after an agent joins the chat.
Email email string
FirstName text string
IncidentSeverityCode text string
LastName text string
OrganizationId number number
Product product selector object An object of type { inventoryItemId?: number, productGroupId?: number } for visible product fields and { inventoryItemId?: number, inventoryOrgId?: number, productGroupId?: number } for hidden product fields, where 0 values may be used to indicate a property is unset.
QueueId number number
ServiceRequestNumber text string
Title text string
StripeCode text string

Notes

Field Types

For custom fields, the type property can be any of the following field types, which match Fusion custom field types. To preload a custom field with a default value, specify a value property in the format of the Default Value Format column.

Field Type Value Type Default Value Format
checkbox boolean true to check the box by default
choiceList string A valid value of an item in the required listOfValues property
date string A date with format 2016-09-18 or 2016
dateTime string A dateTime with format 2016-09-18T17:34:02-07:00
email string A valid email address
longText string
number number
phone string
percentage number A decimal between 0.00 and 1.00, which maps to 0-100%
text string

See Field Dependencies for an example chatLaunchFormFields configuration with custom fields.

Field Dependencies

Fields can be configured to show and hide based on the value of another field using the optional dependency property. Here is an example value of chatLaunchFormFields where the custom_flavor field will only appear when Ice cream is selected in the custom_dessert field.

[
  {
    "enabled": "enabled",
    "label": "What is your favorite dessert?",
    "listOfValues": [
      {
        "label": "Ice cream",
        "value": "1"
      },
      {
        "label": "Brownies",
        "value": "2"
      }
    ],
    "name": "custom_dessert",
    "type": "choiceList"
  },
  {
    "dependency": {
      "action": "show",
      "fieldName": "custom_dessert",
      "values": ["1"]
    },
    "enabled": "enabled",
    "name": "custom_flavor",
    "label": "What is your favorite ice cream flavor?",
    "type": "text"
  }
]

The dependency property is an object with the following fields:

Property Default Description
action Required. Specify show or hide to show or hide this field when the dependency matches an item in values.
enableRegExp false When set to true the expected values are regular expressions. Defaults to false.
fieldName The name of the field this field depends on.
values An array of values or regular expressions. When the dependent field matches one of these, the action on this field is triggered.

Upgrade

25D to 26B

Until version 25D, Embedded Service was a pre-packaged application configured primarily by external properties. As of 26A, the formerly internal ES Visual Builder application is now offered as a template (or reference implementation), allowing for more flexibility and code level customization. In this transition, many of the properties supported in versions 25D and earlier were removed. As some were added back in 26B, it is recommended to skip 26A and migrate directly from 25D (or earlier) to 26B.

See below for a list of 25D properties and their level of support in 26B.

25D property In 26B? Notes
businessUnitId Same See Properties.
chat Partial Properties linksMode, polling and pollingDetails are supported as before. All others were removed. See chat for more.
context Expanded The same 25D context properties are supported, as well as all other standard and custom fields. See context for more.
css Different The 25D properties, iframeCss and iframeStylesheetUrl, are no longer supported, as the template provides direct access to the application CSS. However, there are new properties for inheriting CSS variables from the host page. See Theming for more.
drag Same See drag.
i18n Different The i18n property was removed as well as many of the 25D strings. All current strings are now defined in the app bundle and can be overridden via the new strings property, though only in the current locale. See strings for more.
icons Partial Only the launch icon is supported in 26B, while all others were removed. The remaining icons left in 26B can be set directly in the application code.
id Removed
knowledge Removed
locale Same See Properties.
mode Different The mode property was removed, though more control is now possible with the new view property. See Views for more.
modeOptions Removed While modeOptions was removed, similar functionality is available in the Polling feature.
screen Removed Removed as pages are now controlled exclusively in the VB app, though the 26B reference implementation contains only a single chat page.
screens Removed Removed entirely as page layouts are now controlled in the VB app. For customizing the chat launch form, formerly configured under screens.chat.components[0].launchFormFields, see Chat Launch Form.
styles Partial While many style variables were removed, those related to the launchButton and widget elements on the host page were retained. They are still organized by views and, in fact, custom views are now supported. See Views and Styles for more.
usageCode Same See Properties.
user Removed
vbUrl Different The vbUrl property has been replaced by the appUrl property. See Properties.
wcfs Partial While most WCFS properties are still supported, WCFS strings must now be set in the app bundle or via strings, rather than the 25D wcfs.i18n property. See WCFS for more.