共用方式為


getContextProvider

Customer Service 全通路提供一組展現 Dynamics 365 Customer Service Enterprise 強大威力的功能套件,讓組織可以立即與不同數位傳訊管道中的客戶進行聯繫和互動。 存取 Customer Service 全通路需要額外的授權。 如需詳細資訊,請參閱 Dynamics 365 Customer Service 定價概觀Dynamics 365 Customer Service 定價方案頁面。

擷取目前設定的自訂內容提供者 (如果有的話)。

備註

應該在引發 lcw:ready 事件 之後叫用即時聊天 SDK 方法。 您可以在視窗物件上新增自己的事件接聽程式,以監聽此事件。

語法

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

參數

None

傳回值

傳回目前設定的自訂內容提供者 (如果有的話)。 如果沒有已註冊的自訂內容提供者,則會傳回 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();
});

-->

即時聊天 SDK 的 JavaScript API 參考