# Zendesk Livechat connector

If you are using Zendesk live chat, you will find below the configuration steps required to set up interoperability between BMS Dydu and Zendesk.

## Step 1 – Configurations in BMS Dydu

### A – Activate the Livechat submenu:

1. Go to **Preferences – Bot – General**
2. In the **Livechat Escalation submenu > escalation type**, select **ZENDESK** from the dropdown list.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FXRgr4Pbz7K8OA7Id17rb%2Fimage.png?alt=media&#x26;token=e5e1ed66-a406-4611-b986-4f6544209192" alt=""><figcaption></figcaption></figure>

3. **Save** your selection.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FtNOb2qfFrrG6d20O9VMh%2Fimage.png?alt=media&#x26;token=75881f4e-3dec-4eb0-9756-004e5f9ccda7" alt="" width="188"><figcaption></figcaption></figure>

### B – Link the Zendesk connector to your Dydu bot

Go to **Preferences > Livechat Settings > External Connector**.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FeQ9Tqwetdcna7FpaZugq%2Fimage.png?alt=media&#x26;token=8757ef2e-b36a-4829-acc6-901e66a0c42d" alt=""><figcaption></figcaption></figure>

In this section, you must provide 4 types of information:

* Mandatory – Zendesk connector (domain name, app id, integration id)
* Mandatory – Conversation API key (key id, secret key)
* Mandatory – Zendesk API (email address, API token)
* Optional – Identity mapping (sender id)

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FsQzr9geK41Kz11CByqzG%2Fimage.png?alt=media&#x26;token=3c0da860-3331-4e2c-becb-8fd874e1ae69" alt=""><figcaption></figcaption></figure>

Below you will find details on how to fill in each field:

## Step 2 – Retrieving information from Zendesk

### Field 1 – Zendesk connector

These are the Zendesk connector data that you obtain via the Zendesk interface.

The domain name can be found in your browser's URL when you are logged into your interface. Here, the domain name is **dydu-32357.zendesk.com**

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2F80sAaKxlhtlrVh8BOx8N%2Fimage.png?alt=media&#x26;token=e068935e-60dc-4584-8efe-160b6af1f1af" alt=""><figcaption></figcaption></figure>

To obtain the last two required pieces of information, go to the Zendesk admin center to create an integration, as well as an API key for this integration.

To do this:

1. Click the **gear icon in the sidebar > Go to the admin center**

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FccgcoSyFaZU1fpxMJTmg%2Fimage.png?alt=media&#x26;token=67d4b05a-ff8d-493c-97d9-7d891ab3b452" alt=""><figcaption></figcaption></figure>

2. Go to **Apps and Integrations > Conversation Integrations > Create an integration**

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FoGSRGBjyM1c8bj8HBw48%2Fimage.png?alt=media&#x26;token=8587148e-2e66-4e85-818d-d4f06f9019b9" alt=""><figcaption></figcaption></figure>

3. Add a **name** and the **Webhook endpoint URL**, which you can find in the livechat settings in the section “**Webhook URL to provide to Zendesk**”.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FHjEq5RDyRsx6tKeLxSTd%2Fimage.png?alt=media&#x26;token=5c4cdd16-ba45-496a-8119-ddf5c60c04aa" alt=""><figcaption></figcaption></figure>

4. Check all three boxes: **Include full user, Include full source, and Conversation message**, then click **Save**.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FtQrJ2WCZrBv46CqGBJlk%2Fimage.png?alt=media&#x26;token=66f6a263-ec7a-4b4d-bd70-655abe212e69" alt=""><figcaption></figcaption></figure>

5. You do not need this information; you can click **Next**.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2F9OnqBFjyVOUAG1nEgISH%2Fimage.png?alt=media&#x26;token=da93e43f-ab4e-4526-8b4c-1da5948ed551" alt=""><figcaption></figcaption></figure>

6. On the **details** page of the integration you just created, you can find the **app id** and **integration id** that need to be entered in the livechat settings.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2F8vjntmBNz8kpzEnxyuND%2Fimage.png?alt=media&#x26;token=1a540c5d-7e44-4e67-9b51-8db1d1e748e8" alt=""><figcaption></figcaption></figure>

7. Finally, you need to create an API key associated with your integration. To do this, in "**API Keys**," click on **Create an API key**.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FukMptduHVy28Izte3L6W%2Fimage.png?alt=media&#x26;token=1e793fff-f191-482e-9c80-98abf1eddbb6" alt=""><figcaption></figcaption></figure>

8. Add a **name**, then click Next.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2Fj12GLscOO8HwgincRRwv%2Fimage.png?alt=media&#x26;token=eaf8de9f-2f26-44b2-b955-bb447cc27bd8" alt=""><figcaption></figcaption></figure>

9. You do not need the information shown in the pop-up. **Simply creating the key is enough**.\
   Click **Next** to generate the API key.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2Fkf0BMulapUP16sj357VC%2Fimage.png?alt=media&#x26;token=4a7b0f66-70c9-403a-a024-7d174a55ad7f" alt=""><figcaption></figcaption></figure>

### Field 2 – Conversation API key

1. To obtain the two required fields for this section, go to the **admin center** and click on **Apps and Integrations > Conversation API > Create an API key**.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FEvOpM6nrbDjSKxkd1np1%2Fimage.png?alt=media&#x26;token=b4ce0c42-d5d2-4e27-a304-79d5a11f4b2a" alt=""><figcaption></figcaption></figure>

2. Add a **name** and click **Next**.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FJKLSBlt2Q0NLFeTuFoPR%2Fimage.png?alt=media&#x26;token=32c8d83d-3f28-472f-a8fa-4169008e3515" alt=""><figcaption></figcaption></figure>

