> For the complete documentation index, see [llms.txt](https://en.help.firstline.cc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://en.help.firstline.cc/feature/chatbot/scenario/example/fan-li-sou-xun-zhi-shi-ku-gong-neng.md).

# Search and Reply to Knowledge Base Articles

## Overview

The FIRST LINE conversation script feature can not only automatically handle customer dialogues, but also provide prebuilt knowledge base articles to help customers find answers on their own, thereby reducing reliance on human agents and saving labor costs. In addition, you can change the "Search Knowledge Base" action to "FIRST LINE AI"; by integrating FIRST LINE's AI capabilities, you can further refine dialogue content and search results, making communication more natural and efficient.

## How should this be planned?

To effectively use this feature, when creating conversation scripts, it is recommended that you refer to the "Apply Example" and the \[Search Knowledge Base Articles] example.

This example will guide you on how to design a conversation flow that allows customers to intuitively perform knowledge base searches. Furthermore, you can combine FIRST LINE's AI features to optimize dialogue content so responses better match customer needs and improve communication efficiency and satisfaction.

![](https://3300265106-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNRu7dk70ei7JV9HlW9%2F-MdqupHpSDGr1HvezgnJ%2F-MdqvPr48NguZSCDKuGH%2F%E6%88%AA%E5%9C%96%202021-07-05%2021.48.42.png?alt=media\&token=65a709ed-230c-4a23-a180-6974aea94098)

According to the example, we can try dividing the flow into two branches: left ① and right ②, as follows:

![](https://3300265106-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNRu7dk70ei7JV9HlW9%2F-MdqupHpSDGr1HvezgnJ%2F-MdqvfoQuqI3pDWtCQ8v%2Fimage.png?alt=media\&token=3a60e5a3-5c56-4474-8944-1a438afce750)

### **① Transfer to human agent**

When the customer clearly understands the inpu&#x74;**`Transfer to human`**&#x6B;eywords that can directly find a human agent, it facilitates and speeds up the call-in process.

1. **Event:**&#x53;elect "**Transfer to human agent**", ente&#x72;**`Transfer to human`**&#x61;s the criterion for directing the session to be handled by customer service staff.
2. **Exit:**&#x54;he action that transfers the customer into the system; you can also specify that this conversation script be assigned to a specific specialist.

### **② Search knowledge base**

This part goes to search the knowledge base, where the bot judges the keywords entered by the customer and searches the titles in the publicly created knowledge base articles for matches to automatically reply, making it convenient for customers to self-query issues.

1\. **Event:**&#x53;elect "**Customer message matches**", enter `*` as the judgment for any message, and set the "Save customer message as memory variable" field to `message`, which means the customer's reply will be stored as the message variable.

{% hint style="info" %}
**You can name the variable yourself; here we use `message`as the variable name for easier identification.**
{% endhint %}

![](https://3300265106-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNRu7dk70ei7JV9HlW9%2F-MduclLLflQAt8tIb5XL%2F-Mdud4ARGTWzT3iCxlWZ%2Fimage.png?alt=media\&token=37b2eafe-5494-43ff-ab0e-529d44b9d26a)

2\. **Action:**&#x53;elect "**Search knowledge base articles**", put the message variable into the one created in the previous action`message`, and enable the feature to send search results as messages, as well as set a reply message when no article is found; you can also restrict searches to**articles in specified categories**, save**whether any article was found into a variable**and other advanced functionality.

![](https://3300265106-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNRu7dk70ei7JV9HlW9%2F-MduclLLflQAt8tIb5XL%2F-MdudZt2JluXRnmpTegw%2Fimage.png?alt=media\&token=81b218aa-a1cc-494c-994f-538db9de6f7c)

3\. **Action:**&#x53;elect "**Send options**", and set**Transfer to specialist**option. Although the flow is complete here, when the customer sends the next message they will re-enter the script; making this setting allows the customer, if they still can't find the correct answer and want to transfer to a specialist, to choose to send "Transfer to specialist" as the first message when entering the system, which directly triggers another**① Transfer to human agent (left)**&#x6B;eywords as the criterion for directing the session to be handled by customer service staff.

![](https://3300265106-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNRu7dk70ei7JV9HlW9%2F-MduclLLflQAt8tIb5XL%2F-Mdui0kjc4g1OWWrK3us%2Fimage.png?alt=media\&token=6f9f90a1-a529-4dff-b836-32a650543efe)

## Result confirmation

![](https://3300265106-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNRu7dk70ei7JV9HlW9%2F-MdtaRXzXo4eoN82nKxB%2F-MdthxRG6gk7jalalkt1%2Fimage.png?alt=media\&token=779da201-2352-4f25-bbab-0daf7d4864a3)

Whether or not the correct knowledge base article is found, this flow will have ended after the bot sends the \[Transfer to Human] button. When the customer sends the next message, they will re-enter the script, so after the customer presses the transfer-to-specialist button it will be directly judged as the above ① call-in as shown below

![](https://3300265106-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MNRu7dk70ei7JV9HlW9%2F-MdtkqcaYUmTqS6Mgm8M%2F-MduNTlpstjV1id8nnRm%2Fimage.png?alt=media\&token=1ce80f47-c690-4c57-97f5-3c344b523bd3)

If the keyword is entered directly, it is ② continuing to search knowledge base articles, and so on.
