Skip to content

Instantly share code, notes, and snippets.

@wmcraver
Last active November 15, 2020 08:54
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wmcraver/8c75cf7fc72e100c2889efb810fafda2 to your computer and use it in GitHub Desktop.
Save wmcraver/8c75cf7fc72e100c2889efb810fafda2 to your computer and use it in GitHub Desktop.
This R script will login to your DocuSign account, retrieve a list of all envelopes, filter the list of envelopes for those with a status of 'completed', and then download said envelopes into one neat PDF. If you use this script, you will need to uncomment lines 5-7 and enter your username, password, and integrator key.
library(docuSignr)
library(dplyr)
# Create env variables based on github directions for this package. https://github.com/CannaData/docuSignr
# Sys.setenv("docuSign_username" = "username")
# Sys.setenv("docuSign_password" = "password")
# Sys.setenv("docuSign_integrator_key" = "integrator_key")
login = docu_login()
envelopeList = docu_list_envelopes(username = Sys.getenv("docuSign_username"),
password = Sys.getenv("docuSign_password"),
integrator_key = Sys.getenv("docuSign_integrator_key"),
base_url = login$baseUrl,
from_date = "2017/6/14")
envelopeList$envelopeID = gsub("/envelopes/", "", envelopeList$documentsUri)
envelopeList$envelopeID = gsub("/documents", "", envelopeList$envelopeID)
envelopeList = envelopeList %>% filter(status == "completed")
for (i in 1:nrow(envelopeList)) {
docu_download(file = paste(envelopeList$envelopeID[i], ".pdf", sep = ""),
username = Sys.getenv("docuSign_username"),
password = Sys.getenv("docuSign_password"),
integrator_key = Sys.getenv("docuSign_integrator_key"),
base_url = login$baseUrl,
envelope_id = envelopeList$envelopeID[i])
}
@phmkz
Copy link

phmkz commented May 2, 2018

hey @wmcraver - i am desperately in need for that exact same functionality, but am presented with the error below when trying to run this script.

Error in nrow(envelopeList) : object 'envelopeList' not found

any chance you can help with that!?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment