Configure Outcome Branches in the Script
The TextBotExchange action returns one of four branch conditions after each execution. You must connect each branch to the appropriate downstream actions in the script. Failure to handle all branches can result in interactions dropping or routing incorrectly.
|
branch |
When it is taken and what to do |
|---|---|
| OnPromptAndCollectNextResponse | The virtual agent determined that the interaction should continue and is waiting for more contact input. Loop the script back to the Askcaller action to capture the next customer message and loop it back to the so that the next customer message is sent to TextBotExchange action to send it to the AI Agents (Cognigy). This branch is the main conversation loop. |
| OnReturnControlToScript | The virtual agent has finished its task or determined that the contact needs a live agent. Control is returned to the Studio script. Check the Custom Payload Var Name (out) variable for fulfillment data or escalation signals. Configure your script to end the interaction or route the contact to an agent queue based on the signal. |
| OnError | An unexpected error occurred, such as a connectivity failure, timeout, or syntax error. The _ERR variable and Error Details Var Name (out) are populated with error details. Configure this branch to handle the error gracefully, for example, by sending an apology message to the contact and routing to a live agent. |
| Default | Taken unless the script meets a condition that requires one of the other branches. Also taken if the other branches are not defined. It is recommended that you always define explicit handling for OnPromptAndCollectNextResponse , OnReturnControlToScript , and OnError so that the Default branch is not taken unexpectedly. |
Configure the following branch connections in your script:
-
Select the TextBotExchangeaction on the canvas.
-
Connect the OnPromptAndCollectNextResponse branch back to the action that collects the contact's input (for example, a AskCalleraction), forming a loop. This loop continues for each turn of the conversation.
-
Connect the OnReturnControlToScript branch to the action that handles interaction completion or escalation. In the OnReturnControlToScript path, inspect the Custom Payload Var Name (out) variable to determine whether to end the interaction or route the contact to a live agent queue.
-
Connect the OnError branch to an error-handling path. This path should inform the contact that an error occurred and route the interaction to a live agent or end the interaction according to your organization's requirements. Check the Error Details Var Name (out) variable and the _ERR system variable for diagnostic information.
-
Connect or leave the Default branch as a fallback. It is recommended that you configure explicit handling for all branches rather than relying on the Defaultbranch.