Handling User Input Retries and Opt-outs in Watson Assistant Using Digressions

Lalit Agarwalla
IBM Data Science in Practice
6 min readJul 16, 2020
Photo by John Schnobrich on Unsplash

A typical conversational virtual agent will collect information from user (example: customer identification data) to identify and assist the user. There are two scenarios which are very common in these solutions and can be handled using Watson Assistant Digressions feature.

  1. User input is not understood by Watson Assistant
    - User needs to be re-promoted asking to provide the information again.
    - If user reaches maximum allowed tries (example: two-strikes rule), they need to be transferred to a live agent.
  2. User asks to speak to a live agent. They will be asked if they really need a transfer.
    - If the user says No, they will stay in the same flow.
    - If the user says Yes, they will be transferred to an agent.

To avoid duplicating the same logic under every input node, the above scenarios should be implemented using Digression. This article will provide a step by step guide for implementation.

Handling input Retries using Digression

1. Create a Retry — Digression node to handle user input retries. This node should be at the root level in the dialog tree and should handle anything_else conditions

2. Change the node configuration to allow return after digression. Click on Customise link on the node and select Return after digressions option as below.

3. Add a child node and name it 1st try. Add node condition, context variable and response as below.

  • Add condition as $retryCounter < $maxTries. This assumes
    - $retryCounter to keep track of retry count. This needs to be reset to zero at every input prompt (step 7 shows an example of this reset).
    - $maxTries is maximum allowed tries. This needs to be initialised in the welcome node.
  • Add context variable retryCounter and value as <? $retryCounter+1 ?>. This increments the retry counter.
  • Add response text as I am sorry. I did not get that.

The digression feature will make sure user returns to the original prompt after 1st try.

4. Add another child node and name it 2nd try — Transfer. Add condition, context and response as below.

  • Add anything_else as condition of the node
  • Add context variable _dummy and value as <? clearDialogStack() ?>. This prevents the digression return and allows transfer to happen (This link explains usage of clearDialogStack() function)
  • Add response text as I am sorry. I still did not get that.
  • Change the jump to node which will transfer the user to live agent.

5. Change the parent node’s response behaviour from Wait for reply to Skip user input. Once done, the retry node structure will look like below.

6. Set $maxTries context variable as 1 in the welcome node. The value of 1 means, it allows two retries or two strikes, after which user will get transferred to live agent.

7. Let’s test out the flow. Create a new input prompt node at the root level. Set the $retryCounter context variable as zero. Also create child nodes to handle all valid inputs for the prompt. All the invalid inputs and retry will be handled by digression.

Note: In the screenshot above, the node condition is kept as false which is mainly used for jumping from other nodes. The node condition needs to be changed as per your requirements.

It is very common to have a different prompt message to the user when input is missed. This can be handled using custom return message for digression. In the assistant responds output text, use different messages as below:

<? (returning_from_digression)? 
“May I have your customer identification number. (this is custom return message)”
:
“Please enter your customer identification number. (this is first message)”
?>

8. Open the Try it out panel and enter any invalid input. You will notice that user is re-promoted by retry digression and after two attempts, user gets transferred. Also notice different message is prompted when asking for second time.

Handling #opt-out requests using Digression

This scenario involves allowing user to talk to live agent if the user asks for Live Agent. Before transferring, the user is asked for confirmation. Any negative conformation will keep the user in the same flow.

1. Create #opt-out intent to handle questions like I want to talk to live agent.

2. Create a new node at the root level to handle #opt-out requests. Set the response text as Would you like to be transferred to customer service executive?

3. Allow node digression to return using the Customise option

4. Create child node to handle No requests. The digression feature will make sure user returns to the original prompt.

5. Add another child node to handle Yes and anything_else requests. Also add context variable and jump as below

  • Add context variable _dummy and value as <? clearDialogStack() ?>. This prevents the digression return and allows transfer to happen.
  • Change the jump to node which will transfer the user to live agent.

6. Once completed the node structure will look like below

7. Let’s test out the flow. Open the Try it out panel and request for Live Agent. Watson Assistant will ask for confirmation. It will return to the same prompt if the user responds as No and gets transferred to live agent if the user says Yes.

Conclusion

The above scenarios demonstrate how to use digression to handle user input retries and asking for an agent.

Special thanks to Leo Mazzoli and Andrew R. Freed for reviewing this article.

For help using and implementing Watson services, reach out to IBM Data and AI Expert Labs and Learning.

Resources

Lalit Agarwalla is Cognitive Engineer at IBM Watson. He specialises in conversational AI solutions along with educating and enabling clients with IBM’s wide catalog of AI products and solutions.

--

--

Lalit Agarwalla
IBM Data Science in Practice

Cognitive Engineer at IBM Watson. Specialises in conversational AI solutions. All views are only my own.