Configuration
Description
WebChat and WebChatService share the configuration namespace '_genesys.widgets.webchat'. WebChat has UI options while WebChatService has connection options.
Example
window._genesys.widgets.webchat = { apikey: 'n3eNkgxxxxxxxxxxxx8VA', dataURL: 'https://api.genesyscloud.com/gms-chat/2/chat', enableCustomHeader: true, cometD: { enabled: false, cometURL: 'http://host:port/genesys/cometd', channel: '/service/chatV2/customer-support', apiURL: 'http://host:port/genesys/2/chat-ntf', websocketEnabled: true, logLevel: 'info' }, userData: {}, emojis: true, actionsMenu: true, autoInvite: { enabled: false, timeToInviteSeconds: 10, inviteTimeoutSeconds: 30 }, chatButton: { enabled: true, template: '<div>CHAT NOW</div>', effect: 'fade', openDelay: 1000, effectDuration: 300, hideDuringInvite: true }, async: { enabled: true, getSessionData: function(sessionData, Cookie, CookieOptions) { // Note: You don't have to use Cookies. You can, instead, store in a secured location like a database. Cookie.set('customer-defined-session-cookie', JSON.stringify(sessionData), CookieOptions); }, setSessionData: function(Open, Cookie, CookieOptions) { // Retrieve from your secured location. return Cookie.get('customer-defined-session-cookie'); } } };
Options
Name | Type | Description | Default | Required | Introduced / Updated |
---|---|---|---|---|---|
apikey | string | Apigee Proxy secure token.
Note: This option is only supported in GMS REST mode. |
n/a | Yes, if using Apigee Proxy | |
endpoint | string | Manually select the endpoint to initiate chat on. | n/a | n/a | |
dataURL | string (URL) | URL for GMS REST chat service. If cometD.enabled is set to true, this property will be ignored. | n/a | Always | |
enableCustomHeader | boolean | Enables the use of the custom authorization header defined in _genesys.widgets.main.header static config. Attaches the custom authorization header to all WebChatService request. | false | No | 9.0.002.06 |
cometD | object | Object container for CometD configuration options. | {enabled: false, cometURL: , channel: '/service/chatV2/customer-support', apiURL: , websocketEnabled: true, logLevel: 'info'} | Yes, if using CometD | |
cometD.enabled | boolean | Enables or disables CometD connection method. If set to false or left undefined, WebChatService will connect to REST services through the dataURL specified. | false | Yes, if using CometD | |
cometD.cometURL | string (URL) | URL for GMS CometD connection. cometD.enabled must be set to true for WebChatService to connect to this service. | n/a | Yes, if using CometD | |
cometD.channel | string (path) | CometD channel for receiving chat messages. | '/service/chatV2/customer-support' | Yes, if using CometD | |
cometD.apiURL | string (URL) | URL for additional CometD services such as file upload and download. | n/a | Yes, if using CometD with file uploads | |
cometD.websocketEnabled | boolean | If set to true, CometD will attempt to connect through websockets. If set to false, CometD will only use long-polling. CometD will fallback to long-polling if it can't connect via websockets. | true | n/a | |
cometD.logLevel | string | Sets the log level for the CometD library. Values are 'warn', 'info', or 'debug'. | 'info' | n/a | |
userData | object | Arbitrary attached data to include when initiating a chat. | {} | n/a | |
ajaxTimeout | number | Number of milliseconds to wait before AJAX timeout. | 3000 | n/a | |
xhrFields | object | Allows you to set the properties for the AJAX xhrFields object (for example, {withCredentials: false}).
Note: This option is only supported in GMS REST mode. |
{withCredentials: false} | n/a | |
pollExceptionLimit | number | Number of successive poll exceptions (chat server offline) before WebChatService publishes 'chatServerWentOffline'. | 5 | n/a | |
restoreTimeout | number | Number of milliseconds before restore timeout. Prevents the chat session from restoring after a certain time away from the session (for example, user navigated to a different site during chat and never ended the session). | 60000 | ||
async | object | Object container for Async mode configuration options. | {enabled: false} | No | 9.0.002.06 |
async.enabled | boolean | Enable Asynchronous Chat where a chat session can be active indefinitely. When you close WebChat without ending the chat session, the session will simply go dormant. When you open WebChat again, the session will restore and continue chatting where left off. Currently, Async Chat is supported only in cometD mode and it should be enabled. | false | n/a | 9.0.002.06 |
async.getSessionData | function | A function that you can define to retrieve updated session data from WebChatService plugin. This function is called back when starting a new Async chat session for the first time or when the sessionData changes over the course of an active chat session. This function takes the following arguments - sessionData (current active session data), Cookie (Widgets Internal cookie reference) and CookieOptions (a parameter that is needed when using Widgets Cookie). The purpose of this function is to provide you the active session data so that it can be stored somewhere safe and secure. Later this needs to be provided in the below setSessionData function to restore the chat session. Refer to the example for usage. | none | Yes, when Async WebChat mode is enabled | 9.0.002.06 |
async.setSessionData | function | A function that you can define to return the session data to WebChatService plugin. During initialization, WebChatService plugin will call this function to check if any session data is returned. If found, WebChatService tries to restore the chat session using this session data and open WebChat Widget. WebChatService will also pass the following arguments into this function - Open (WebChat current open state value), Cookie (Widgets Internal cookie reference) and CookieOptions (a parameter that will be needed when using Widgets Cookie). Refer to the example for usage. | none | Yes, when Async WebChat mode is enabled | 9.0.002.06 |
This page was last edited on March 25, 2021, at 19:59.
Comments or questions about this documentation? Contact us for support!