適用於 Dynamics 365 管道整合架構 2.0 的 notifyEvent (JavaScript API 參考)

顯示可用於通知客服專員傳入對話的通知。

語法

Microsoft.CIFramework.notifyEvent(input, correlationId, cancellationToken).then(successCallback, errorCallback);

參數

名稱 類型 為必填項目 Description
輸入 JSON 物件 Yes 繩子
correlationId GUID 否 用來將所有相關的 API 呼叫分組在一起,以進行診斷遙測。
取消權杖 繩子 否 是方法用 cancelEvent 來取消傳入交談通知的唯一字串。
successCallback 回調 功能 否 請求成功時要呼叫的函式。 回呼成功後,回應物件將包含客戶是否接受或拒絕交談的相關資訊。
errorCallback 回調 功能 否 請求失敗時要呼叫的函數。

回呼函式詳細資料

下列物件會傳遞至 and successCallbackerrorCallback 函數。

successCallback 函式

範例 JSON 物件:

{
	"value": {"actionName" : "Accept",
     "responseReason" : "Accept"}
}

參數

actionName 回應原因 Description
接受 接受 當使用者接受通知時
接受 自動接受 依預設,會透過通知範本接受通知
拒絕 拒絕dByAgent 當使用者拒絕通知時
拒絕 NotificationQueueLimit超出 如果限制超過佇列中的十個通知,則會拒絕通知
拒絕 NotificationQueueTimeLimit超出 當佇列中的通知超過設定的逾時期間時
暫停 顯示逾時 當使用者在逾時期間內未回應通知時

errorCallback 函數

範例 JSON 物件:

{
	"message" : "<error details>",
	"msdyn_name" : "NotifyEvent"
}

參數

訊息 Description
NotificationTemplateNotFoundError 找不到指定的範本名稱時
RejectAfterClientError 發生未知例外狀況(當Platform API呼叫失敗或遺漏某些輸入引數時發生)

Example

var canceltoken = "cancellationtoken"+ Math.ceil(Math.random() * 100000 + 100000).toString();

 

var input = {
                templateName: "msdyn_chat_incoming_unauthenticated",
                // unique name of the configured template
                templateParameters: {
                },
// unique random token, to identify the notification during cancelEvent call
                cancellationToken: canceltoken
}
Microsoft.CIFramework.notifyEvent(input).then(
                function success(result) {
                                console.log(result);
                                // Perform operations
                },
                function (error) {
                                console.log(error.message);
                                // Handle error conditions
                }
);