Voicebot Exchange

Integrates a self-service virtual agentClosed A software application that handles customer interactions in place of a live human agent. with voice scripts. This action is used in a loop in the script; a script must contain at least two Voicebot Exchange actions. Your virtual agent must support this action.

This action is for complex bots or for when you need to customize the bot's behavior from turn to turn.

Voicebot Exchange monitors the conversation between the contact and the bot turn by turn. It sends each utteranceClosed What a contact says or types. to the bot. The bot analyzes the utterance for intentClosed What the contact wants to communicate or accomplish and context and determines the response to give. The action returns the bot's response to the contact. When the conversation is complete, the action continues the script.

Double-clicking this action opens the CXone Virtual Agent Hub, where you can manage all of your virtual agent bots.

Supported Script Types

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

Related Studio Actions

The Voicebot Conversation action is similar to this action but is only suitable for very simple bots. It doesn't allow for customization of the bot's behavior from turn to turn.

Textbot Conversation and Textbot Exchange are also similar, providing the same functions as Voicebot Conversation and Voicebot Exchange, but for text-based interactions.

Supported Virtual Agents

This action supports the following virtual agents: 

Before you can assign a virtual agent bot to this action, you must add and configure the bot in the CXone Virtual Agent Hub. You only need to add a virtual agent to the Virtual Agent Hub once, then you can assign it to actions as needed. Refer to the topic for the virtual agent you're using for configuration details.

Properties

Some properties require a Snippet action. The Snippet Action Code section on this page has information about the required code. For information about other Snippet code that may be useful, see the Snippet action topic.

Property Details
virtualAgentID Corresponds to the name of the virtual agent selected in the CXone Virtual Agent Hub. See the Supported Virtual Agents section on this page for more information.
customPayload

A generic JSON object that passes data from the script to the bot. It's populated from the Studio script. You can use it to pass information such as the contact's name from the CRM to be used in the Welcome message. You can convert this object using the asjson() method in a Snippet action.

For Amazon Lex bots, this property is required. Use a Snippet action with code from the customPayload snippet. Other bots may benefit from this property and the customPayload snippet.

For Google Dialogflow ES bots, this property is used to pass the context for an intentClosed What the contact wants to communicate or accomplish. For more information about using this property with Google Dialogflow ES, see the Best Practices for Custom Payload with Google Dialogflow ES section in this topic.

For Google Dialogflow CX bots, see the Best Practices for Custom Payload with Google Dialogflow CX section.

Don't use this property if you need to process data that the bot returns to the script. Instead, use the customPayloadVarName (out) variable.

nextPromptSequence

Determines the order in which audio prompts are played by the action. The audio can be pre-recorded or TTSClosed Allows users to enter recorded prompts as text and use a computer-generated voice to speak the content.. You can enter values directly in the field. For example: 

"{promptPath}Prompt1_{lang}.wav" "%{exampleVar}" "{promptPath}Prompt2_{lang}.wav"

You can include different types of information in the prompt sequence. You can:

  • Specify the exact text that you want spoken:

    "%Sales Call"

  • Include a variable that contains the text that you want to be spoken:

    "{AgentWhisper}"

  • Assign a string to a variable with a percent sign:

    AgentWhisper = "%TechnicalSupport"

TTS has a 300 character limit. This property is similar to the Sequence property of the Play action. For voicebots. the sequence can be a mix of TTSClosed Allows users to enter recorded prompts as text and use a computer-generated voice to speak the content. and pre-recorded audio.

nextPromptBehaviors

Specifies the configuration and behavior of the next prompt in a conversation. Define the behaviors you want to see using a Snippet action and following the defaultNextPromptBehaviors Snippet example. This example describes properties you can use to configure comfort noise, DTMF collection, and allowing the contact to speak over audio as it's playing (barge).

Configure the nextPromptBehavior property with the name of the variable from the Snippet action code that passes settings to this property and its action. For example, using the defaultNextPromptBehaviors Snippet code example, you would enter {nextPromptBehaviorsOutjson} for this property.

botSessionState

A unique identifier assigned to a conversation with a bot. This identifier is created when the conversation begins and is passed back as a bot parameter to maintain a session for the current conversation.

automatedIntent

Enter a specific intent by name for the bot to respond to, rather than having the bot interpret collected user input. A common use case for this is to elicit the initial Welcome message from the bot. Welcome is the standard string for initial greetings.

Branches

Branch Details
Default Path taken unless the script meets a condition that requires it to take one of the other branches. It is also taken if the other branches are not defined.
OnPromptAndCollectNextResponse

Path taken if the bot has determined that the interaction should continue and is ready for more human input. Prompts for the next turn in the conversation.

OnError Path taken when there is an unexpected problem (for example, poor connectivity, syntax errors, and so forth). The _ERR variable should be populated with a condensed explanation of the problem.
OnReturnControlToScript

