Automate Document Approvals with Multi-Level Workflows using Supabase & Gmail
Multi-Level Document Approval & Audit Workflow
This workflow automates a document approval process using Supabase and Gmail.
Who it’s for
Teams that need structured multi-level document approvals.
Companies managing policies, contracts, or proposals.
Medical document need multiple lavel of review and approval.
How it works
Form Trigger – A user submits a document via the form.
Supabase Integration – The document is saved in the documents table.
Supabase Storage – The document is saved in the bucket.
Workflow Levels – Fetches the correct approval level from workflow_levels.
Assign Approvers – Matches approvers by role from the users table.
Approval Record – Creates an approvals record with a unique token and expiry.
Email Notification – Sends an email with Approve / Reject links.
Audit Logs – Records every approval request in audit_logs.
Repeat - repeat the flow till all the aproval level is comepted
How to set up
Configure your Supabase credentials.
Create tables as per data model given.
Create a storage bucket in Supabase Storage.
Connect your Gmail account.
Adjust approval expiry time (48h default).
Deploy and test via the Form Trigger.
Customization
Add multiple approval levels by chaining workflow_levels.
Replace Gmail with Slack, Teams, or another notification channel.
Adjust audit logging for compliance needs.
Update the endpoint http://localhost:5678/webhook-test/ based on instance and env (remove test if you run in prod)
Update the bucket name.
Important steps
-
Form Submit Triggered when by submiting form Captures form parameters:
Title (Document Title)
Description (Document Description) file (Document need for approval) -
Webhook Entry Point Triggered when an approver clicks the Approve or Reject link in email.
Captures query parameters:
token (approval token)
decision (approved/rejected) -
Approval Data Retrieval & Update Fetch approval record from Supabase (approvals) using token.
Update approval status:
Approved → moves to next workflow level or final approval.
Rejected → document marked as rejected immediately.
Records acted_at timestamp. -
Decision Check IF Node* checks whether the decision is approved or rejected*.
Reject Path* → Update document status to Rejected* in documents.
Approve Path** → Continue workflow level progression. -
Workflow Level Progression Fetch details of the current workflow level.
Identify the next level (workflow_levels) based on level_number.
✅ If Next Level Exists:
Retrieve approvers by role_id.
Generate unique approval tokens.
Create new approval records in approvals.
Send email notifications with approval/reject links.
❌ If No Next Level (Last Level): Update document status to Approved in documents.
- Audit Logging
Every approval action is logged into audit_logs table:
document_id
action (e.g., approval_sent, approved, rejected)
actor_email (system/approver)
details (workflow level, role info, etc.)
📨 Email Template Approval request email includes decision links:
Please review the document:
✅ Approve | ❌ Reject
Happy Automating! 🚀
Related Templates
Automatic News Summarization & Email Digest with GPT-4, NewsAPI and Gmail
📰 AI News Digest Agent: Auto News Summarizer & Email Newsletter Create an intelligent news curation system that automat...
Auto-classify Gmail emails with AI and apply labels for inbox organization
Who is this for? Professionals and individuals who receive high volumes of emails, those who want to automatically organ...
Generate Product Ad Copy & CTAs with GPT-4 for Slack and Airtable
⚡ AI Copywriter Pro: Instant Ad Copy & CTA Generator Transform product details into compelling marketing copy in second...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments