Build your KBAI flow

Learn how to set up your own knowledge base AI and use it in a flow to cover any FAQ.

Once you added content to your KBAI, it's time to build a flow where your bot will know when to browse this knowledge base to provide an answer to your customer's question.

To create your KBAI flow you could either:

Retrieve the KBAI answer

To retrieve an answer from the knowledge base:

  1. Drop an Action block in your canvas. For this example, we will name this block "Generate answer".

Many customers will preferably have their knowledge base flow happening after the bot did not understand what was asked, as a fallback option. To do this, go to your Not Understood block, change its block type to Action, and continue by following the steps below.

  1. Click on Knowledge base AI.

  1. Fill in the fields accordingly. You can configure:

    • Destination variable: the answer from the knowledge base will be stored as a variable. In the first field, you can choose the name of that variable.

    • On no findings: if the question that the user asks cannot be answered by the knowledge base AI, a block will be triggered. You can select which block in this dropdown.

    • On failure: if there is a problem with the knowledge base AI, and it returns an error, you can select a block which the user will be led to. By default, users will be routed to the Error Occurred block.

  1. Save your changes.

You bot can now scrape the KBAI and retrieve an answer based on it. But it cannot yet display that answer. Let's see how to do that in the section below.

Display the KBAI answer

To display the answer from the knowledge base:

  1. Open the Action block that you just created.

  2. At the bottom of the block, add a Go-to to a block that you can create from within the dropdown. In this example, we will call this block KB result.

  1. Save your changes.

  2. Open the newly created "KB result" block.

  3. Add a Text message that contains the variable you chose to save the knowledge base AI answer into. By default, this is {knowledgebase.answer}.

  1. Save your changes.

Route your KBAI flow

There are multiple ways to route your KBAI flow.

You could route your KBAI flow based on the session data inside the knowledgebase object.

KBAI session data

You can access your KBAI session data by using the Debugger tab inside the Emulator.

The knowledgebase object contains several fields:

  • answer: the answer that can be used in a text message in your bot

  • retrieved: an array of all the content that was used to formulate the answer. For each array item, the following data is stored:

    • type: type of the source: "URL" or "DOC"

    • name: filename of the document or link of the URL

    • content: snippet of the content that was used to generate the answer

    • tags: any tags that were retrieved that are associated to the content source.

    • contentType: type of the source: "URL" or "DOC"

  • contentUrl: URL of the source that was used. If a domain was scraped as content, this URL will refer to the specific page from which the answer was retrieved.

You might also want to use tags in your content to specify which content the bot should look at.

Use tags to limit your KBAI content

Last updated