utilAPI
This object contains utility-related APIs.
This method hides the chat button.
By default, the chat button is always shown if no business hours are specified. If business hours are specified, the chat button is shown during business hours and hidden outside of business hours. To learn how to configure business hours, see Set Business Hours in Enhanced Chat.
This command can override the default behavior.
You can't hide the chat button if the chat window is already showing. Also, this method doesn’t have session continuity. For example, after a refresh, the button returns to its initial state. If business hours are specified, this call overrides the current visibility only until the next business hours interval.
None.
This method shows the chat button.
By default, the chat button is always shown if no business hours are specified. If business hours are specified, the chat button is shown during business hours and hidden outside of business hours. To learn how to configure business hours, see Set Business Hours in Enhanced Chat.
This command can override the default behavior.
This method doesn’t have session continuity. For example, after a refresh, the button returns to its initial state. Also, if business hours are specified, this call overrides the current visibility only until the next business hours interval.
None.
This API launches the web chat client with the messaging conversation window maximized. See Launch Chat.
None.
Use the event handlers of this method to perform actions after the chat client launches.
| Event Handler | Description |
|---|---|
| then | Runs actions if the web chat client launches successfully. |
| catch | Runs actions when the web chat client launch fails. |
| finally | Runs actions after the chat client launches successfully or not. |
This method returns a Promise object.
This method removes all Enhanced Web Chat components from a page on your website. Call the clearSession method first to completely clean up both authenticated and unauthenticated conversations.
None.
The setSessionContext method is only available through Enhanced Web Chat v2 deployments. For more information, see Enhanced Chat in Salesforce Help.
This method enables you to pass information like the current page or a recent search to the agent.
The top-level object defines a single piece of contextual information. Read more about creating context variable fields in agent conversations.
| Field Name | Type | Description |
|---|---|---|
name | String | The name of the context variable. Supported values: _AgentContext: context variable for Enhanced Chat v2. |
value | Value[] | An object containing the value and its data type. See the Value (Parent) object schema for details. |
This object acts as a wrapper, defining the type and containing the payload of the context variable.
| Field Name | Type | Description |
|---|---|---|
valueType | String | The data type of the value field. Supported values: StructuredValue: Indicates the value is a complex JSON object. |
value | Value[] | The payload containing the structured data. See the Value (Child) object schema for a breakdown of the payload. |
This nested object contains the specific, structured data on the user's current context. value must be an object, but there are no required variables.
| Field Name | Type | Description |
|---|---|---|
currentPage | String | Optional. The web page URL of the page the chat user is currently viewing. |
search | Search[] | Optional. An object containing details about a search the user performed. See the Search object schema. |
This object provides details about a user's search activity. All fields are optional and can be populated if the information is available.
| Field Name | Type | Description |
|---|---|---|
result | String | The specific search item the user is currently on. |
filters | Array of Strings | A list of product or category filters applied to the search. |
facets | Array of Strings | The categories or facets the user was browsing or searching within. |