Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DocuSign auto Archive

Replacement for the Relay.app workflow "DocuSign auto Archive" (📝).

Once a day, sync.py finds DocuSign envelopes marked Completed in the last 72 hours, and for each one not yet logged:

  1. downloads the combined signed PDF ({updated_at}_{email_subject}.pdf)
  2. uploads it to the Drive folder DocuSign_Archive
  3. appends a row to the DocuSign_Signed_Documents sheet (Envelope URL | Email subject | Status | Created at | Updated at | Drive file URL)
  4. sends a Slack DM to the configured recipients

The run is idempotent — dedupe is done against envelope IDs already present in column A of the sheet, so a missed day is caught up automatically and nothing is ever processed twice.


1. Credentials setup (one-time)

DocuSign (JWT grant)

  1. DocuSign Admin → Apps and Keys → add app → note the Integration Key.
  2. Generate an RSA keypair in the app settings, save the private key.
  3. Note your API Account ID and the User ID (GUID) of the user to impersonate (visible on the same page).
  4. Grant one-time consent by opening (prod): https://account.docusign.com/oauth/auth?response_type=code&scope=signature%20impersonation&client_id=INTEGRATION_KEY&redirect_uri=REDIRECT_URI_FROM_APP

Google (service account)

  1. Google Cloud Console → create project → enable Drive API and Sheets API.
  2. Create a service account, download the JSON key.
  3. Share the DocuSign_Archive Drive folder and the DocuSign_Signed_Documents sheet with the service account's email (Editor).

Slack (bot)

  1. api.slack.com/apps → create app → OAuth scopes: chat:write, users:read, users:read.email.
  2. Install to the Marinade workspace, note the Bot User OAuth Token (xoxb-...).

2. Environment variables

Variable Value
DS_INTEGRATION_KEY DocuSign integration key
DS_USER_ID impersonated user GUID
DS_ACCOUNT_ID DocuSign API account ID
DS_PRIVATE_KEY_B64 base64 -w0 private.key
DS_ENV prod
GOOGLE_SA_JSON_B64 base64 -w0 service-account.json
DRIVE_FOLDER_ID 1wmVwdUYm0QRRTykr5sdwnzy_UNpPNkJ4
SHEET_ID 1UcqpJ0LdVhLmKLGTiqq-ttLb5GA7aPbT7L_-MFOuMrY
SHEET_TAB tab name of the index sheet
SLACK_BOT_TOKEN xoxb-...
NOTIFY_EMAILS andrea@marinade.finance (comma-separated for more)
LOOKBACK_HOURS 72

3. Option A — Claude Code Routine (runs on Anthropic cloud)

  1. Push this repo to GitHub.
  2. claude.ai → Settings → Environments → create environment docusign-archive:
    • env vars: everything from the table above
    • allowed network domains: account.docusign.com, *.docusign.net, oauth2.googleapis.com, www.googleapis.com, slack.com, pypi.org, files.pythonhosted.org
    • setup script: pip install -r requirements.txt
  3. claude.ai/code/routines → New routine:
    • repo: this one, environment: docusign-archive
    • trigger: scheduled, daily (e.g. 07:00)
    • prompt: see routine-prompt.md
  4. Trigger a manual run first and watch the log.

4. Option B — GitHub Actions (no Anthropic dependency at runtime)

  1. Repo → Settings → Secrets → add all env vars as Actions secrets.
  2. The workflow in .github/workflows/docusign-archive.yml runs daily at 06:30 UTC and can be triggered manually via Run workflow.

First run

Set LOOKBACK_HOURS high enough to cover the gap since Relay.app was turned off (e.g. 240 for 10 days), run once manually, then set it back to 72.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages