SNIPPET

允許您在您的指令碼中新增自訂代碼。

Dependencies

  • 此動作中的代碼必須用 Snippet 編寫,該語言是由 NICE CXone 開發的內部指令碼設計語言。Studio 技術參考指南 提供了有關 snippet 指令碼的詳細資訊。
  • 動態資料物件的屬性不能被命名為__type (包含兩個底線字元)。該詞保留以用於解析來自動態物件的 JSON。
  • 您可以使用 Snippet 動作進行 API 調用。最大回應大小為 32KB。這與 REST API 動作中的回應大小限制一致。嚴格執行該限制,以防止叢集不穩定和服務中斷。如果可以,請使用REST APIaction代替。此動作具有相同的限制,但可以處理更大的負載。如果必須使用 SNIPPET動作,請按照以下提示減少傳回資料的大小:
    • 篩選 API 回應中的資料。例如,如果您使用NICE報告 API 獲取聯絡人,您可以根據聯絡人的 startDateendDate 篩選結果。此 API 調用還允許您返回和限制項目的最高計數。請參閱指令碼整合附帶的 API 文件,以確定可以使用哪些篩選功能。

    • 更新 API 請求,只返回您需要的資料。例如,如果您使用 NICE報告 API 獲取聯絡人資訊,您可以使用 contactIdagentId 欄位只返回相關資料。請參閱指令碼整合附帶的 API 文件,以確定可以使用哪些資料限制。

    • 如果無法執行前述任一選項,請構建中介軟體。

Supported Script Types

The icon for a Generic script type - a rectangle with < and > symbols inside it.

The icon for the Email script type - a large @ symbol in a diamond.

The icon for the Chat script type - a chat bubble with an ellipsis inside (...), in a diamond shape.

The icon for the Phone script type - an old-style phone handset with curved lines indicating sound coming out of it.

The icon for the Voicemail script type - a symbol that looks like a cassette tape - two circles sitting on a horizontal line.

The icon for the Work Item script type-a piece of paper with one corner folded down and a bullet list on it.

The icon for the SMS script type - a smart phone with a chat bubble coming out of it.

The icon for the Digital script type - a computer monitor with a smartphone next to it.

一般

電郵 聊天 電話 語音郵件 工作項目 SMS 數位

Input Properties

這些屬性定義了動作執行時使用的資料。

屬性

描述

Caption

輸入在指令碼中唯一標識此操作的短語。標題出現在指令碼畫布上的動作圖示下。The default is the action name.

Data

包含在 Snippet Editor 中新增的自訂代碼。這可能包括多個 ASSIGNDYNAMIC 命令、各種流程控制語句以及內置和使用者定義的函數

MaxStringSize

設定 Data 屬性中所有命令的最大字串大小。選項包括:Limit2KLimit4KLimit8KLimit16KLimit32K。此限制適用於與 Rest API 和 SOAP 的整合回應。

Result Branch Conditions

結果分支條件允許您在指令碼中建立分支,以處理執行動作時的不同結果。

條件

描述

Default

指令碼未能滿足需要它採用其中一個分支的條件時採用的路徑。如果沒有定義動作的其他分支,也會採用該路徑。

OnError

動作未能正確執行時採用的路徑。例如,當出現連接不良、語法錯誤等意外問題時。_ERR變數(帶有一個下畫線字元)應填入針對問題的簡要說明。

Tips & Tricks

Snippet Editor Window

The Snippet Editor window opens when you double-click on a Snippet action.

Snippet動作中的Snippet Editor視窗有兩個標籤。這兩個標籤都允許您建立相同類型的代碼。您可以在兩個標籤之間來回切換,並在任一位置編輯代碼。這些標籤是:

  • 文字視圖標籤。這是一個自由格式文字欄位,您可以在此手動鍵入代碼。
  • 樹狀視圖標籤。這是一個圖形介面,您可以用它來構建代碼。此標籤有一個清單,您可以從中選擇關鍵字,為 snippet 新增語句。

Script Example

此範例不是一個完整的指令碼。使用此動作時需要額外的指令碼編寫工作。

In this simple example, the code in the Snippet is used to test whether a prospect can be created using information from a third-party system.

A script with two SNIPPET actions.

Download this script.