# Knowledge base setup

## Configuration when explicitly requested by the end user:

1. Create your **context condition** to check operator availability. To do this, go to the **Contents > Context Conditions page**.
2. Fill in the fields as shown in the example below:

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2Fc7fGJ9PBnBQ9ioIMjMqj%2Fimage.png?alt=media&#x26;token=82c1ac42-da1a-42ee-895a-07eb94791669" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
It is also possible to check if the Livechat is open by following the operating hours configured in **Preferences** > **Livechat Settings** > **General**.

To do this, you can use the **LiveChatOpen()** condition, which only checks if the Livechat is open.

On the other hand, the **LiveChatAvailable()** condition checks both if the Livechat is open and if an operator is available.
{% endhint %}

3. Go to **Contents > Knowledge** and create a knowledge of the type "answer to a question".

Example: "I want to speak to an advisor."

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FEER3NiMpgcvfSGcVC3uu%2Fimage.png?alt=media&#x26;token=eea8d53a-769a-4edc-9915-ce8277fa08e2" alt="" width="407"><figcaption></figcaption></figure>

4. Insert a context condition between the user's question and the response, and select the condition you created in step 1.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FDufkGMofVMQoDZ7uYlvo%2Fimage.png?alt=media&#x26;token=d4591bd6-31d7-4d52-aa6c-37f868210892" alt="" width="272"><figcaption></figcaption></figure>

5. Click on Update.
6. Complete the success and failure responses:

Example of success: "I'll connect you with an advisor."\
Example of failure: "Unfortunately, no advisors are available."

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FOgB2oLANz4LyniPRlPpr%2Fimage.png?alt=media&#x26;token=5f367246-a311-49d9-9090-91b8bc2e8425" alt="" width="563"><figcaption></figcaption></figure>

7. Edit the response to display when an operator is available (the branch on the left), then click on **More options > Other options > Set GUI action** and select **Connect Livechat**.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2F0WwYAB7OJsXks52S2sIy%2Fimage.png?alt=media&#x26;token=75d51676-5789-423c-9325-a8620bfb6ce7" alt="" width="307"><figcaption></figcaption></figure>

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FK4waREf9euiubklIBlvs%2Fimage.png?alt=media&#x26;token=14f5da12-0d20-49c1-92f3-573dea07c64e" alt="" width="315"><figcaption></figcaption></figure>

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2Fq8RkjF7jfFJjb7xNi6oP%2Fimage.png?alt=media&#x26;token=0d143799-0557-4a6d-a13a-d3d2664d040a" alt="" width="305"><figcaption></figcaption></figure>

8. Click on **Update** to save the response. Your Livechat escalation is now effective.

If an operator is available, the user is directed to the branch on the left and connected with an operator. Otherwise, the user will receive the response provided in the branch on the right.

It's also possible to redirect the user to an operator with specific expertise. Once you have defined skills for each operator, you can choose to assign each skill to a knowledge item. The skills will appear in the list of context conditions when you create your responses.

{% hint style="info" %}
Note: you have the ability to create predefined answers for your Livechat sessions. To learn more, click [here](https://dev.docs.dydu.ai/docs/Knowledge/Types/predefined_answer).
{% endhint %}
