docusign.completed.pdfsharepoint.weekly.archivegraph.sendMail.batchslack.delivery.status
← Back to projects
Case study

DocuSign PDFs · SharePoint archive · Microsoft Graph email · Slack alerts

Weekly
Delivery run
DocuSign
Signed PDFs
Graph
Email delivery
Slack
Status alerts
n8nDocuSignSharePointMicrosoft GraphSlackJavaScript
Jump to proof of work

Overview

This project automates the delivery of signed DocuSign documents after they are stored in SharePoint. It collects completed PDFs, prepares a weekly archive, sends the documents by email, and posts status updates to Slack.

I used this pattern as part of the dispatch environment and also for internal delivery of signed consent documents. The public explanation stays generic so the workflow can be discussed without exposing recipients, companies, folder IDs, or original workflow data.

The important part is not only sending an email. The workflow protects the document trail by archiving first, batching large deliveries, and stopping cleanup when the expected archive is missing.

01 / Problem

The challenge

Signed documents often need to be delivered after completion, but manual collection from SharePoint is slow and easy to miss when many PDFs arrive during the week.

The workflow needed to create a reliable evidence package, send it to the right destination, and keep the SharePoint folder clean without risking accidental deletion of signed documents.

02 / Role

My role

I built the n8n workflow structure for scheduled collection, SharePoint file handling, archive creation, email delivery through Microsoft Graph, batch handling, Slack reporting, and cleanup safeguards.

I also separated the public case study from the private workflow so only the architecture and sanitized helper patterns are shown.

03 / Architecture

Workflow structure

01Weekly schedule starts the delivery workflow
02Signed DocuSign PDFs are collected from SharePoint
03Duplicate and non-root items are filtered out
04A weekly archive folder is prepared
05Files are uploaded into the archive
06Archived files are downloaded for delivery
07Attachments are prepared for Microsoft Graph email
08Large deliveries are split into smaller email batches
09Delivery status is posted to Slack
10A later cleanup checks archive safety before deleting loose files
04 / Modules

Core modules

01

Signed document collection

The workflow reads the signed document folder and keeps only the completed PDF files that belong to the current delivery scope.

02

Weekly archive

Before delivery, the files are copied into a dated weekly archive folder. This creates a stable reference point before cleanup runs.

03

Email delivery preparation

The automation prepares a structured email payload with PDF attachments. When the total attachment size is too large, it splits the delivery into multiple smaller messages.

04

Safety cleanup

The cleanup branch checks that the weekly archive exists before deleting loose files from the root folder. If the archive is missing, it stops and alerts through Slack.

05

Operational visibility

Slack messages confirm successful delivery, batch counts, cleanup completion, or safety issues that need manual review.

05 / Decisions

Technical decisions

Archive first, clean later

The workflow does not delete loose files until it can confirm that the weekly archive exists. This protects signed documents from accidental loss.

Batching protects email delivery

Large attachment sets are split into batches so the delivery can continue without depending on one oversized email.

DocuSign stays visible in the explanation

The project is named broadly, but the documentation makes clear that the workflow handles completed DocuSign PDFs.

Public material is sanitized

The public version explains the architecture and helper logic without exposing original workflow exports, folder IDs, tenant IDs, secrets, recipients, or company-specific text.

06 / Stack

Tech stack

n8nSchedules, Microsoft Graph requests, file processing, branching, waits, and status notifications
DocuSignSource of the signed document lifecycle that produces completed PDF documents
SharePointStorage location for signed documents, weekly archives, and retention cleanup
Microsoft GraphFile download, archive upload, and outbound email delivery with attachments
SlackOperational confirmations, safety alerts, and delivery visibility
JavaScriptArchive naming, attachment preparation, batch splitting, and cleanup safeguards
07 / Proof

Proof / Evidence

This case study is based on a private n8n workflow for signed document delivery. The public proof focuses on architecture, delivery logic, and sanitized snippets. Original workflow JSON, secrets, recipient data, tenant IDs, SharePoint IDs, Slack IDs, and company-specific email text are not published.

Public proof shown on this page

Weekly ScheduleGet Signed PDFsCreate ArchiveUpload FilesPrepare AttachmentsBatch EmailsSend via GraphSlack StatusSafety Cleanup

A sanitized architecture diagram showing weekly collection of signed DocuSign PDFs, SharePoint archiving, attachment preparation, email batching, Microsoft Graph delivery, Slack status updates, and safety cleanup.

Live system

The actual n8n workflow canvas for the signed document delivery automation — the same flow the architecture diagram above abstracts.

Public code & documentation

Valentino-Veljanovski / signed-document-delivery-automation-snippetsPublic

Sanitized architecture notes and JavaScript helper snippets for signed DocuSign document delivery with SharePoint archiving, Microsoft Graph email batching, cleanup safeguards, and Slack status alerts.

n8ndocusignsharepointmicrosoft-graphemail-automationdocument-deliveryslack-alertsworkflow-automationjavascriptpublic-snippets
View on GitHub

Code excerpt: attachment batching helper

The public snippet shows the attachment batching pattern only. Real recipients, file paths, credentials, and email templates stay private.

attachment-batching-helper.jsjavascript
function shouldSendAsBatches(files, maxBatchSizeMb = 3.5) {
  const batches = [];
  let currentBatch = [];
  let currentSize = 0;

  for (const file of files) {
    const sizeMb = Number(file.sizeMb || 0);

    if (currentBatch.length && currentSize + sizeMb > maxBatchSizeMb) {
      batches.push(currentBatch);
      currentBatch = [];
      currentSize = 0;
    }

    currentBatch.push({
      name: file.safeName,
      contentBytes: file.base64,
    });
    currentSize += sizeMb;
  }

  if (currentBatch.length) {
    batches.push(currentBatch);
  }

  return batches.map((attachments, index) => ({
    batchNumber: index + 1,
    totalBatches: batches.length,
    attachments,
  }));
}

Publication note

The public repository is a documentation and snippet reference only. It must not include original workflow JSON, active credentials, client secrets, tenant IDs, SharePoint drive IDs, Slack workspace identifiers, real recipients, or private email templates.

← Back to all projects