Pull Adobe Acrobat Sign Agreements into Zoho Creator with Deluge

Sync Adobe Acrobat Sign Agreements into Zoho Creator

If your agreements live in Adobe Acrobat Sign but your operations live in Zoho, you end up checking two systems to answer one question. This function pulls agreements and their status into a Creator form so you can report on signature progress next to everything else.

Almost none of the original still applies. It was written against EchoSign, which became Adobe Sign and is now Adobe Acrobat Sign, and every layer changed underneath it. The API version went from v4 to v6. Authentication changed: v6 rejects the old Access-Token header and requires Authorization: Bearer. And the host is no longer generic — calls now go to a shard such as api.na4.adobesign.com, and the wrong one returns INVALID_API_ACCESS_POINT. The old api.echosign.com hostnames do still answer, but they are undocumented legacy with no published retirement date.

Two real bugs in the original, worth knowing about. First, it parsed a JSON response with executeXPath, building parallel lists of names, emails and statuses. Second — and this is the one that silently corrupted data — the index counter i was incremented inside the “agreement not already stored” branch, while the loop advanced regardless. The moment one agreement was already in the table, every subsequent record got another agreement’s name, email and status. It also began by deleting the entire table on every run, and compared with a single =. The rewrite reads each field from the agreement object it belongs to, so there is no counter to get out of step.

Before you start

  • An integration key from Acrobat Sign: Account Settings → Acrobat Sign API → API Applications. Integration keys do not expire, which is what makes them workable for an unattended script — Acrobat Sign has no client_credentials grant.
  • An EcoSign_Data form with Agreement_ID, Name, Email, Status.
  • Store the key in a Creator variable. It is shown inline below only for readability.

Deluge function

// ============================================
// ADOBE ACROBAT SIGN -> ZOHO CREATOR
// Pulls agreements and their signed-document URLs into a Creator form.
// ============================================

void Updates.syncAgreements()
{
    INTEGRATION_KEY = "YOUR_ACROBAT_SIGN_INTEGRATION_KEY";

    headerMap = Map();
    headerMap.put("Authorization","Bearer " + INTEGRATION_KEY);

    // --- 1. Find your shard. Wrong shard = INVALID_API_ACCESS_POINT. ---
    baseResp = invokeurl
    [
        url  : "https://api.na1.adobesign.com/api/rest/v6/baseUris"
        type : GET
        headers : headerMap
    ];
    apiBase = baseResp.getJSON("apiAccessPoint");     // e.g. https://api.na4.adobesign.com/
    if(apiBase == null)
    {
        info "Could not resolve Acrobat Sign shard: " + baseResp.toString();
        return;
    }

    // --- 2. List agreements ---
    agreementsResp = invokeurl
    [
        url  : apiBase + "api/rest/v6/agreements"
        type : GET
        headers : headerMap
    ];

    agreements = agreementsResp.getJSON("userAgreementList");
    if(agreements == null)
    {
        info "Acrobat Sign error: " + agreementsResp.toString();
        return;
    }

    // --- 3. Upsert each agreement. No table wipe, no index counter. ---
    for each agreement in agreements
    {
        agreementId = agreement.getJSON("id");
        existing = EcoSign_Data[Agreement_ID == agreementId];

        if(existing.count() == 0)
        {
            // Every field is read from THIS agreement, so nothing can misalign
            signerEmail = "";
            participants = agreement.getJSON("participantSetsInfo");
            if(participants != null && participants.size() > 0)
            {
                members = participants.get(0).getJSON("memberInfos");
                if(members != null && members.size() > 0)
                {
                    signerEmail = members.get(0).getJSON("email");
                }
            }

            insert into EcoSign_Data
            [
                Added_User   = zoho.loginuser
                Agreement_ID = agreementId
                Name         = agreement.getJSON("name")
                Status       = agreement.getJSON("status")
                Email        = signerEmail
            ];
        }
        else
        {
            // Refresh status on agreements already stored
            rec = existing;
            rec.Status = agreement.getJSON("status");
        }
    }
}

Notes

  • The endpoint is baseUris, camelCase. Adobe’s own best-practices page writes it as base_uris — that is the v5 spelling and returns 404 NOT_FOUND on v6. This one costs people an afternoon.
  • Resolve the shard once, then cache it. Any valid shard will answer /baseUris and tell you the right one. Store apiAccessPoint and only look it up again if a call returns INVALID_API_ACCESS_POINT.
  • Do not poll in a loop. Acrobat Sign added dynamic throttling — you will get 429 with a Retry-After header, and there is now a limit on repeated identical GETs. For status changes, use their webhooks and let Acrobat Sign call you.
  • Sending, not just reading. The outbound direction is two calls: POST the file to /api/rest/v6/transientDocuments as multipart, then POST to /api/rest/v6/agreements with that transientDocumentId and "state":"IN_PROCESS". A transient document stays valid about seven days.

This script is part of the free Creator Scripts Deluge Library.

All 39 Deluge scripts, the full Zoho Creator course, and every downloadable asset are now free. Get free access →