startChat

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.

Opens an existing chat, if any. Otherwise, it initiates a new chat.

Note

Listen to the lcw:ready event raised by a live chat before calling the live chat SDK methods. The live chat methods should be invoked after the lcw:ready event is raised. You can listen for this event by adding your own event listener on the window object.

Syntax

Microsoft.Omnichannel.LiveChatWidget.SDK.startChat({inNewWindow: inNewWindowValue});

Parameters

Parameter Type Required Description
inNewWindow Boolean No Decides whether to open the chat in a new window.

Return value

None

Example

window.addEventListener("lcw:ready", function handleLivechatReadyEvent(){
               // Opens an existing chat, if any. Else initiates a new chat
               Microsoft.Omnichannel.LiveChatWidget.SDK.startChat({inNewWindow: true});
});

See also

setAuthTokenProvider
setContextProvider
JavaScript API reference for live chat SDK