脚本
在 Studio 应用程序中,脚本是一个由多个操作 在 Studio 脚本中执行一个过程,如收集客户数据、播放消息或音乐或将联系人转接给坐席。构成的网络,它们可为联络中心路由和管理客户流量。例如,如果客户呼入联络中心,客户将与呼入电话脚本进行交互,该脚本会根据呼叫者的呼叫原因将呼叫者定向到适当的部门。脚本中的每个动作都有特定的用途。例如:确定技能或变量、播放暂候音乐或传递客户信息。操作通过连接器联系在一起。连接器决定了呼叫者在脚本中导航所用的可能“路径”。有些脚本可能很简单,有些脚本则可能及其复杂。简单脚本可能只包含几个操作以将呼叫者路由到坐席。复杂脚本可能包含多个针对不同语言的分支、许多用于设置和管理变量的操作、对后续脚本的引用等。
开发脚本的基本工作流程始于将操作从“工具”或“框架”选项卡拖放到画布上。然后,连接动作以确定交互流的可能路径。创建动作网络后,您可以通过添加其他参数、自定义编程逻辑或上传要播放的提示来配置每个动作。
在所有脚本处理中,大部分都是在 Studio 中执行。CXone 提供了脚本交互的基本方法,例如创建脚本计划表或将脚本还原到先前版本。
脚本编写界面元素
上图显示了 Studio 用户界面的外观。大中心窗格是称为画布的主要工作区。您将在此处放置操作并与其交互以创建脚本。Studio 提供了各种选项卡或窗口,您可以在画布周围的窗格中打开和排列它们。这些选项卡使您可以使用创建和管理脚本所需要的组件。在此图像中,“工具”选项卡显示在右侧窗格中,“导航”选项卡显示在左侧,“脚本错误”选项卡显示在画布下方。您可以单击“工具”和“框架”选项卡(在图像的右侧窗格中)中的操作,然后将其拖动到画布上以构建脚本。请注意,“框架”选项卡必须由内部管理员专门启用。
脚本类型
您可以创建与联络中心中不同渠道相互关联的特定类型的脚本,这些渠道如下所示:
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
通用 | 电子邮件 | 聊天 | 电话 | 语音邮件 | 工作项 | SMS | 数字 |
创建新脚本时,Studio 会提示您确定您希望创建的脚本的类型。您选择的脚本类型必须与你希望实现的路由类型相互关联。尽管大多数动作在任何脚本类型中都会起效,但是有些动作则只能添加到特定脚本中。例如,ASR 允许联系人通过说话、按手机按键或两者的结合来响应录制的语音提示。 操作与电话脚本一起发挥作用。如果您尝试从“框架”选项卡中使用一个操作,但该操作与您正在创建的脚本类型不兼容,则 Studio 会显示错误消息。而且,与特定脚本类型不兼容的操作不会出现在该脚本的“工具”选项卡中。
除了这些主要脚本类型之外,根据您在系统中已启用的功能和应用程序,Studio 还提供了一些脚本模板,例如与 Personal Connection 相关的呼叫抑制脚本。如果您对这些模板具有访问权限,则可以在“创建新脚本”对话框的“可用模板”部分访问它们。

在此脚本中,系统将统计有空坐席的数量。如果该数量为零,则一条消息将随即播放,且系统将断开呼叫。如果有空坐席的数量大于零,则 IVR 自动电话菜单,允许呼叫者通过语音命令、按键输入或两者进行交互,以获得信息、路由呼入的语音呼叫或两者。 菜单将为呼叫者提供用于连接到坐席的选项。在坐席上线之前,音乐会以 30 秒的时间间隔播放。同样,在这些操作中,大多数都可以在任何脚本类型中使用,但 Hangup 操作特定于电话脚本。

连接器和分支
连接器
连接器是 2 个操作之间的单独连接。它显示为一个箭头,并确定联系的可能移动以及跟随该连接器的联系的条件。单击操作的右下角,然后将连接器拖放到流程中的下一个操作,即可连接 2 个操作。To help keep your script clean and organized, you can bend connectors by:
- Pressing and holding CTRL and SHIFT on your keyboard.
- Hovering over the connector so that it turns blue.
- Rightvclicking on the connector to place a green box (which will be a pivot point).
- Left clicking the green box and maneuvering the connector as desired.
分支
分支是将脚本划分成 2 个或更多细分的路径,这些细分以单个连接器开始。许多动作都包含默认分支选项供您配置(例如 Default 或 OnError),但您也可以在连接 2 个动作后出现“PickBranch”窗口时创建自定义分支条件(称为“可变分支条件”)。下拉列表中的上图显示了包含以下 3 个分支和连接器的基本示例:信息、计费和技术支持。每个分支的第一个连接器都带有标签,并且还显示了 3 个菜单选项。许多脚本将远比示例中所示更复杂,并具有更多充实的分支。如果分支变得过于复杂和巨大而无法直观地融入 1 个画布,则脚本编写者可以将分支划分成单独的子脚本,然后使用 Runsub 或 Runscript 操作从主脚本中引用子脚本。这是一种上好的方法,可以使您的脚本井然有序,而不是巨大、混乱且容易混淆。
例如,在以下脚本图像中,您可以看到 Yggdrasil 菜单为其他 8 个北欧世界提供了 8 个选项。每个世界都代表脚本的一个不同分支。Heimdallr 是 Asgard Hotline 的脚本编写者。如果他想为每个分支包含更多选项,脚本可能会变得过于复杂。相反,他可以为其他 8 个世界中的每一个都创建一个单独的子脚本。执行此操作后,Heimdallr 将对每一个会在联系人选中时启动单独脚本的菜单选项使用 Runsub 或 Runscript 操作。

