How to handle unknown input & what to do when your chatbot fails

Khoros Staff

Editor's note: This blog post was originally written on the website. was acquired by Khoros in 2021 to advance Khoros' conversational AI and machine learning (ML) capabilities and data science expertise. This blog post has been adapted to be on the Khoros blog.

People aren't perfect, the same goes for chatbots designed by people. Even though you spent a good amount of time on designing, testing and you are using advanced Deep Learning techniques, your bot will fail. Make sure to prepare your bot with a fallback and set up an environment so that you can learn from these failures. In this guide we will show you:

  • Best Practices: handling the unknown
  • 3 Ways to handle the Unknown

Best Practices: handling the unknown

What do you, as a person, do when you are prompted with a question that you don’t know the answer to? Well, those steps are quite similar to the process of chatbot.

1. Acknowledge failure

As your parents told you not lie, you will be honest and acknowledge the “failure”. Same goes for your bot. When your bot has no clear answer to question you can start with acknowledging the failure with something like “Sorry, I didn’t quite get that”.

2. Propose a solution or workaround

Now, we’ve acknowledged the failure but there is no solution at all. So our bot is definitely not helpful. Always try to propose a solution. 3 Common solutions that will be discussed in the next section are:

  • Asking to rephrase
  • A handoff to an agent
  • Extract topics

3. Gather and process feedback

Now, we’ve proposed a solution but still, how do we know if that answer is satisfying? Simply ask for it. A question like “Was I able to help”, followed by a thumbs up or thumbs down button can do the job.

This is a great opportunity to learn how you can improve your bot.

3 ways to handle the Unknown

Allright, that’s that part. Now we can start building actual solution for our bot to handle the Unknown. You can use one or a combination of the following techniques to handle situations that are not known to your chatbot. It all depends on your case and available resources and agents.

1. Rephrase and show topics

A simple solution is to ask the user to rephrase their question. Even though this solution seems simple, it can be very effective. In addition to rephrasing you can also suggest topics.

2. Handover

A second solution is to hand the conversation over to a human agent. Agents are very good at understanding complicated questions and answering those out of the box. Acknowledging failure is optional in this scenario. It's does not add any value and there will be a person following up anyway.

Two common handoff scenarios to consider are:

  • Live chat
  • Ticketing software

Following up with livechat or creating tickets in a CRM all depends on your existing process and available resources and tools that you are using like Hubspot, Salesforce or Freshdesk.

Zapier is a great tool that you can use to connect your bot with many other solutions.

3. Extract topics

A third solution is trying to extract topics that the bot is trained for. When the bot is not able to recognize a topic we can still hand the conversation off to a human colleague.

To set this one op we'll first need to transfer the input of the user into a parameter. You can do that with an Action with the following code that will create a parameter with the name "query". The value of this param will be equal to the input of the user.

async payload => {
  return {
    params: {
      query: [{
        value: payload.query

With our new param in place we can follow up with Conditions to see if there are topics or words that we recognize. If there are topics that we recognize we can show the user how the bot is able to help him with that topic.

    Would you like to learn more about Khoros?