Skip to content

Instantly share code, notes, and snippets.

@jeznag
Created October 2, 2021 07:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeznag/e9da3b94ab192297314a6ef2c18fc7bf to your computer and use it in GitHub Desktop.
Save jeznag/e9da3b94ab192297314a6ef2c18fc7bf to your computer and use it in GitHub Desktop.
Fetch unopened Zoho Sign docs deluge script
inprogress_document_results = invokeurl
[
url :"https://sign.zoho.com/api/v1/requests?request_status=inprogress"
type :GET
connection: "zohosignconnection"
];
requests = inprogress_document_results.get("requests");
unopened_documents = list();
for each request in requests
{
actions = request.get("actions");
is_unopened = false;
for each action in actions
{
if(action.get("action_status") == "UNOPENED")
{
is_unopened = true;
if(action.get("recipient_email") != request.get("owner_email"))
{
request.put("unopened_recipient_email",action.get("recipient_email"));
}
}
}
if(is_unopened)
{
unopened_documents.add(request);
}
}
email = "Hi,</br>Here are the Zoho Sign documents that haven't been opened yet:</br></br><table><thead><tr><th>Document Name</th><th>Contact Email Address</th><th>Date Issued</th></tr><tbody>";
for each unopened_document in unopened_documents
{
created_time = unopened_document.get("created_time").toTime().toString("yyyy-MM-dd");
email = email + "<tr><td>" + unopened_document.get("request_name") + "</td><td>" + unopened_document.get("unopened_recipient_email") + "</td><td>" + created_time + "</td></tr>";
}
email = email + "</tbody></table>";
sendmail
[
from :zoho.adminuserid
to :"you@gmail.com"
subject :"Unopened Zoho Sign documents"
message :email
]
return email;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment