How to set up a callback function in CRM to add Zoho Sign document details that is triggered by the Zoho Sign webhook?

How to set up a callback function in CRM to add Zoho Sign document details that is triggered by the Zoho Sign webhook?

ScenarioWithin a Custom module in ZohoCRM, I have set up an automation to send documents to Zoho Sign. Each time I want to view the documents, I need to view them at Zoho Sign. Can I set up a callback function in CRM to add Zoho Sign document details that is triggered by the Zoho Sign webhook?

  1. Custom Modules allow the user to send customized attachments (completion certificate, signed copy of the document) as per the user's requirement.
  2. When you have sent documents to sign using Automation/Workflows. These docs will only be available in Zoho Sign but will not be updated back in crm. Once you have setup this code, this will help you to create/update Zoho Sign docs entry in CRM.
  3. You can view the set up function by clicking here.
Paste the code that is given below. 
Note: In this example code, the Custom Module name is "Commercial_Terms". Use the replaced module name when using the code.
  1. crmAPIRequestMap = crmAPIRequest.toMap();
  2. //crmAPIRequest is the parameter passed to this function
  3. request_body = crmAPIRequestMap.get("body");
  4. info request_body;
  5. requestMap = request_body.toMap();
  6. response = Map();
  7. response.put("status_code",200);
  8. response.put("Content-Type","application/json");
  9. hasRequests = requestMap.containKey("requests");
  10. if(requestMap.containKey("requests"))
  11. {
  12. requestStr = requestMap.get("requests");
  13. requestObj = requestStr.toMap();
  14. notificationObj = requestMap.get("notifications").toMap();
  15. response.put("body",{"what we got":requestObj});
  16. if(requestObj.containKey("request_status"))
  17. {
  18. reqStatus = requestObj.get("request_status");
  19. requestId = requestObj.get("request_id");
  20. response.put("body",{"request_id":requestId});
  21. info "Record found";
  22. document_ids = requestObj.get("document_ids");
  23. records = zoho.crm.searchRecords("Commercial_Terms","(Sign_Request_Id:equals:" + requestId + ")");
  24. if(records.size() > 0 && reqStatus.equals("completed") && notificationObj.get("operation_type").equals("RequestCompleted"))
  25. {
  26. info "Record found";
  27. leadid = records.get(0).get("id");
  28. for each  document in document_ids
  29. {
  30. document_id = document.get("document_id");
  31. //Signed Document Download
  32. fileResponse = invokeurl
  33. [
  34. url :"https://sign.zoho.com/api/v1/requests/" + requestId + "/documents/" + document_id + "/pdf"
  35. type :GET
  36. connection:"Zoho Sign"
  37. ];
  38. docName = fileResponse.getFileName();
  39. fileResponse.setFileName(docName);
  40. zoho.crm.attachFile("Commercial_Terms",leadid,fileResponse);
  41. }
  42. //Completion Certificate Download
  43. fileResponse2 = invokeurl
  44. [
  45. url :"https://sign.zoho.com/api/v1/requests/" + requestId + "/completioncertificate"
  46. type :GET
  47. connection:"Zoho Sign"
  48. ];
  49. // Attaching the documents to the Custom Module
  50. zoho.crm.attachFile("Commercial_Terms",leadid,fileResponse2);
  51. response.put("body",{"attached to record":leadid});
  52. }
  53. }
  54. else
  55. {
  56. response.put("body",{"no request status":requestObj});
  57. }
  58. }
  59. else
  60. {
  61. info "Error";
  62. response.put("body",{"error":"No requests key"});
  63. }
  64. return {"crmAPIResponse":response};

    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

                                                                                                          • How do I set up a callback function in CRM to add Zoho Sign document details?

                                                                                                            Scenario: I have set up an automation in ZohoCRM to send documents to Zoho Sign. Each time I want to view the documents, I need to view them at Zoho Sign. It is difficult to view the document status this way. Can I set up a callback function in CRM ...
                                                                                                          • Zoho Sign credits

                                                                                                            What are Zoho Sign credits and what are they used for? Zoho Sign credits are a prepaid add-on that requires an additional purchase on top of the subscription cost of the Zoho Sign general licensing plans. Zoho Sign credits are consumed when users in ...
                                                                                                          • Integrating Zoho Sign with Zoho People

                                                                                                            Available in all Data Centers. From onboarding documents to exit letters, the HR department handles tons of employee and company information. Most of these documents will require signatures from the employees, after which they need to be returned and ...
                                                                                                          • Creating Templates in Zoho People

                                                                                                            Available in all data centers. Administrators and template owners can create and send templates directly from Zoho People, or you can create and import templates from your Zoho Sign account. Creating templates in your Zoho People account From your ...
                                                                                                          • Zoho Sign integration with Pipedrive

                                                                                                            Available only in Enterprise edition Zoho Sign now integrates with Pipedrive, customer relationship management software that helps small and medium businesses to manage their sales pipeline. This integration can help sales team to directly send ...
                                                                                                            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