复杂:

精简:

脚本错误
“脚本错误”选项卡显示脚本中可能存在的警告和错误。Studio 会在单击“保存”按钮后填充此选项卡。您可以双击此列表中的任何警告或错误,以定向到画布上出现问题的操作。尽管警告不会阻止脚本运行或保存,但是为了避免潜在的问题,最好是在将脚本投入生产之前缓解警告。
出于预防原因,语法和验证错误会阻止您保存脚本。如果检测到这些错误,Studio 会在您尝试保存脚本时显示一个通知窗口。验证错误(例如在 Rest Api 操作中输入的 JSON 无效)可能不会显示在“脚本错误”选项卡中,但您会收到一条包含错误相关技术详细信息的错误通知。如果您尝试保存时出现验证错误,您的脚本可能会还原到该脚本的“上次已知良好”版本,这会导致您丢失上次保存后所做的更改。
以下是阻止脚本保存的问题示例以及示例错误描述:
- 变量拼写不正确(“代码片段第 2 行。函数:NameLabel 尚未定义”)
- 将函数用作方法参数(“未终止的函数参数”)
- 在需要特定数据类型的方法中使用不正确的数据类型(“未终止的函数参数”)
错误也会影响脚本跟踪。如果尝试在未保存的脚本上运行脚本跟踪,则 Studio 会提示您保存该脚本。如果您的脚本中存在错误,则该脚本将不会保存,且您可能会丢失验证错误所引起的更改。虽然跟踪将运行,但它仅会在脚本的上次保存版本上运行。
脚本 API
对于更高级的脚本开发人员,您可以通过编程方式打开和保存脚本,为自动化开发过程提供辅助。展开以下下拉列表以查看每个 API 的基本详细信息。

使用 v17 或更早版本的 GET /scripts 以获取
总结:按 Name 或 masterId 返回脚本的 XML。
描述:此方法将按 Name 或 masterId 返回脚本的 XML。
参数:
- name: scriptPath
in: path
description: full path of script
required: true
style: simple
explode: false
schema:
type: string
- name: scriptId
in: path
description: master id of a script
required: true
style: simple
explode: false
schema:
type: integer
响应:
'200':
description: SUCCESS
content:
application/json:
schema:
type: object
properties:
name:
type: string
description: Name of a script
filePath:
type: string
description: file path
ScriptId:
type: integer
description: MasterId
body:
type: string
description: XML of a Script
'400': description: Invalid params
'404': description: Not found
'500': description: Internal error
'501': description: Incontrol.Net Service Internal Error

总结:保存新脚本或现有脚本。
描述:此方法会使用 base64 字符串将脚本保存到数据库中。
参数:
- name: scriptPath
in: path
description: full path and the name of the Script
required: true
style: simple
explode: false
schema:
type: string
- name: body
in: path
description: 'body of the Script, this is a XML encoded in base64'
required: true
style: simple
explode: false
schema:
type: string
响应:
'200':
description: Success
content:
application/json:
schema:
SaveScript:
type: object
properties:
ScriptId:
type: string
description: The new ScriptId generated after the save was successful
'400': description: Invalid Parameters
'405': description: Locked by someone else
'500': description: Internal Error
'501': description: Service Internal Error

总结:保存新脚本或现有脚本。
描述:此方法会使用 base64 字符串将脚本保存到数据库中。
参数:
- name: scriptPath
in: path
description: full path and the name of the Script
required: true
style: simple
explode: false
schema:
type: string
- name: body
in: path
description: 'body of the Script, this is a XML encoded in base64'
required: true
style: simple
explode: false
schema:
type: string
响应:
'200':
description: Success
content:
application/json:
schema:
type: object
properties:
ScriptId:
type: string
description: The new ScriptId generated after the save was successful
'400': description: Invalid Parameters
'405': description: Locked by someone else
'500': description: Internal Error
'501': description: Service Internal Error

