Set Up Scripting in Creador de bots CXone
With script integrations, you can write custom JavaScript to tell your bot Una aplicación de software que maneja las interacciones del cliente en lugar de un agente humano en vivo. 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 Almacén de habilidades. The Almacén de habilidades by default also contains a skill with a script in it that you can use to integrate with Feedback Management.
Because Creador de bots scripts operate on the server, there are some limitations to consider while building your scripts.
Configure New Scripts
-
En CXone, haga clic en el selector de aplicaciones
y seleccioneCreador de bots.
- Click the bot you want to work with.
- Click Integrations
in the left icon menu.
- Click the Scripts tab, then click New Integration.
- Click the title to rename the integration.
- Under Actions, click New Action.
- Type a name for the action and press Enter.
- Click the action to configure it.
- 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.
- When you're done configuring your action, go back to the main page for your integration.
- Ensure the action toggle is turned on. If the toggle is off, the action will not be available to use.
- Add your action to a story
Se utiliza para entrenar al bot para el manejo de interacciones según la intención y el contexto, rule
Se usa para definir la respuesta del bot a los mensajes que no cambian con el contexto., or fallback. The Scripts tab of the bot action options will show all the script integration actions you have configured and turned on.
- 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
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.
-
En CXone, haga clic en el selector de aplicaciones
y seleccioneCreador de bots.
- Click the bot you want to work with.
- Click Integrations
in the left icon menu.
- On the Scripts tab, click the script integration you want to add variables to.
- Under Variables, click New Action.
- Enter a name and press Enter.
- Click the variable in the list to expand its properties.
- 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. Creador de bots 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.
- 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.
- Use your variable in a custom bot action script.
- Click Train and Stage to train your bot on the new variables.
Set Up Variables to Be Editable
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.
-
En CXone, haga clic en el selector de aplicaciones
y seleccioneCreador de bots.
- Click the bot you want to work with.
- Click Integrations
in the left icon menu.
- On the Scripts tab, select an integration.
- Under Actions, click an action on the script integration page to expand its properties.
- 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.
- Specify the value of the variable when you use the selected custom action in a story, rule, or fallback.