Live chat SDK Reference
Omnichannel for Customer Service offers a suite of capabilities that extend the power of Dynamics 365 Customer Service Enterprise to enable organizations to instantly connect and engage with their customers across digital messaging channels. An additional license is required to access Omnichannel for Customer Service. For more information, see the Dynamics 365 Customer Service pricing overview and Dynamics 365 Customer Service pricing plan pages.
The following JavaScript methods can be used to do various operations with the live chat widget of Omnichannel for Customer Service.
Methods
Method | Description |
---|---|
setContextProvider |
Sets the context provider for live chat channels. The context provider function, when invoked, returns the context to be used for initializing a chat session. |
getContextProvider |
Retrieves the currently set custom context provider, if any. |
removeContextProvider |
Removes the currently set custom context provider, if any. |
setAuthTokenProvider |
Sets the authentication token provider. |
getAuthTokenProvider |
Gets the currently set authentication token provider, if any. |
removeAuthTokenProvider |
Removes the currently set authentication token provider, if any. |
startChat |
Opens an existing chat, if any. Otherwise, it initiates a new chat. You can use the customContext parameter in the method to directly pass the context to initialize the chat session |
startProactiveChat |
Enables organizations to engage users by automatically inviting them to a chat conversation based on the configured rules. |
closeChat |
Ends the conversation between the agent and customer. Any browser cache related to the conversation is also deleted. |
getAgentAvailability |
Retrieves the agent availability for a queue based on the routing rules. The omnichannel developer can use this API to determine whether the start conversation option should be visible to the customer and also for displaying information such as wait time and position in queues. |
Events
Event | Description |
---|---|
lcw:ready |
This event is raised when the live chat SDK is ready to use. |
lcw:error |
This event is raised in case an error occurs during the lifetime of a chat.For information about error codes and error messages, see the Error code reference for Omnichannel for Customer Service. |
lcw:startChat |
This event is triggered when a chat is started. |
lcw:closeChat |
This event is triggered when a chat is closed. |
lcw:chatQueued |
This event is raised when the chat conversation is created and started. |
lcw:chatRetrieved |
This event is raised when the system retrieves an ongoing chat conversation from cache after a page is reloaded or opened on another tab. |
lcw:onClose |
This event is triggered when the customer engaged on the chat widget closes the widget. |
lcw:onMinimize |
This event is triggered when the customer engaged on the chat widget minimizes the widget. |
lcw:onMaximize |
This event is triggered when the customer engaged on the chat widget maximizes the widget. |
lcw:onMessageReceived |
This event is triggered when the chat widget gets a new message. |
lcw:onMessageSent |
This event is triggered when a customer engaged on the chat widget sends a new message. |
lcw:threadUpdate |
This event is raised by live chat when an agent ends a conversation. |
lcw:getAgentAvailability |
This event is raised when the getAgentAvailability method returns a successful response. |