Embedded Service 26A

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 26A" 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.

Outer Properties

All of the following properties are available to the outer load method, while those with a "Yes" in the "Update" column may also be changed after load with the update method. In the Rules Engine, these are available in the loadES and updateES actions, respectively.

Key Default Update Description
appUrl No The only required outer 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 No Business unit id of the Embedded Service application
context Yes Optional context from the host page. See Context for more.
custom 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 run-time behavior. Not to be confused with custom fields supported in the context property and Chat Launch Form.
locale en 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 Style properties to manage the look and feel of the Embedded Service elements on the host page. See Styles for more.
usageCode No Product catalog usage code of the Embedded Service application
view minimized Yes The initial view of Embedded Service on load, or the updated view when used with update. See Views 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 method are merged with the default properties defined within the ES SDK. This combined set of custom and default properties become the initial current properties used by Embedded Service.

When updating outer 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.

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.

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"
    }
  }
}

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, which include customized properties as well as defaults of both outer and inner properties
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 Outer 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 Outer 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.

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 inner 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

The following properties are available in the inner load method for configuring ES from the application code. For properties available as both inner and outer properties, such as styles and view, the outer property takes precedence if specified.

Here are the current defaults in the ES reference implementation:

{
  chat: {
    linksMode: 'dynamicLinks',
  },
  css: {
    cssVariableNamespaces: {
      '--oj-': 'html:root',
      '--custom-': 'html:root'
    }
  },
  drag: {
    launchButtonAxis: 'none'
  },
  icons: {
    launch: ''
  },
  strings: {
    iframeTitle: 'Embedded Service widget',
    launchButtonAriaLabel: 'Help',
    launchButtonLabel: 'Help'
  },
  styles: {
    common: {
      bodyBgColor: 'var(--custom-body-bg-color, var(--oj-body-bg-color, rgb(249, 249, 249)))',
      brandBgColor: 'rgb(var(--custom-brand-bg-color, var(--oj-palette-brand-rgb-100, 90,118,158)))',
      brandTextColor: 'var(--custom-brand-text-color, white)',
      headerHeight: 'var(--custom-header-height, 48px)',
    },
  },
  view: 'minimized',
  wcfs: {
    locale: oj.Config.getLocale(),
    persistence: $application.variables.persistence,
    persistenceTimeout: 300,
  }
}

chat

Chat related properties include:

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

Strings used on the host page include:

By default, these are extracted from matching string keys (but with host_ prefixes) in the app-strings.json bundles of the ES app. All other strings in the ES application are defined in the same bundles but are used directly in the application code.

WCFS

To implement its chat feature, Embedded Service currently uses Web Chat for Service (WCFS) and supports many WCFS settings in its wcfs inner 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.01.0 See Unsupported WCFS Settings
WCFS SDK 26.01.0 See Unsupported WebSDK Settings
ODA WebSDK 25.10 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:

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 methods below are called.

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 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.

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
}

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
}

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 Inner 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 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.