Hook APIs

Hook APIs

Event Hooks help developers to introduce their own middlewares in the execution flow of certain UI actions.

Like events, developers need to subscribe to these event hooks to control the execution of UI action by allowing or terminating the flow.

For instance, let us consider that you are creating an extension for a bug-tracking software. The extension can record Zoho Desk tickets as issues in the bug-tracking software.

Now say a support agent tries to close a Zoho Desk ticket that has been recorded as an issue in the bug-tracking software. If the issue is not resolved in the third-party tool, but the ticket is closed in Zoho Desk, it would lead to a mismatch of status, causing confusion.

To prevent such a scenario, you can configure the extension to subscribe to the Zoho Desk hook defined for the close ticket event. With this hook in place, you can further configure your extension such that when an agent tries to close the ticket, the extension checks if the corresponding issue in the third-party tool is resolved. If it is resolved, the extension can give a go-ahead to close the ticket in Zoho Desk, else the ticket close event will not be executed and a relevant message will be displayed.

Zoho Desk currently supports hooks for the following events:

  1. Reopening a ticket
  2. Closing a ticket
  3. Adding a ticket comment
  4. Editing a ticket comment
  5. Changing the status of a ticket
  6. Sending a ticket response
  7. Closing a ticket on sending ticket response

Extensions can pause the outcome of events by passing either boolean values or promises in the event handler.
  1. If the boolean value TRUE is passed, the event will be executed
  2. If the boolean value FALSE is passed, the event will be terminated.

Similarly, if the extension resolves the promise, the event will be executed, and if the extension rejects the promise, the event will be terminated. The reason for terminating the event can be displayed as an error message to end-users.

Extensions with subscriptions to hooks must respond within 30 seconds of the event getting triggered. If this time is exceeded, control provided to the extension will be lost and the event will be executed.

Multiple extensions can subscribe to a single hook. In such a scenario, the event will be executed only if all extensions subscribed to the event pass TRUE or resolve the promise. If even one extension passes FALSE or rejects the promise, the event will be terminated.

Hook to Use When a Ticket is Reopened
  1. App.instance.on('ticket.reOpen', function(){ 
  2.   //return promise or boolean
  3. })

Hook to Use When a Ticket is Closed
  1. App.instance.on('ticket.close', function(){         
  2. })

Hook to Use When a Ticket Comment is Made
  1. App.instance.on('ticket.comment', function(data){      
  2. })

Response
  1. {ticketId: "26811000000760569", content: "asdsad", isPublic: false}

Hook to Use When a Ticket Comment is Edited
  1. App.instance.on('ticket.comment.edit', function(data){                  
  2. })