总结:启动已锁定的脚本。
描述:此方法将强制解锁脚本。
参数:
- name: scriptPath
in: path
description: full path of script
required: true
style: simple
explode: false
schema:
type: string
响应:
'200': description: Success
type: object
properties:
type: string
description: Request Date
ErrorMessage:
type: string
description: Error Message from Service
ErrorState:
type: boolean
description: Error state
KickResult:
type: string
description: Result of service
MasterID:
type: integer
description: Master ID of Script
CurrLockedBy:
type: integer
description: ID of kicked User
'400': description: Invalid Parameters, Script Already Unlocked, You Cannot Kick Yourself From Script
'404': description: ScriptNotFound
'500': description: Internal Error
'501': description: Service Internal Error

总结:返回脚本的历史记录。
描述:此方法将按名称返回脚本的历史记录。
参数:
- name: scriptPath
in: path
description: full path of script
required: true
style: simple
explode: false
schema:
type: string
响应:
'200':
description: SUCCESS
content:
application/json:
schema:
HistoryScripts:
type: object
properties:
name:
type: string
description: full path of a script joined with the name
versions:
type: array
Items:
HistoryScripts_versions:
type: object
properties:
scriptId:
type: integer
description: Master ID of script
modifyDate:
type: string
description: Modify date
modifyUser:
type: string
description: Modify user
Status:
type: string
description: Status of a script
'400': description: Invalid params
'404': description: Not found
'500': description: Internal error
'501': description: Incontrol.Net Service Internal Error

get:
tags:
总结:搜索脚本。
描述:此方法将根据关键字在业务单位中搜索脚本。
参数:
name: mediaType
in: query
description: Media type of the script.
required: false
explode: false
schema:
type: integer
name: scriptName
in: path
description: keyword for search
required: true
style: simple
explode: false
schema:
type: string
name: includeInactive
in: query
description: This variable is used to include the search among the inactive scripts.
required: false
explode: false
schema:
type: boolean
name: includeTrusted
in: query
description: This variable is used to include the search among trusted business units
required: false
explode: false
schema:
type: string
name: modEndDate
in: query
description: This variable is used to include the search in an established range of dates
required: false
explode: false
schema:
type: string
响应:
'200':
description: SUCCESS
content:
application/json:
schema:
$ref: '#/components/schemasSearchScript'
'400':
description: Invalid params
'401':
description: Unautohrized.You do not have sufficient permissions
'404':
description: Script path not found
'500':
description: Internal error
'501':
description: Incontrol.Net service internal error
组件:
schemas:
GetScript:
type: object
properties:
name:
type: string
description: 'Name of the script'
filePath:
type: string
description: 'Full script path'
scriptId:
type: integer
description: 'This is the script identifier, it is unique'
body:
type: string
description: 'Script content encoded in Base63 format'
DeleteScript:
type: object
properties:
scriptPath:
type: string
description: 'Information of the full path script name that was removed'
deleted:
type: boolean
description: 'Status of the script'
error:
type: string
description: 'If an error occurs in the deletion process'
SearchScript:
type: object
properties:
type: integer
description: 'Information of the business unit'
scriptName:
type: string
description: 'Full script path'
scriptSearchDetails:
type: array
description: 'Detail of the search result'
items:
$ref: '#/components/schemas/SearchScript_Details'
SearchScript_Details:
type: object
properties:
busNo:
type: integer
description: 'Business unit number'
masterID:
type: string
description: 'Script identifier'
scriptName:
type: string
description: 'Name of the script'
status:
type: string
description: 'Status of the script active/inactive'
mediaType:
type: integer
description: 'Media type number'
modifyDate:
type: string
description: 'The date of the last modification
mUser:
type: integer
description: 'The last user who has modified the script'
actionID:
type: integer
description: 'Action identifier'
脚本编写提示和技巧
- 重命名动作中的标题可以使脚本更易于阅读和遵循。在属性对话框中编辑操作的标题。
- 当您使用 Menu(或类似操作)时,请使用连接回 Menu 操作的 Loop 和 Noresponse 操作创建一个分支,以复现菜单选项。
-
在 Music 操作之后添加 Wait 操作,以重播音乐(否则音频将播放 30 秒,然后结束)。
- 确保您没有遇到尽头。尽头可能是一些问题,例如:菜单中分支缺失、菜单分支未配置或(如上一项中所示)Music 操作之后无 Wait 操作。
- 创建菜单时,最好是先命名部门名称,然后再命名要拨打/通话的号码。联系人通常会先听取部门名称,然后再听取号码。
- 使用 Annotation 操作可在整个脚本中添加备注或说明。
- 使用脚本的名称作为 Begin 操作标题。
- 对于 Play 和 Menu 操作,请双击操作并在短语字段中批注提示的措辞。
- 右键单击“浏览”选项卡(视图 > 浏览器)中的脚本,然后将鼠标悬停在历史记录选项上,以查看脚本的历史记录。这使您可以查看脚本的先前迭代。