Live chat SDK JavaScript API 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 perform various operations with the live chat widget of Omnichannel for Customer Service.

Methods

Method Description
setContextProvider Sets the context provider. 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.
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.

Events

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

See also

Omnichannel for Customer Service for developers