Building Extensions #11: Creating widgets with the JS SDK bundle in Zoho Desk - Event API

Building Extensions #11: Creating widgets with the JS SDK bundle in Zoho Desk - Event API

This series aims to equip developers with all they need to build extensions for Zoho Desk in Zoho Sigma and publish them in Zoho Marketplace.

In our previous post, we discussed Data Storage APIs, their use in extensions, and how to use them in your Zoho Desk extensions. This post will briefly explain the next set of APIs in the JS SDK bundle, Event APIs, and show when and how to use them within Zoho Desk extensions.

Event APIs 

The extension you're intending to build may require you to perform an action upon the occurrence of a particular event in your Desk portal. In order to trigger that action in Zoho Desk, your extension needs to listen to those event occurrences. The Zoho Desk platform provides Event APIs, which is an SDK method that helps you incorporate custom functionalities in your extension when certain events occur in your Zoho Desk portal. The events can be both ticket- and call-related.
  • Ticket events: You can configure extensions to receive information when an event, such as adding a comment to a ticket or opening a different ticket, occurs on the ticket detail page.
  • Call events: You can configure extensions to receive information when a call-related event occurs in your help desk portal.
There are multiple events available both in ticket events and call events. Whenever a particular event occurs, the parameter (Event API) for that event is used to broadcast information from Zoho Desk. The information from that event can then be processed in your extension using other APIs based on your business needs. Every event can be invoked from multiple locations in Zoho Desk; the details of the locations supported by every event and the parameter to be passed to invoke the events are listed here.

Scenario: Let's say you're using Zoho Desk to handle your technical support queries and Zoho Projects to manage your internal tasks. Here, we'll explain a simple use case where an extension could create a task in Zoho Projects automatically whenever the ticket classification of a ticket is changed in Zoho Desk. In this instance, we'll say you classify a ticket as 'problem' in Zoho Desk and get a task created for that ticket in Zoho Projects automatically. Let's see how the Events API can be used to achieve this simple use case in your extension.
 
When an agent triggers an event change in Zoho Desk, the Event API broadcasts the information about the event's occurrence from that ticket and can be fetched for further processing. To create a task in Zoho Projects, you can use Request API to invoke the Create Task API of the Zoho Projects. If you need additional information from the ticket while creating a task, you can use the Data API to get those details.
 
Below are the steps involved to implement this use case:
  • Create a connection in Zoho Sigma with required scopes
  • Create a task in Zoho Projects using the required JS SDK methods
    • Events API: Listen to the event
    • Data API: Fetch required ticket details for creating a task in Projects
    • Request API: Invoke Create Task API in Projects

Creating a connection 