Response
  1. {
  2.   "commentId":"77ff742bd3193c0278955a2b0c66c43b42acf79f93f757e8",
  3.   "oldContent":"test",
  4.   "newContent":"testre",
  5.   "ticketId":"26811000000760569"

Hook to Use When a Ticket Response is Sent
  1. App.instance.on('ticket.reply', function(data){         
  2. })

Response
  1. {
  2.   "toAddress":"support@zohodesk.com",
  3.   "ticketId":"26811000000760569",
  4.   "ticketSubject":"[## 159 ##] sd",
  5.   "threadId":"",
  6.   "fromAdddress":"\"mpdemo\"",
  7.   "ccAddress":"support@mpdemo.localzohodesk.com",
  8.   "content":"%3Cdivticket.replyetyle%3D'font-size%3A13.0px%3Bfont-family%3A%20Arial%20%2C%20Helvetica%20%2C%20Verdana%20%2C%sans-serif%3B'%3ETest%20Reply%3C%2Fdiv%3E"
  9. }

Hook to Use When a Ticket Response is Sent and the Ticket is Closed
  1. App.instance.on('ticket.replyAndClose', function(data){           
  2. })

Response
  1. {
  2.   "toAddress":"support@zohodesk.com",
  3.   "ticketId":"26811000000760569",
  4.   "ticketSubject":"[## 159 ##]  sd",
  5.   "threadId":"26811000000783105",
  6.   "fromAdddress":"\"mpdemo\"",
  7.   "ccAddress":"support@mpdemo.localzohodesk.com",
  8.   "content":"%3Cdivticket.replyasndcloseetyle%3D'font-size%3A13.0px%3Bfont-family%3A%20Arial%20%2C%20Helvetica%20%2C%20Verdana%20%2C%sans-serif%3B'%3E%3Cdiv%3ETest%3C%2Fdiv%3E%3Cdiv%3E%3Cblockquote%style%3D%22border-left%3A%201px%dotted%20%23e5e5e5%3Bmargin-left%3A5px%3Bpadding-left%3A%205px%3B%22%3E%3Cdiv%style%3D%22padding-top%3A%2010px%3B%22%3E%3Cdiv%id%3D%22ZDeskInteg%22%3E%3Cmeta%itemprop%3D%22zdeskTicket%22%20content%3D%f10fd68b0cc315920245c7c0aa2b93fdf0a3db99826a12352285b65f8e5fa7a9458849c5b9779fef3c050436477df54fca922a12fa4922ab7fd919f18ae07%22%3E%3C%2Fdiv%3E%3C%2Fdiv%3E%3C%2Fblockquote%3E%3C%2Fdiv%3E%3C%2Fdiv%3E"
  9. }

Hook to Use When the Status of a Ticket is Changed
  1. App.instance.on('ticket.status', function(data){           
  2. })

Response
  1. {
  2.   ticket.oldStatus: "On Hold", 
  3.   ticket.newStatus: "Escalated"
  4. }


    Zoho CRM Training Programs

    Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

    Zoho CRM Training
      Redefine the way you work
      with Zoho Workplace

        Zoho DataPrep Personalized Demo

        If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

        Zoho CRM Training

          Create, share, and deliver

          beautiful slides from anywhere.

          Get Started Now


            Zoho Sign now offers specialized one-on-one training for both administrators and developers.

            BOOK A SESSION








                                    You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                        Manage your brands on social media

                                          Zoho Desk Resources

                                          • Desk Community Learning Series


                                          • Digest


                                          • Functions


                                          • Meetups


                                          • Kbase


                                          • Resources


                                          • Glossary


                                          • Desk Marketplace


                                          • MVP Corner


                                          • Word of the Day


                                            Zoho Marketing Automation

                                              Zoho Sheet Resources

                                               

                                                  Zoho Forms Resources


                                                    Secure your business
                                                    communication with Zoho Mail


                                                    Mail on the move with
                                                    Zoho Mail mobile application

                                                      Stay on top of your schedule
                                                      at all times


                                                      Carry your calendar with you
                                                      Anytime, anywhere




                                                            Zoho Sign Resources

                                                              Sign, Paperless!

                                                              Sign and send business documents on the go!

                                                              Get Started Now




                                                                      Zoho TeamInbox Resources



                                                                              Zoho DataPrep Resources



                                                                                Zoho DataPrep Demo

                                                                                Get a personalized demo or POC

                                                                                REGISTER NOW


                                                                                  Design. Discuss. Deliver.

                                                                                  Create visually engaging stories with Zoho Show.

                                                                                  Get Started Now









                                                                                                      • Related Articles

                                                                                                      • Data APIs

                                                                                                        Zoho Desk provides a set of APIs that facilitate interaction between your extension and your help desk portal. The APIs available are listed below: Ticket Object Contact Object Account Object Current Call Object User Object Portal Object Department ...
                                                                                                      • Invoke APIs

                                                                                                        Below are some extra APIs that you can use in your extension.  ROUTE_TO INSERT MODAL_CLOSE RESIZE ROUTE_TO This command navigates between the multiple subtabs on the ticket detail page. Listed below are the different routes supported: ...
                                                                                                      • Extension APIs

                                                                                                        These APIs fetch or set information related to the extension. Get extension config variable: Fetch the installation parameters of the extension. In production mode, only those parameters that have the value of the secure key set to false are ...
                                                                                                      • Event APIs

                                                                                                        The following APIs help you incorporate custom functionalities in your extension when certain events occur in your help desk portal. Ticket Events You can configure extensions to receive information when an event, such as adding a comment to a ticket ...
                                                                                                      • Data Storage APIs

                                                                                                        Sometimes, the extensions you create might require data storage and retrieval capabilities. To help you in such cases, we provide a data store for extensions to set (store) and get (retrieve) data. The data can be deleted when it is no longer ...
                                                                                                        Wherever you are is as good as
                                                                                                        your workplace

                                                                                                          Resources

                                                                                                          Videos

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



                                                                                                          eBooks

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



                                                                                                          Webinars

                                                                                                          Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                          CRM Tips

                                                                                                          Make the most of Zoho CRM with these useful tips.



                                                                                                            Zoho Show Resources