Set Up Scripting in CXone 机器人生成器

With script integrations, you can write custom JavaScript to tell your bot关闭 代替现场人工坐席处理客户交互的软件应用程序。 how to respond in conversations. You can write code to perform bot actions or to call your own external APIs. After creating a script, you can insert it into conversations as a bot action to teach your bot when to use it.

You can add scripts to Bot Skills and publish them in the 技能商店. The 技能商店 by default also contains a skill with a script in it that you can use to integrate with Feedback Management.

Because 机器人生成器 scripts operate on the server, there are some limitations to consider while building your scripts.

Configure New Scripts

  1. CXone 中单击应用程序选择器 并选择机器人生成器.

  2. Click the bot you want to work with.
  3. Click Integrations icon, which looks like a plug. in the left icon menu.
  4. Click the Scripts tab, then click New Integration.
  5. Click the title to rename the integration.
  6. Under Actions, click New Action.
  7. Type a name for the action and press Enter.
  8. Click the action to configure it.
  9. Replace the default Hello World code with your custom JavaScript. Keep all code within the provided main function. You can structure other functions within main if needed. Code outside of a function will not be executed.
  10. When you're done configuring your action, go back to the main page for your integration.
  11. Ensure the action toggle is turned on. If the toggle is off, the action will not be available to use.
  12. Add your action to a story关闭 用于训练机器人根据意图和上下文进行交互处理, rule关闭 用于定义机器人对不随上下文变化的消息的响应。, or fallback. The Scripts tab of the bot action options will show all the script integration actions you have configured and turned on.
  13. Click Train and Stage to train your bot on the new integration. You can also do more training and testing later.

Create Variables to Use in Scripts

Required permissionChatbot (ACD > Digital Experience > Roles > [choose one] > Core Modules)

The variables you create can only be used in the script integration where you create them. They cannot be used in other script integrations, even in the same bot.

  1. CXone 中单击应用程序选择器 并选择机器人生成器.

  2. Click the bot you want to work with.
  3. Click Integrations icon, which looks like a plug. in the left icon menu.
  4. On the Scripts tab, click the script integration you want to add variables to.
  5. Under Variables, click New Action.
  6. Enter a name and press Enter.
  7. Click the variable in the list to expand its properties.
  8. Configure the variable:
    • To create a single-value variable: Click Text and enter the Default Value for this variable. If you don't want the variable to have a default value, leave this field empty. You can update the variable value when it's used in a bot action.
    • To create a list of possible values for this variable: Click Select and enter the list of Values separated with a comma ( , ). For example, red,blue,green. Click Default Value and select the value you want to be the default. To remove the default value, hover the cursor over the field and click X.
    • To create a read-only, single-value variable: Click Secret and enter the Value. 机器人生成器 masks all but the first five characters of the value you enter. The value is fully visible if you view the contents of a variable in the console.
  9. Make the variable editable, if you want the value to be able to be changed in bot actions. This is only an option for text and select type variables.
  10. Use your variable in a custom bot action script.
  11. Click Train and Stage to train your bot on the new variables.

Set Up Variables to Be Editable

Required permissionChatbot (ACD > Digital Experience > Roles > [choose one] > Core Modules)

You can make variables editable in a custom bot action so their values can be customized when you add that action to a story, rule, or fallback. When you make a variable editable, it's only editable in the action where you enable that option. Additionally, you cannot make a variable editable for a custom action if its not used in the action's script.

  1. CXone 中单击应用程序选择器 并选择机器人生成器.

  2. Click the bot you want to work with.
  3. Click Integrations icon, which looks like a plug. in the left icon menu.
  4. On the Scripts tab, select an integration.
  5. Under Actions, click an action on the script integration page to expand its properties.
  6. Select one or more variables in the Editable Variables drop-down. Secret variables do not appear in this list. They cannot be made editable. Changes are saved automatically.
  7. Specify the value of the variable when you use the selected custom action in a story, rule, or fallback.