Route conversation to a Human Agent using the API
While bots can help you scale your business efficiently, it’s more powerful to have control of the responses the bot gives. The way to do this is by allowing humans to respond with the bot at certain times.
This is especially effective when a bot is not really sure about an answer. To solve this problem, our Chat API will return a score for each response that is indicative the quality of the response that’s about to be output. You will be able to intercept this score before a response is returned and re-route it to a someone in your team when this value falls below a certain threshold.
The following code snippet shows you how to extract the conversation score and redirect the flow to a human agent in case the chat score falls below 0.5 (You can set this value between 0 and 1)
# gets the current chat score score = float(chatResponse.response['result']['score']) if (score > 0.5): print("Ai: ", chatResponse.response["result"]["answer"]) else: print("Ai: Looks like I am not understanding our conversation. Let me connect you with an agent. Please wait.")
You can find a full working python example.