Small failures are bound to occur during visitor-bot conversations - operator unavailability, invalid email address entry, etc are all examples of minor failures that happen during a conversation. To handle these minor failures, the Zobot has a handler called the Failure Handler.
Say, you have an ongoing bot-visitor conversation on your e-commerce website. The visitor wants to purchase a product from your store but he/she wants talk to a human operator from the Payments and Delivery department before placing the order. Let us also assume that at this point there are no operators available to pick up the chat. The bot tries to forward the chat but when there are no operators available, the failure handler in the Zobot sends out a response and passes on this information to the visitor.
What is the Failure Handler?
This handler gets invoked in the Zobot when the actions returned in the other handlers fail to execute. For example, when the message handler returns an action to forward the chat to an operator and if the operator is not available, the failure handler gets invoked. This handler has the following inputs:
- visitor
- cause
- failed_response and
- request
Error Response Format:
In case of any failure, the input params for the failure handler will have the param map "cause" that contains information about the failure. This param contains 2 keys :
- "code" (unique error code) and
- "desc" (description of the error)
Note:
The Failure handler code will be disabled by default but if you wish to set up failure responses you can enable it.
To learn more about this, start building your own Zobot right away.
Regards,
Michelle