Path taken if the bot indicated that the conversation finished and gives control back to the Studio script to transfer or end the call.

There may be fulfillment data to be processed in the customPayload result.

OnDTMFBreakout

Path taken when a DTMFClosed Signaling tones that are generated when a user presses or taps a key on their telephone keypad. rule in the script was met.

OnUserInputTimeout

Path taken when there is no response by the user in the time specified in the Default Next Prompt Behavior Snippet action. See the script example in this topic or Virtual Agent Hub for more information on the snippets required to set up a bot in Studio.

OnUserInputNotUnderstood

Path taken when the user's intent is not matched by the bot. The Default Fallback Intent property is used for Google Dialogflow ES when the intent is not matched.

Output Variables

Variable Details
nextPromptBehaviorsVarName (out)

Defines the behaviors for prompting the user on the next conversational turn.

nextPromptSequenceVarName (out)

Defines the next sequence prompts from the bot in the next conversational turn.

customPayloadVarName (out)

Returns custom JSON data from the virtual agent bot to the script. Use this variable when you want the script to process data that the bot provides. May contain fulfillment data.

If you want to provide data to the bot, use the customPayload property.

errorDetailsVarName (out)

Prompts the error intent sequence; can lead to a transfer to a live agent.

intentInfoVarName (out)

Lists details from the bot indicating current user intent.

botSessionStateVarName (out)

References the botSessionState property. The botSessionState identification number is passed back as a bot parameter to maintain a session of the current conversation.

Snippet Action Code

Some of this action's properties require Snippet action code. You can follow these examples when creating your script.

customPayload

nextPromptBehavior/defaultNextPromptBehavior

nextPromptSequence

Best Practices for Custom Payload with Google Dialogflow CX

When using this action with Google Dialogflow CX follow these best practices for integrating custom payloads: 

  • Dialogflow CX doesn't use contexts to pass data to Dialogflow intentsClosed What the contact wants to communicate or accomplish like Dialogflow ES does.
  • You can pass custom data to Dialogflow CX using JSON key-value pairs. In a Snippet action in your script, create a DYNAMIC customPayload object and add the key-value pairs to it. For example: 
    DYNAMIC customPayload

    customPayload.ani = ani

    customPayload.contactID = contactId

    customPayload.masterContactId = masterId
    customPayloadJSON = "{customPayload.asJSON()}"

  • In the Exchange or Conversation action in your script, configure the customPayload property with the variable you used in the customPayload object with the asJSON() method.
  • Pass the customPayload JSON to the bot using the Payload property of QueryParameters (see Google documentation on QueryParameters for Google Dialogflow CX).
  • Data passed through QueryParameters is received by a webhook in Dialogflow CX. You can write code in the Dialogflow CX console to handle the passed data.
  • To pass custom data from your Dialogflow CX bot back to the script, use the Custom Payload field in the Dialogflow CX console for the virtual agent you're using with CXone. Map this to your script using the customPayloadVarName (out) variable in the voicebot or chatbot Studio action in your script. For example, you can use this to set the next prompt's behaviors.

Best Practices for Custom Payload with Google Dialogflow ES

When using this action with Google Dialogflow ES, follow these best practices for integrating custom payloads: 

  • CustomPayload is used to pass context for an intentClosed What the contact wants to communicate or accomplish. Context helps the bot understand the user's intent. Contexts aren't required, but they help the bot match an utteranceClosed What a contact says or types. to an intent.
  • In a Snippet action in your script, create a DYNAMIC customPayload object that follows the format outlined in the Google Dialogflow ES documentationGoogle Dialogflow CXdocumentation for REST Resource: projects.agent.sessions.context. The Studio online help provides additional information about dynamic data variables and objects.
  • You can also pass custom data with customPayload without contexts. To do this, include standard JSON key-value pairs to a DYNAMIC object.
  • The customPayload dynamic object is passed as a bot parameter as JSON, as shown in the example script.

Example Script Using VoiceBot Exchange

VoiceBotExchange actions must be used in a loop, This means that you must use at least two in a script. The first action initiates the call to the virtual agent's API and must be preceded by the Default Next Prompt Behavior Snippet action. The first action is the Welcome Default, which begins the first scripted loop, or one conversational 'turn'. A turn consists of:

  1. The contact utterance being sent to the virtual agent.
  2. The virtual agent processing the utterance and defining any custom payload information.
  3. The answer passing back to the contact.
  4. Any additional actions to be taken (such as a database or external API call) which are determined in the nextPromptBehaviors property. You can also determine the conversational loop to exit upon interaction completion or transfer to a live agent.

An example of a script that uses the VoicebotExchange action.

Download this script.

Example Script for CustomPayload with Google Dialogflow ES

This script is an example of how to integrate custom payloads with Google Dialogflow ES bots. This script uses the VoicebotExchange action, but the process of integrating custom payload is the same.

Download this script.