getContextProvider

La Plataforma omnicanal para Customer Service ofrece un conjunto de funciones que extienden la potencia de Dynamics 365 Customer Service Enterprise con el que las organizaciones pueden conectarse e interactuar de forma instantánea con sus clientes en distintos canales de mensajería digital. Se necesitan una licencia adicional para acceder a la Plataforma omnicanal para Customer Service. Para más información, consulte las páginas Descripción general de precios de Dynamics 365 Customer Service y Plan de precios de Dynamics 365 Customer Service.

Recupera el proveedor de contexto personalizado establecido actualmente, si lo hay.

Nota:

Los métodos del SDK de chat en vivo deben invocarse después de que se genere el evento lcw:ready . Puede escuchar este evento agregando su propio detector de eventos en el objeto window.

Syntax

Microsoft.Omnichannel.LiveChatWidget.SDK.getContextProvider();

Parámetros

Ninguno

Valor devuelto

Devuelve el proveedor de contexto personalizado establecido actualmente, si lo hay. Si no hay ningún proveedor de contexto personalizado registrado, devuelve null.

Example

window.addEventListener("lcw:ready", function handleLivechatReadyEvent(){
   // Setting the custom context provider
   // Throws error if contextProvider is not a function
   Microsoft.Omnichannel.LiveChatWidget.SDK.setContextProvider(function contextProvider(){
      // Here it is assumed that the corresponding work stream would have context variables with logical name of 'contextKey1', 'contextKey2', 'contextKey3'.
      return {
                 'contextKey1': 'contextValue1', // string value
                 'contextKey2': 12.34, // number value
                 'contextKey3': true // boolean value
      };
   });

   // Retrieves the currently set custom context provider
   // If there is no registered custom context provider, then it returns null
   let registeredContextProvider = Microsoft.Omnichannel.LiveChatWidget.SDK.getContextProvider();
});

-->

Referencia de la API de JavaScript para el SDK de chat en vivo