> For the complete documentation index, see [llms.txt](https://docs-en.dydu.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-en.dydu.ai/livechat/dydu-livechat/dydu-livechat-setup/waiting-queues/competency/setting-up-a-knowledge-base-with-the-waiting-queue-by-competency.md).

# Setting up a knowledge base with the waiting queue by competency

Setting up the waiting queue in a knowledge base must meet several conditions to ensure its proper functioning.

## Creating the context condition

For the waiting queue to function solely by competency, each competency must have its own context condition to enable escalation to Livechat.

{% hint style="warning" %}
By default, when creating a Livechat competency, its context condition is generated automatically. If it does not appear, follow the instructions below; otherwise, you can proceed directly to [creating the knowledge](#creating-the-knowledge).
{% endhint %}

1. Go to **Contents** > **Context Conditions**.

<figure><img src="/files/dfGdyFRWVw8x4dAx5QiX" alt=""><figcaption></figcaption></figure>

2. Click on the **Add** button.
3. Enter the name of the condition (the name does not matter).
4. In the **Condition** field, enter: `LiveChatAvailable('<Competency Name>')`. Then, in **Operation**, select "**equals**," and in **Value**, enter "**true**."

<figure><img src="/files/o0CjcrKImHCTYF0dPNCk" alt=""><figcaption></figcaption></figure>

5. Save your changes by clicking on the checkmark.
6. Repeat this process for all competencies requiring this context condition.

<figure><img src="/files/yvBdSkjNlk951Jnno6z4" alt=""><figcaption></figcaption></figure>

Now that the context conditions are created, you need to create the knowledge bases that call for an operator.

## Creating the knowledge

You will need to create a knowledge base for each competency, based on the competency required to answer the questions.

1. Go to **Contents** > **Knowledge**.

<figure><img src="/files/s2DPYb0jmJwJ3f3RMXA7" alt=""><figcaption></figcaption></figure>

2. Click on the **Create Knowledge** button.
3. Choose "**Answer to a question / Decision Tree**".

<figure><img src="/files/G6yladpOes5OrTY9bMsC" alt="" width="563"><figcaption></figcaption></figure>

4. Enter the question that the user will ask to trigger the competency escalation, then click on **Create**. In the response, you can include a message, which will be the escalation message to the operator.
5. Go to "**More Options**" > "**Other Options**" Then, in the "**Set GUI Action**" field, click the button ![](/files/NCagK8pwtT3IjeHMgROq) and search for "**Connect to Livechat**" Click on "**Update**" afterwards.

<figure><img src="/files/0Tx8tDcieJYhzXP82hc2" alt="" width="272"><figcaption></figcaption></figure>

6. Then click the button ![](/files/N7IFDVQvFB6Ner4ObQLH) to insert a condition, and choose "**Success Branch**".
7. In the condition, select the context condition you created earlier, corresponding to the desired competency, and then click on **Update**.

<figure><img src="/files/6w73tUU7p90JpykJzqTs" alt="" width="521"><figcaption></figcaption></figure>

8. In the **failure branch**, provide a response that will be sent if the advisor for the selected competency is unavailable. You can then **publish** your knowledge base to make it available on your bot.

<figure><img src="/files/4fKGELjfVi3oKzWmHfwZ" alt="" width="563"><figcaption></figcaption></figure>

Your knowledge base is now created, and the waiting queue is operational on your Livechat.
