Created
October 2, 2021 07:57
-
-
Save jeznag/e9da3b94ab192297314a6ef2c18fc7bf to your computer and use it in GitHub Desktop.
Fetch unopened Zoho Sign docs deluge script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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