# 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="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FMGqzO3ZeaxDIikHQ3Q6U%2FCapture%20d%E2%80%99%C3%A9cran%20du%202024-09-10%2010-48-05.png?alt=media&#x26;token=612e1c33-5f92-48e7-bba1-e28982a62f35" 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="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FbuzonZ6pSwGSHV15RKXM%2FCapture%20d%E2%80%99%C3%A9cran%20du%202024-09-10%2014-35-16.png?alt=media&#x26;token=a2505318-8bf9-4085-9620-f83707cfdc9d" 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="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FmOXgZYJQpurdmbfeWAHg%2FCapture%20d%E2%80%99%C3%A9cran%20du%202024-09-10%2014-35-48.png?alt=media&#x26;token=63f4084d-1cf6-4790-8016-cf88b1b759a4" 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="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FzTnR4K4V5ukYI25Ghsj9%2FCapture%20d%E2%80%99%C3%A9cran%20du%202024-09-10%2011-02-29.png?alt=media&#x26;token=bb4c47c3-0d07-4f3d-8cda-09eec0a66979" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FYWDpjSMY6hIT2F4UePa9%2FCapture%20d%E2%80%99%C3%A9cran%20du%202024-09-10%2011-03-50.png?alt=media&#x26;token=b44bc073-dccc-4cb2-ab76-956d7e09339b" 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 ![](https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FIoHqhBYgr9szBSMZd25x%2FCapture%20d%E2%80%99%C3%A9cran%20du%202024-09-10%2011-09-54.png?alt=media\&token=19042383-4d9d-4c16-bedd-d7c956974ed2) and search for "**Connect to Livechat**" Click on "**Update**" afterwards.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2F9tUYj1xTjjEqbbfST3oJ%2FCapture%20d%E2%80%99%C3%A9cran%20du%202024-09-10%2011-14-29.png?alt=media&#x26;token=f76e439f-b67a-42df-aac4-fc0a0fe44999" alt="" width="272"><figcaption></figcaption></figure>

6. Then click the button ![](https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2Fd2gIOGx0XH4RhNV50sQ7%2FCapture%20d%E2%80%99%C3%A9cran%20du%202024-09-10%2012-03-44.png?alt=media\&token=f4702cb2-3be6-4e78-b195-cf004ab17298) 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="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2F2sK41tjPH5SaXnXAMklw%2FCapture%20d%E2%80%99%C3%A9cran%20du%202024-09-10%2013-57-25.png?alt=media&#x26;token=d44c5890-f522-44cc-b2e5-76ea99112de2" 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="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FfTk26qdKZ0oyL0cyyyb1%2FCapture%20d%E2%80%99%C3%A9cran%20du%202024-09-10%2014-03-04.png?alt=media&#x26;token=6e82384a-ff1f-475b-97f1-a3c28ff637c3" alt="" width="563"><figcaption></figcaption></figure>

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