Automation #10 - Auto Assign Ticket based on Keywords

Automation #10 - Auto Assign Ticket based on Keywords



This is a monthly series designed to help you get the best out of Desk. We take our cue from what's being discussed or asked about the most in our community. Then we find the right use cases that specifically highlight solutions, ideas and tips on optimizing your customer support with the automation capabilities of Zoho Desk.


Zoho Desk offers you a few choices on how to assign your tickets. From Direct assignment to Round Robin rules, every variation cued to assign tickets in a way best suited to your business workflow.

 

These features can help you create a viable workflow easily. Even in cases when you'd like to add more context to open tickets and assign them based on their content. For example, you have a Direct Assignment rule based on a State. As per the rule any ticket originating from that State is automatically assigned to a specific Agent, say Agent 1. However, after a few conversations, the customer refers to the keyword refund in their email content. At which point you want it to include the Refund team automatically. This can be achieved using a custom function, which reads the keyword in the email replies of a customer, and automatically assigns any email matching the keyword to the concerned team based on the rule set.


We have replaced Auth-tokens with connections for all the existing custom functions. So the first step to make the most of ZohoDesk's automation capabilities is to create a connection to use in the custom function later.

 

To create the connection, carry out the following steps: 

  1. Click on Setup > Developer Space > Connections 
  2. Click Create Connection
  3. In the Pick Your Service section, under Pre-Defined Services find and select Zoho OAuth
  4. In the Connection Details section, add zohodesk as the Connection Name and Connection LinkName
  5. In the Choose Scopes list, select Desk.tickets.READ
  6. Click Create and Connect
  7. In the page that appear, click Connect
  8. If you have more than one portal associated, select the Portal to which this connection should be added and click Accept.

To create the custom function, follow the steps below: 

  1. Go to Setup, and under Automation, click Workflows.
  2. On the left panel, under Workflows, click Rules > Create Rule.
    In the Basic Information section, carry out the following steps:
  3. In the Module drop-down menu, select Tickets.
  4. Enter a name and description for the rule.
  5. If you want to activate the rule right away, select the Active checkbox. Else, you can just create the rule now and activate it later, on the Rules page.
  6. Click Next.

    In the Execute on section, perform the following steps:

  7. Select the Create checkbox to execute this rule every time a new ticket is created.  
  8. Click Next.

    In the Criteria section, if you want to create a ticket just based on the keywords, then do not select any criteria and move to the next section.

    In the Actions section, carry out the following steps:

  9. Click the + icon and select Custom Functions > New
  10. Click Edit Arguments
  11. In the Name field type TicketID, and from the Value drop-down list select Ticket Id under Ticket Information.
  12. In the script window, input the Custom Function you find below:

orgId = "paste orgId here";
DepartmentB_id = "paste department B id here";
keyword1 = "paste keyword value here";
keyword2 = "paste keyword value here";
TicketInfo = zoho.desk.getRecordById(orgId, "tickets", TicketID);
subj = TicketInfo.get("subject");
threads = zoho.desk.getRelatedRecords(orgId,"threads","tickets",TicketID).get("data").toList();
threadId = threads.getJSON("id");
Message_body = invokeurl
[
url :"https://desk.zoho.com/api/v1/tickets/" + TicketID + "/threads/" + threadId + "?include=plainText"
type :GET
connection:"zohodesk"
];
Message_body = Message_body.getJSON("plainText");
if ( Message_body.containsIgnoreCase(keyword1) || Message_body.containsIgnoreCase(keyword2) || subj.containsIgnoreCase(keyword1) || subj.containsIgnoreCase(keyword2)   )
{
info zoho.desk.ticket.move(orgId, TicketID, DepartmentB_id);
}

Note: The connection name used in the above script should match the name that you provided while creating the connection.

Stay tuned for more such use cases!


    • Related Articles

    • Zoho CRM Now Supports Zia Scores in Automation for Every Module

      Greetings! Zoho introduced significant updates to Zoho CRM’s scoring capabilities, enhancing the existing Multiple Scoring Rules (MSR) with powerful new additions—including Zia Scores. These improvements allow deeper behavioral analysis through ...
    • Take Your Marketing to the Next Level with WhatsApp Automation

      Zoho introduced two new features to our WhatsApp integration: Automation and Utility Conversations. These additions will help streamline your marketing efforts by automating messages and delivering essential information to your customers seamlessly. ...
    • Zoho Desk Now Helps You Write Better, Faster Ticket Replies

      A quicker, more efficient way to manage ticket replies is here—with powerful generative AI tools now integrated into the ticket detail view. These intelligent features are built to ease the workload on support agents, enhance communication quality, ...
    • Zoho DataPrep: Enhances Automation with 12 New External Connectors

      Zoho just made data management even easier - Zoho DataPrep now supports 12 new external connectors to help you build more robust, scalable ETL pipelines. Why it matters: ✅ Broader data access ✅ More automation, less manual work ✅ Smarter pipelines, ...
    • Launching Zoho Marketing Automation 2.0

      Dear marketers, We are excited to announce the launch of Zoho Marketing Automation 2.0! We are sincerely grateful to the community for their support, encouragement, and feedback in this journey. Many members would be eager to get their hands on this ...