# Zendesk

## Integration Steps:

### Step 1: Create a conversation field &#x20;

Create a conversation field by going to [Zendesk admin center](https://zipy.zendesk.com/admin/home). Go to **Objects and rules** then go to fields.&#x20;

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

Click on Add Field and select the type as **Text**.

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

Set the permissions to **Customers can edit .**

<figure><img src="/files/8yOY90NoqRicTOjREkCN" alt=""><figcaption></figcaption></figure>

Save the field and copy its field id, this will be needed in later steps.&#x20;

### Step 2: Install Zendesk chat widget

Go to channels in Zendesk admin center. Go to Channels section. Then go to messaging under messaging and social section. Create a channel if not created. Scroll to the Installation section and copy the code. Just paste this code snippet in before the closing `</body>` tag.

### Step 3: Code to get Zipy session Url in Zendesk conversation

```javascript
<script>
  setTimeout(() => {
    const zipySessionUrl = window.zipy.getCurrentSessionURL();
    zE("messenger:set", "conversationFields", [
        { id: <FIELD_ID>, value: zipySessionUrl }
    ]);
  }, 1500);
</script>

```

*Note : Replace \<FIELD\_ID> by yours.*

*Note : setTimeout is used here to get zipy sesison url after zipy is initialized.*

Refer this documentation for more info on Zendesk messenger events : <https://developer.zendesk.com/api-reference/widget-messaging/web/core/#set-conversation-fields>&#x20;

### Step 4: Zipy Session URL in Zendesk&#x20;

After the above steps are completed whenever a user visits your application and starts conversation you can see the users' Zipy session url in Zendesk.&#x20;

When viewing a specific conversation in Zendesk, navigate to the left panel. Here, you should find the field which you have created in previous steps to store Zipy session url along with its corresponding value, which represents the Zipy session URL.

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

**Important Note:** If you are using **Web Widget (Classic)** from Zendesk, as it does not allows you to update conversation field, you can send Zipy session url in pages viewed section using the script given below.

```javascript
<script type="text/javascript">
  // Note : Insert this script after the Zendesk Installation script
  // This script will add the Zipy session URL to the Zendesk conversation's "pages viewed" section
  setTimeout(() => {
    const zipySessionUrl = window.zipy.getCurrentSessionURL();
    
    zE('webWidget', 'updatePath', {
      url: zipySessionUrl,
      title: "Zipy session"
    });
  },1500);
</script>
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zipy.ai/integration/zendesk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