To build this extension, you must establish a connection between Zoho Desk and Zoho Projects with the required scopes. This will allow you to facilitate communication between these two services by invoking their APIs. Please check the Connectors post to learn more about creating connections. Once the connection is established, perform the following in the plugin-manifest.json file and save the file.
  1. Paste the JSON code copied from Sigma in zohoAuthorization
  2. Provide the Zoho Projects base URL (https://projectsapi.zoho.com) in whiteListedDomains
The plugin-manifest file with the connection and whitelisted domain details:
{
    "locale": ["en"],
    "service": "DESK",
    "storage": false,
    "type": "personal",
    "whiteListedDomains": ["https://projectsapi.zoho.com"],
    "modules": {
        "widgets": [
            {
                "location": "desk.ticket.detail.rightpanel",
                "url": "/app/widget.html",
                "name": "Desk Extension",
                "logo": "/app/img/logo.png",
                "icon": "/app/img/icon.png"
            }
        ]
    },
    "cspDomains": {
        "connect-src": []
    },
    "zohoAuthorisation": {
        "type": "connectors",
        "connectionLinkName": "deskproject",
        "connectionName": "DeskProject",
        "serviceName": "zlabs_integration",
        "userAccess": true,
        "isUserDefinedService": false,
        "sharedBy": "696258884",
        "scope": [
            "Desk.tickets.ALL",
            "ZohoProjects.projects.ALL",
            "ZohoProjects.tasklists.ALL",
            "ZohoProjects.tasks.ALL",
            "ZohoProjects.events.ALL",
            "Desk.basic.ALL",
            "ZohoProjects.tags.ALL",
            "ZohoProjects.status.ALL",
            "ZohoProjects.portals.ALL"
        ]
    },
    "connectors": [],
    "config": [],
    "moduleSupport": false
}

Creating a task in Zoho Projects 

Below are the code snippets of different APIs that are used in this extension. The Event API will get triggered whenever the ticket classification is changed by the agent. You need to fetch the response from the broadcasted message and check the value of the ticket classification. According to our use case, we need to create a task if the classification is "problem," so the Request API is called for the same.
 
App.instance.on("ticket_classification.changed", function (data) {
                        classif = data["ticket.classification"];
                        if (classif == "Problem") {
                            
ZOHODESK.request({url: "https://projectsapi.zoho.com/restapi/portal/" + xxx + "/projects/" + yyy + "/tasks/?name=" + encodeURI(ticketSub) + "&description=" + encodeURI(x) + "&priority=" + ticketPriority,
                                headers: {
                                    "Content-type": "application/json",
                                },
                                type: "POST",
                                data: {},
                                connectionLinkName: "deskproject",
                                postBody: {},
                                contentType: "application/json",
                            })
                                .then(function (response) {
                                    var resultparse = JSON.parse(response);
                                    var resultparse2 = JSON.parse(resultparse.response).statusMessage;
                                    var aaa = JSON.stringify(resultparse2);
                                })
                                .catch(function (err) {
                                    console.log(err);
                                });
                        }
                    });
 
All the required ticket details, including the ticket ID, subject of the ticket, ticket description, and the priority status of the ticket are fetched using the Data APIs and passed to the Zoho Projects API. This information will be filled in within the task that is being created.
 
ZOHODESK.get(["ticket.id", "ticket.subject", "ticket.description", "ticket.priority"])
                        .then(function (res) {
                            var result = res.data;
                            var a = JSON.stringify(result);
                            console.log(a);
                            ticketID = result["ticket.id"];
                            ticketSub = result["ticket.subject"];
                            ticketDesc = result["ticket.description"];
                            ticketPriority = result["ticket.priority"];
                            x = ticketDesc.replace(/<[^>]+>/g, "");
                            ticketNumber = result["ticket.number"];
                        })
                        .catch(function (err) {});
 




In this example (full code given below), we have given you a clear picture on when and how to use the Event APIs in building extensions for Zoho Desk. Though other APIs are used too, the core of this extension is triggering an action on the occurrence of an event, which is done by the Event API.
 


While invoking the Zoho Projects API, you would have noticed that the Create Task API takes two important parameters, namely PortalID and ProjectID. These are specific to users; they are needed to decide for which project the task should be created. You may wonder how this should be handled in your extension development. We have config params to help you in such scenarios.
 
We'll discuss the usage of config params in our following post. Stay tuned !
 

<<Previous                                                                                                                                    Next >>                                                                                       

    Access your files securely from anywhere







                            Zoho Developer Community





                                                  Use cases

                                                  Make the most of Zoho Desk with the use cases.

                                                   
                                                    

                                                  eBooks

                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho Desk.

                                                   
                                                    

                                                  Videos

                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho Desk.

                                                   
                                                    

                                                  Webinar

                                                  Sign up for our webinars and learn the Zoho Desk basics, from customization to automation and more

                                                   
                                                    
                                                  • Desk Community Learning Series


                                                  • Meetups


                                                  • Ask the Experts


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner






                                                            Manage your brands on social media



                                                                  Zoho TeamInbox Resources



                                                                      Zoho CRM Plus Resources

                                                                        Zoho Books Resources


                                                                          Zoho Subscriptions Resources

                                                                            Zoho Projects Resources


                                                                              Zoho Sprints Resources


                                                                                Qntrl Resources


                                                                                  Zoho Creator Resources



                                                                                      Zoho CRM Resources

                                                                                      • CRM Community Learning Series

                                                                                        CRM Community Learning Series


                                                                                      • Kaizen

                                                                                        Kaizen

                                                                                      • Functions

                                                                                        Functions

                                                                                      • Meetups

                                                                                        Meetups

                                                                                      • Kbase

                                                                                        Kbase

                                                                                      • Resources

                                                                                        Resources

                                                                                      • Digest

                                                                                        Digest

                                                                                      • CRM Marketplace

                                                                                        CRM Marketplace

                                                                                      • MVP Corner

                                                                                        MVP Corner







                                                                                          Design. Discuss. Deliver.

                                                                                          Create visually engaging stories with Zoho Show.

                                                                                          Get Started Now


                                                                                            Zoho Show Resources


                                                                                              Zoho Writer Writer

                                                                                              Get Started. Write Away!

                                                                                              Writer is a powerful online word processor, designed for collaborative work.

                                                                                                Zoho CRM コンテンツ








                                                                                                  Nederlandse Hulpbronnen


                                                                                                      ご検討中の方




                                                                                                            • Recent Topics

                                                                                                            • Unable to enable tax checkboxes

                                                                                                              Hi Zoho Commerce Support, I'm writing to report an issue I'm having with the tax settings in my Zoho Commerce store. I've created several tax rates under Settings > Taxes, but all of them appear with the checkbox disabled. When I try to enable a checkbox,
                                                                                                            • Does Zoho Learn integrate with Zoho Connect,People,Workdrive,Project,Desk?

                                                                                                              Can we propose Zoho LEarn as a centralised Knowledge Portal tool that can get synched with the other Zoho products and serve as a central Knowledge repository?
                                                                                                            • Zoho Commerce - Enable Company Name and Tax Number collection for B2B orders in Global Edition

                                                                                                              Please enable Company Name and Tax Details option on checkout settings in Zoho Commerce Global Edition. It is still important to collect Company Name and Tax Number for B2B sales in many countries. My business is based in Ireland (in the EU) and I have
                                                                                                            • ZohoSign and ZohoBooks Integration/Workflow

                                                                                                              Hello All, We utilize ZohoSign for signatures on tax eFiles. We utilize Dynamic KBA. Additionally, we use ZohoBooks for invoicing for these services. Is there a way to accomplish the following: Send a copy of the Tax Return, Invoice and eFiles in one
                                                                                                            • Manage monthly tasks with projectsf

                                                                                                              Hi All I run a finance and operations team where we need both teams to complete monthly tasks to ensure we hit our deadlines. Can Zoho projects be used for this. There many finance focused tools but we have Zoho one so want to explore Thanks Will
                                                                                                            • Zoho Suite is very slow

                                                                                                              Since today Zoho is incredibly slow over all applications! What's going on?
                                                                                                            • Field Dependency Not Working on Detail Page in Zoho Desk

                                                                                                              Hi Support Team, I’ve created field dependencies between two fields in Zoho Desk, and they are working correctly on the Create and Edit layouts. However, on the Detail page, the fields are not displaying according to the dependencies I’ve set — they appear
                                                                                                            • Is anyone else having trouble saving a custom image in their email signature, or is it just me?

                                                                                                              When I try to save the image I get an error that says "Operation Failed" I opened a support ticket two weeks ago and received a response that it would be debugged, but it still isn’t working
                                                                                                            • Combine and hide invoice lines

                                                                                                              In quickbooks we are able to create a invoice line that combines and hides invoices lines below. eg. Brochure design         $1000 (total of lines below, the client can see this line) Graphic Design           $600 (hidden but entered to reporting and
                                                                                                            • Option to Disable Knowledge Base Section in Feedback Widget Popup Hello Zoho Desk Team

                                                                                                              Hello Zoho Desk Team, How are you? We are actively using Zoho Desk and would like to make more use of the Feedback Widget. One of the ways we implement it is through the popup option. At the moment, the popup always displays the Knowledge Base section,
                                                                                                            • Transaction Locking with the dynamic date

                                                                                                              Is it possible to dynamically update dates on transaction locking. We want to lock transaction x days from today
                                                                                                            • Zoho Devops

                                                                                                              We have a Zoho one account which we have integrated with an SAS educational product, sold on a subscription model, using webhooks and API calls. We make some use of custom fields and cross module lookups and relationships. We utilize CRM, Books and billing
                                                                                                            • Fuel up your sales with the Zoho SalesIQ + Bigin integration

                                                                                                              Hi everyone! We’re happy to bring you the all-new Zoho SalesIQ + Bigin integration. With this, every prospect from your website instantly becomes a contact in Bigin, complete with transcripts and follow-up tasks, so you never lose a lead again. Let's
                                                                                                            • Dealing with API responses where integers have more than 16 digits

                                                                                                              Hi there How do I deal with an api response contaning an int or float with more than 16 digits (before any decimal places for a float). I constantly receive the response "Unable to cast the 'BigInteger' value into a 'BIGINT' value because the input is
                                                                                                            • Add a 'Log a Call' link to three dot icon in Canvas

                                                                                                              Hi, There's a three dot element when creating a canvas called 'More'. I would like to modify this to add a link that says 'Log a Call' in order to quickly record the details of a cellphone call. I'd also like this to be a simple 'contact' selection and
                                                                                                            • Collaps Notes

                                                                                                              There are times when long/large notes are added to a record i.e. Accounts or Deals etc. Currently, the full note is displayed in the notes related list section. It would be great if by default only 5 to 10 rows of the note are displayed when the note
                                                                                                            • Introducing AI-powered Assessments & Zoho's native LLM, Zia

                                                                                                              We’ve shipped a cleaner, faster way to create assessments in Zoho Recruit. 🚀 Instead of manually building question banks or copying old templates, you can now generate ready-to-use assessments in just a few clicks, all tailored to the role you’re hiring
                                                                                                            • Ability to Reset Visitor Fields During an Active Chat Flow

                                                                                                              Hello Zoho SalesIQ Team, We hope you are doing well. We would like to propose a feature enhancement to Zoho SalesIQ regarding the management of visitor fields within Zobot flows. Use Case: Our bot asks the visitor to provide information about a 3rd person
                                                                                                            • The Social Wall: August 2025

                                                                                                              Hello everyone, As summer ends, Zoho Social is gearing up for some exciting, bigger updates lined up for the months ahead. While those are in the works, we rolled out a few handy feature updates in August to keep your social media management running smoothly.
                                                                                                            • External ID in Zoho CRM

                                                                                                              Hello everyone! We know that Zoho CRM allows you to integrate third-party apps and manipulate data through APIs. While you integrate a third-party application, you may want to store the third-party reference IDs in Zoho CRM's records. To meet this need
                                                                                                            • New in Zoho Chat : Search for contacts, files, links & conversations with the all new powerful 'Smart Search' bar.

                                                                                                              With the newly revamped 'Smart Search' bar in Zoho Chat, we have made your search for contacts, chats, files and links super quick and easy using Search Quantifiers.   Search for a contact or specific conversations using quantifiers, such as, from: @user_name - to find chats or channel conversations received from a specific user. to: @user_name - to find chats or channel conversations sent to a specific user. in: #channel_name - to find a particular instance in a channel. in: #chat_name - to find
                                                                                                            • Aggregating the First Value in the Group By of a dataset

                                                                                                              Hi I am trying to get the following Aggregate Formula to work in my chart, but cannot seem to get the right format. I have a series of data that I am running an include_groupby and want to SUM only a column in the first row of each group. So for example.
                                                                                                            • New in Cadences: Option to Resume or Restart follow-ups when re-enrolling records into a Cadence, and specify custom un-enrollment criteria

                                                                                                              Managing follow-ups effectively involves understanding the appropriate timing for reaching out, as well as knowing when to take a break and resume later, or deciding if it's necessary to start the follow-up process anew. With two significant enhancements
                                                                                                            • Is it possible for contacts to "Re-enter" a workflow in Zoho Campaign?

                                                                                                              We are currently working on a way to automatically add users to from one list to other lists based on specific criteria, but can't seem to find a native way of doing this so we are trying to use Workflows to do this. So, for example, if a user's status is set to "Active," then they should be added to the list "Active Users." If the same user's status is then set to "Paused," they should be added to the list "Paused Users" and removed from the list "Active Users." This works fine for the first go
                                                                                                            • Admin Control Over Profile Picture Visibility in Zoho One

                                                                                                              Hello Zoho Team, We hope you are doing well. Currently, as per Zoho’s design, each user can manage the visibility of their profile picture from their own Zoho Accounts page: accounts.zoho.com → Personal Information → Profile Picture → Profile Picture
                                                                                                            • How can I track which zoho users are actively using Zoho CRM

                                                                                                              I have several licenses of Zoho CRM. We now need to add a new user. I could purchase a new license, but before I do, I would like to see if any of our existing users are not actively using the license assigned to them. How can I determine the activity
                                                                                                            • Seriously - Create multiple contacts for leads, (With Company as lead) Zoho CRM

                                                                                                              In Zoho CRM, considering a comapny as a lead, you need us to allow addition of more than one contact. Currently the Lead Section is missing "Add contact" feature which is available in "Accounts". When you know that a particular lead can have multiple
                                                                                                            • Track Zoho Campaign and Workflow sales impact

                                                                                                              I am attempting to measure the performance of our marketing workflows and campaigns by comparing the date each campaign was sent to a contact with the purchase date of the contact. For example, if Contact A was sent Email A on 9/1 and made a purchase
                                                                                                            • Zoho / Outlook Calendar sync

                                                                                                              The current Marketplace -> Microsoft -> Meetings integration needs 2 changes. 1. The current language for the Two-Way sync option should be changed. It currently states, "Sync both your Zoho CRM Calendar and Office 365 Calendar meetings with each other."
                                                                                                            • Tables for Europe Datacenter customers?

                                                                                                              It's been over a year now for the launch of Zoho Tables - and still not available für EU DC customers. When will it be available?
                                                                                                            • What is a line break code for zoho?

                                                                                                              Hi, I am archiving data by adding values from a single line field from one form to a multi-line field in another form. So I need a code/function that starts a new line on that multi-line field so it does not just keep adding it on the same line. Example, doing something like this means that it will be on a same line. archive.field1 = archive.field1 + input.Field1 I need a code so the input.Field1 can just start on the next line. Instead of "value 1, 2,3,4,5" It will be: "1 2 3 4 etc.".  something
                                                                                                            • Automatic Project Owner change

                                                                                                              Is there a way to change Project Owner automatically once a specific Milestone in a project is marked as completed. Different Teams are working on projects in our Org, they have their own Milestones to complete and so we transfer the project from team
                                                                                                            • Button to add product to cart

                                                                                                              Is there a way to have a button on a page, that when clicked, will add Qty 1 of a product to the cart?
                                                                                                            • Problem with Submit Button Design

                                                                                                              I have made a template to apply to my forms and under the button controls, I have it set to "standard" and yet it's still filling the container. This is super frustrating and looks weird. Why do we not have full control over button size? How can I fix
                                                                                                            • Zoho CRM- Authorize your Microsoft Teams account issue

                                                                                                              Hi, I tried to link Zoho CRM with Teams and I got the following message: Clicking "Authorize now" sent me to the following page, Microsoft tried to start a session but, after 3 seconds the page closed and nothing happened. I get the same message each
                                                                                                            • Passing the CRM

                                                                                                              Hi, I am hoping someone can help. I have a zoho form that has a CRM lookup field. I was hoping to send this to my publicly to clients via a text message and the form then attaches the signed form back to the custom module. This work absolutely fine when
                                                                                                            • Is there a way to associate an email in ZOHO Main to a Vendor record in ZOHO CRM

                                                                                                              My situation is as below, I have a vendor in ZOHO CRM lets say "Vend A" and an associated contact, "Cont A" If Cont A sends me an email using the email I've registered in the contact record the standard OOTB email sync will work. But the vendor has some
                                                                                                            • Adding a developer for editing the client application with a single user license

                                                                                                              Hi, I want to know that I as a developer I developed one application and handed over to the customer who is using the application on a single user license. Now after6 months customer came back to me and needs some changes in the application. Can a customer
                                                                                                            • Kaizen #207 - Answering your Questions | Advanced Queries using COQL API

                                                                                                              Hi everyone, and welcome to another Kaizen week! As part of Kaizen #200 milestone, many of you shared topics you would like us to cover, and we have been addressing them one by one over the past few weeks. Today, we are picking up one of those requests
                                                                                                            • Présentation de SecureForms dans Zoho Vault

                                                                                                              Soyons francs : demander à quelqu’un de transmettre un mot de passe ou des informations sensibles n’est jamais une tâche facile. On attend, on relance, parfois de nombreuses fois. Et quand l’information arrive, elle se retrouve souvent dispersée dans
                                                                                                            • Next Page