3. In the pop-up that appears, you will get the key id and the secret key, which you can copy and enter into your livechat settings.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2F3kA10gXvJAYsLqNfcLQ0%2Fimage.png?alt=media&#x26;token=4ac4ced7-0849-4934-9b90-612228f4fff7" alt=""><figcaption></figcaption></figure>

### Field 3 – Zendesk API

1. To obtain the email address of the Zendesk account and the associated API token, go to the **admin center** and click on **Apps and Integrations > API Tokens > Add an API token**.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FSXTxOqYlvVbl85Mlq4zU%2Fimage.png?alt=media&#x26;token=95cf61b9-115d-4d2f-a985-0f60bc731aa0" alt=""><figcaption></figcaption></figure>

2. Add a **description and click Save**.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FApQAhKUmuGDWuZ2kUW6F%2Fimage.png?alt=media&#x26;token=166352b7-0a46-4d63-ba9a-6865661f6ca4" alt=""><figcaption></figcaption></figure>

3. Your **API token** is now visible; **copy it** and **enter it** in your livechat settings. The Z**endesk account email field** corresponds to **the email address of the account that created the API token**.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2F07CJJJ7nPDsIMS7Ca4xI%2Fimage.png?alt=media&#x26;token=08eccb72-38fe-4bff-b0af-25b042db3c7e" alt=""><figcaption></figcaption></figure>

If you have any doubts, you can find this information on the API Token page. The user's information is visible by clicking on it.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FSWUfD4Y7z5mS4Pe8yHoD%2Fimage.png?alt=media&#x26;token=92489c9b-8ee5-4e5c-8750-7c6ad5cb85eb" alt=""><figcaption></figcaption></figure>

4. In **Apps and Integrations > API configuration**, make sure that the "**Allow API token access**" box is checked.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FQhOlQCquf76TCINP5RWI%2Fimage.png?alt=media&#x26;token=d8565a5f-a177-4d45-b219-51e2ab653686" alt=""><figcaption></figcaption></figure>

### Field 4 – Identity mapping

To provide a more personalized conversation experience, the Livechat operator can have additional information about the chatbot user. You can retrieve information that will be visible to the operator on their Zendesk interface. To do this, you need to create a knowledge item that uses a variable to capture the information the chatbot will share with the Livechat agent.

### Example configuration to retrieve the user's email address

1. Create a knowledge item as shown below with the variable "mail" as free input:

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FT7MDpmmdA27gaph71awJ%2Fimage.png?alt=media&#x26;token=79d807bb-87ab-4c92-bf91-5df7f895a7b8" alt=""><figcaption></figcaption></figure>

2. Use the variable name “mail” to fill in the Identity mapping > senderId field in your Livechat settings.

## Step 3 – Test escalation to Zendesk Livechat

1. Create a skill on the BMS

   1. Go to **Preferences > Livechat settings > Skills**
   2. Create a **skill** that will then be used for creating a knowledge item. To do this, click **Add**, enter a **name**, and click the **button on the right to confirm the creation** (example with the skill Animal).

   If you already have an existing group in Zendesk and do not want to create a new one, simply use the same name.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FdvQknwJWWgytErWT4OEE%2Fimage.png?alt=media&#x26;token=a4e1ba10-75aa-403b-9bbd-a854fb2ffd92" alt=""><figcaption></figcaption></figure>

When the skill is created, to create the group in Zendesk associated with the skill, go back to **Livechat Settings > External Connector** and click Update.\
If no group with the same name exists in Zendesk, you should see it appear on the Zendesk interface. In the **admin center**, click **Persons > Groups**.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FHGVxLC3tpyRVynw42wId%2Fimage.png?alt=media&#x26;token=c7930e86-ce25-4997-9ae2-550248988a24" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Skills in BMS correspond to groups in Zendesk. Using them in a knowledge item allows you to assign the ticket to a group when it is created. For this, the group must contain at least one user.
{% endhint %}

To add a user to a group, simply click on the group in question, then click the "+" button on the right next to the user you want to add.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FWEYcfBEHwTZROzwOpbXf%2Fimage.png?alt=media&#x26;token=6c419606-1986-4d76-90c5-805bc2f7d379" alt=""><figcaption></figcaption></figure>

2. Create a knowledge item on the BMS

Then add the context condition to the knowledge item. This context condition is automatically created when the skill is created in the BMS.

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FnG9JJsRcS6c8KiCiIPQg%2Fimage.png?alt=media&#x26;token=033adb65-cb54-459b-9c12-74d5e8ad52a2" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
Don’t forget the “connect to livechat” GUI action in the response options of the knowledge item you just created.
{% endhint %}

<figure><img src="https://264031769-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPMvi3Izk7dvjl9HitZpp%2Fuploads%2FFNu1bRvyaUnqDUZDIOkz%2Fimage.png?alt=media&#x26;token=9e363453-c39a-42e2-991f-8bbb839a916c" alt=""><figcaption></figcaption></figure>

3. Livechat escalation test

Don’t forget to publish the knowledge item. Open the preview page of your chatbox created via Channels and trigger the knowledge item created in step 2 to activate escalation to Zendesk Livechat.

### Expected results

* **In the Dydu Chatbox** : the end user switches to a conversation with a human operator while staying in the same conversation. They can receive messages and attachments sent by the operator in real time.
* **On the Zendesk interface** : when a new message arrives, the operator receives a notification. They can access the conversation from the notification or the ticket list, view the conversation history, reply to the user, and send attachments. The ticket must be assigned to a group if you have a context condition that matches a skill defined in the livechat escalation knowledge item.
