How to Automatically Attach Signed Documents from Zoho Sign to Zoho CRM Module & Zoho WorkDrive using webhook (Step-by-Step Guide)

How to Automatically Attach Signed Documents from Zoho Sign to Zoho CRM Module

Introduction

In this tutorial, you will learn how to automatically upload signed documents from Zoho Sign to Zoho CRM and store them in Zoho WorkDrive using a webhook and Deluge function.

This automation helps eliminate manual work and ensures that all signed documents are securely stored and linked to the correct CRM records.


Use Case / Scenario:

In many business processes like agreements, contracts, or onboarding forms:

  • Documents are sent via Zoho Sign
  • Once signed, users manually download and upload them to CRM

This manual process is:

  • Time-consuming
  • Error-prone
  • Not scalable

With this solution:

  • Everything is automated
  • Documents are stored correctly
  • CRM records stay updated

Prerequisites

Before implementing this solution, ensure:

  • Zoho CRM access is available
  • Zoho Sign is configured
  • WorkDrive folder field is present in CRM
  • Required API connections are create

Step-by-Step Implementation

Step 1: Create a Standalone Function in Zoho CRM

  1. Log in to Zoho CRM.

  2. Navigate to SettingsDeveloper SpaceFunctions.

  3. Select the category Standalone Function.

  4. Write the Deluge function below.

Step 2: Add the Deluge Function with Code Explanation

This function calls Zoho Sign API to download the completed document.If the document contains a single file, it will be downloaded as a PDF.


string standalone.Webhook_signed_function1(String crmAPIRequest) 

/*

  • Converts webhook data into a readable format
  • Extracts the request_id from the payload
  • */

    crmAPIRequestMap = crmAPIRequest.toMap(); 

    request_body = crmAPIRequestMap.get("body"); 

    request_id = request_body.get("requests").get("request_id"); 

     info request_id; 

     /*

  • Downloads the signed document from Zoho Sign
  • Retrieves the file name
  • */

    respDoc = zoho.sign.downloadDocument(request_id); 

    fileName = respDoc.getFileName(); 

     /*

  • Finds the CRM record linked with the document
  • Matches based on request_id
  • */

    response = zoho.crm.searchRecords("Deals","(Zoho_Sign_Signing_Form_ID:equals:" + request_id + ")"); 

     if(response.size() > 0) 

    /*

  • Extracts the WorkDrive folder ID
  • Uploads the signed document to the folder
  • */

    drive_folder = response.get(0).get("Sales_Workdrive").getSuffix("https://workdrive.zoho.eu/folder/"); 

     uploadtoWD = zoho.workdrive.uploadFile(respDoc,drive_folder,fileName,false,"workdrive_connection");

    /*

  • Updates the CRM record
  • Marks the document as completed
  • */

     sid = response.get(0).get("id"); 

     m = Map(); 

     m.put("Signing_Form_Completed",true); 

     update = zoho.crm.updateRecord("Deals",sid,m); 

    }

     return ""; 

    }


    How This Automation Works (Data Flow Explanation)

    When a document is signed in Zoho Sign, the entire process works automatically in the following sequence:

    1. Zoho Sign triggers a webhook when the document status becomes “Completed by all”
    2. The webhook sends a payload containing the request_id
    3. The Deluge function receives this request
    4. The function uses the request_id to download the signed document
    5. It searches the corresponding record in Zoho CRM
    6. The document is uploaded to the linked Zoho WorkDrive folder
    7. The CRM record is updated to mark the process as completed

    Please refer below Function setup Screenshot for your reference :-




    Understanding Key Concepts


    What is a Webhook?

    A webhook is a method that allows one application to send real-time data to another application.

    In this case:

    • Zoho Sign sends a webhook to Zoho CRM
    • It triggers when a document is “Completed by all”
    • The webhook contains a request ID, which is used to fetch the signed document

    What is request_id?

    The request_id is a unique identifier for each document sent via Zoho Sign.

    It is important because:

    • It helps fetch the correct signed document
    • It connects Zoho Sign data with the correct CRM record

    Step 3: Enable REST API

    1. Click the three-dot (⋮) icon next to the function
    2. Select REST API
    3. Enable API Key
    4. Copy the generated URL

    Step 4: Configure Webhook in Zoho Sign

    1. Open the Zoho Sign application and navigate to SettingsDeveloper SettingsWebhooks.
    2. Paste the copied REST API URL into the Callback URL field, enter a name, and select the criteria for the documents for which the callback should be triggered.
    3. Set the Callback Events to “Completed by all.”

    Please refer to the attached Zoho Sign Application Webhook Setup screenshot for your reference.





    Output / Result

    After successful execution:

    • The signed document is stored in the WorkDrive folder linked to the CRM record
    • The CRM record is updated with the completion status
    • Users can directly access the document from CRM without manual upload


    Who Should Use This?

    This solution is useful for:

    • Zoho CRM developers
    • Businesses managing contracts
    • Teams handling signed documents regularly


    Common Errors & Solutions

    1. Error: request_id not found - Make sure webhook payload is correctly configured in Zoho Sign
    2. Error: CRM record not found -  Verify that the request_id is stored correctly in the CRM field
    3. Error: WorkDrive upload fails - WorkDrive connection permissions or  Folder access rights
    4. Error: Function not triggered - Webhook URL is correct or Event is set to “Completed by all”


    Pro Tips (Boost Value) 

    1. Always validate webhook data before processing
    2. Use logging (info) for debugging
    3. Keep your API connections secure
    4. Test with sample documents before going live


    Conclusion

    This automation significantly improves efficiency by automatically managing signed documents within Zoho CRM and WorkDrive. It reduces manual effort, minimizes errors, and ensures that all important documents are stored in the correct location.

    Post a Comment