Last updated: 16 December 2022

Semantic search is both powerful and useful. In a nutshell, with semantic search:

  1. You create a bunch of articles

  2. You make all those articles searchable

  3. Users ask your chatbot a question

  4. Chatbot uses that question to find the closest answer in your articles

  5. Chatbot returns the best option

To learn more about semantic search, read this article.

As you can see, in the process above, the semantic search will look through all your stored articles and find the best option.

In this tutorial, we will hack this process around to forcefully dictate the result instead, to make sure only one article is ever returned after a question.

Step 1: Set up semantic search

You will need a least one knowledge base and one article, to enable semantic search, and create a conversation.

To catch up, follow steps one to four on this document.

All caught up? Great!

Step 2: Create the conversation

We’re going to create a two-step conversation.

  1. The first step will ask the user which topic they’re interested in. We’ll include buttons to select their topic. These buttons will contain specific keywords.

  2. We will use the keyword as a semantic search and return the specific article we want to return.

Go to the Builder.

Create a new conversation, give it a name, a description, and a trigger of your choice.

The ‘search’ step

Edit the first step into an Action message. Add as many postback buttons to the message as you need, one per article you want to return.

In each postback button, write a label (which the user will see) and a postback (which the user will not see). The postback will be used as a keyword in the semantic search, so make it specifically something you know will trigger the article you want.

Here’s an example:

Each postback (poneys, cities, etc.) is a keyword I know will trigger a specific result from my articles.

Hit Save.

The ‘result’ step

Tie a new step to the first one.

Create a Content message. Add a few words in the message, then the variables {{knowledge_base.section_name}} and {{knowledge_base.section_content}} in the title and body respectively.

Click Advanced settings. This is where we will select the article we want to return.

Under Data type, select Imported content. Then choose your knowledge base and the article.

Hit Save.

The transition

The transition between both steps will be a simple semantic search transition: when content import is triggered.

All done! Go to the Demo and test your conversation.

FAQs

My chatbot is not responding after I click the button. What could be the problem?

You must make sure the postback in your first message categorically triggers the article you’re assigning in the second step. If it doesn’t, the chatbot will not know what to return and keep spinning.

I’ve set it all up properly but my chatbot users keep asking random things. How do I force them to use the buttons?

Simple! Edit your first step and, under Composers, select Hidden.

This will remove the free text field and force your users to use your beautifully crafted buttons.