Start integrating with ONEiO for free!
SIGN UP

How to implement the merge feature in Zendesk

In the upcoming article, we'll walk you through how to automatically merge multiple Zendesk tickets that meet certain requirements, helping you make your customer support more efficient.

Prerequisite: 

Create a trigger for merging tickets in Zendesk

We begin by creating a new Trigger in Zendesk.

Navigate to Objects and Rules > Triggers in Zendesk and click on the "Add trigger" button.

Here add as a condition:

  • Ticket is Created

and as action:

  • Notify active webhook > Send message to ONEiO

In Trigger Update, in addition to the existing condition Update via is not Web service, add the new condition:

In the list of properties in the JSON body, add the property:

"operation": "create"

For the implementation of the merge rule, we will utilize three ticket properties: ticket ID, title, requester, and operation.

Monosnap Zendesk Admin Center 2023-08-21 14-56-08.png

Monosnap Zendesk Admin Center 2023-08-21 14-52-26.png

In the JSON body add the the following code snippet:

{
"ticket": {
"id": "{{ticket.id}}",
"external_id": "{{ticket.external_id}}",
"title": "{{ticket.title}}",
"description": "{{ticket.description}}",
"requester_email": "{{ticket.requester.email}}",
"assignee_name": "{{ticket.assignee.name}}",
"priority": "{{ticket.priority}}",
"operation": "create",
"created_at_with_timestamp": "{{ticket.created_at_with_timestamp}}",
"latest_comment" : {
"id" : "{{ticket.latest_comment.id}}",
"value" : "{{ticket.latest_comment.value}}",
"attachments" : [
{% for attachment in ticket.latest_comment.attachments %}
{
"filename" : "{{attachment.filename}}",
"url" : "{{attachment.url}}"
}
{% if forloop.last == false %}
,
{% endif %}
{% endfor %}
]
},
"sf_attachments" : [
{% for attachment in ticket.latest_comment.attachments %}
{
"filename" : "{{attachment.filename}}",
"url" : "{{attachment.url}}"
}
{% if forloop.last == false %}
,
{% endif %}
{% endfor %}
]
}
}

Now, click on Save, and all is set up in Zendesk.

 

Edit message type "search" to customize the search to your use case

In ONEiO, go to your Zendesk endpoint, navigate to Entity Types tab, and click on message type Search.

Here you can edit the URL for Target for UPDATE.

For the search, construct the API request according to your specific use case and your search criteria, such as identifying tickets matching subjects, tickets matching both subject and description, or those with matching subject and requester.

Below is an example:

  • Merge tickets with the same subject, requester, and status is 'not closed':
https://[your_zendesk_uri]/api/v2/search.json?query=type:ticket%20subject:%27${uriEncode:subject}%27%20-status:closed%20requester:${uriEncode:requester}

Note: ticket status is not closed is mandatory since tickets that have been closed are not mergeable.

 

Message type: Search

The target for UPDATE will have the conditions we want to use to map the tickets: tickets with the same subject and the same requester will be merged.

In Zendesk docs, you can check the fields that are usable for making these conditions.

https://[your_zendesk_uri]/api/v2/search.json?query=type:ticket%20subject:%27${uriEncode:subject}%27%20-status:closed%20requester:${uriEncode:requester}

 

Monosnap ONEiO: Linda's sandbox 2023-08-18 15-38-41.png

Let's take a closer look at the API call in the field Target for UPDATE and break it down: 

Monosnap https:::{subdomain}.zendesk.com:api:v2:search.json - My Workspace 2023-08-21 09-49-28.png

  • Type of object to access: this is Zendesk's specific. They have various object data such as user, organization, ticket, etc. For more information, read this Zendesk article.
  • Attribute: is the ticket feature(s) you want to look for: subject, description, status...
  • Value: is the value of the attribute.

Monosnap https:::{subdomain}.zendesk.com:api:v2:search.json - My Workspace 2023-08-21 12-42-24.png

 

Message type: Merge

This message type is more straight-forward and it requires only adding in Target for UPDATE field:

/api/v2/tickets/${id}/merge

 

Create rules in ONEiO

In ONEiO, we will build two distinct rules: one dedicated to searching for duplicate tickets, and the other responsible for processing the outcomes derived from this search.

In this particular example, we will implement the rule so that tickets with the same subject, requester and are not closed will be merged.

Rule: Search tickets

The rule Search duplicate tickets is responsible for searching through the list of tickets and finding the ones that meet our conditions (i.e. tickets with the same subject OR tickets with the same subject and description OR tickets with the same requester, etc.). The conditions are flexible and depend on your specific use case.

This rule checks if the ticket is a new one (i.e., has been just created) and runs a search if there are any other existing tickets.

In the Outbound attributes tab, map the title and the requester:

Monosnap ONEiO: Linda's sandbox 2023-08-18 15-40-38.png

In the Conversation variables tab, map the ticket ID:

Monosnap ONEiO: Linda's sandbox 2023-08-18 15-40-55.png

Rule: Process search results:

After the ticket search is completed and matches are found, we need to apply a rule that actually merges them.

This is how the rule is configured:

Monosnap ONEiO: Linda's sandbox 2023-08-18 16-05-29.png

Monosnap ONEiO: Linda's sandbox 2023-08-18 16-06-12.png

Now you are all set! If you require any help with Zendesk's merge feature, please don't hesitate to reach out at support@oneio.cloud.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.