Skip to main content

Automate document approvals with multi-level workflows using Supabase & Gmail

Workflow preview

Workflow preview
100%
Automate document approvals with multi-level workflows using Supabase & Gmail preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

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. ...

Best for

  • Document Extraction automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.webhook, n8n-nodes-base.supabase, n8n-nodes-base.crypto, n8n-nodes-base.gmail, n8n-nodes-base.formtrigger, n8n-nodes-base.if, n8n-nodes-base.stickynote, n8n-nodes-base.respondtowebhook

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Alok Kumar.

Original n8n.io source

1.1 Workflow description

Title
Automate document approvals with multi-level workflows using Supabase & Gmail
Workflow name
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

  1. Form Trigger – A user submits a document via the form.
  2. Supabase Integration – The document is saved in the documents table.
  3. Supabase Storage – The document is saved in the bucket.
  4. Workflow Levels – Fetches the correct approval level from workflow_levels.
  5. Assign Approvers – Matches approvers by role from the users table.
  6. Approval Record – Creates an approvals record with a unique token and expiry.
  7. Email Notification – Sends an email with Approve / Reject links.
  8. Audit Logs – Records every approval request in audit_logs.
  9. 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

1. Form Submit

  • Triggered when by submiting form
  • Captures form parameters:
    • Title (Document Title)
    • Description (Document Description)
    • file (Document need for approval)

2. Webhook Entry Point

  • Triggered when an approver clicks the Approve or Reject link in email.
  • Captures query parameters:
    • token (approval token)
    • decision (approved/rejected)

3. 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.

4. 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.

5. 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.

6. 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:

<p>Please review the document:</p>
<p>
  <a href="http://localhost:5678/webhook-test/doc-approval?token={{$json.token}}&decision=approved">✅ Approve</a> |
  <a href="http://localhost:5678/webhook-test/doc-approval?token={{$json.token}}&decision=rejected">❌ Reject</a>
</p> 

Happy Automating! 🚀

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Webhook

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 2.1

Block 2 - Audit1

Type / Role
n8n-nodes-base.supabase - supabase
Config choices
Version 1

Block 3 - Final Update Document

Type / Role
n8n-nodes-base.supabase - supabase
Config choices
Version 1

Block 4 - save_document

Type / Role
n8n-nodes-base.supabase - supabase
Config choices
Version 1

Block 5 - get_workflow_level_one

Type / Role
n8n-nodes-base.supabase - supabase
Config choices
Version 1

Block 6 - get_user_by_role

Type / Role
n8n-nodes-base.supabase - supabase
Config choices
Version 1

Block 7 - create_uuid_token

Type / Role
n8n-nodes-base.crypto - crypto
Config choices
Version 1

Block 8 - create_record_approvals

Type / Role
n8n-nodes-base.supabase - supabase
Config choices
Version 1

Block 9 - send_email

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 10 - audit_invites

Type / Role
n8n-nodes-base.supabase - supabase
Config choices
Version 1

Block 11 - start_approval_form

Type / Role
n8n-nodes-base.formTrigger - formTrigger
Config choices
Version 2.2

Block 12 - get_approval_data

Type / Role
n8n-nodes-base.supabase - supabase
Config choices
Version 1

Block 13 - update_approval_data

Type / Role
n8n-nodes-base.supabase - supabase
Config choices
Version 1

Block 14 - check_reject_or_approve

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 15 - get_level_details

Type / Role
n8n-nodes-base.supabase - supabase
Config choices
Version 1

Block 16 - get_next_level

Type / Role
n8n-nodes-base.supabase - supabase
Config choices
Version 1

Block 17 - is_last_level

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 18 - get_workflow_by_level

Type / Role
n8n-nodes-base.supabase - supabase
Config choices
Version 1

Block 19 - get_user_by_role1

Type / Role
n8n-nodes-base.supabase - supabase
Config choices
Version 1

Block 20 - generate_uuid

Type / Role
n8n-nodes-base.crypto - crypto
Config choices
Version 1

Block 21 - create_approval_record

Type / Role
n8n-nodes-base.supabase - supabase
Config choices
Version 1

Block 22 - send_emai_by_level

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.1

Block 23 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 24 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Showing the first 24 of 38 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Automate document approvals with multi-level workflows using Supabase & Gmail
Complexity advanced
Nodes 38
Categories Document Extraction
Author Alok Kumar
Published 02 Sept 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/8174/8174.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automate document approvals with multi-level workflows using Supabase & Gmail do?

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. ...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction use case.