Templates / Route AI-scored approval requests with GPT-4o-mini, Supabase and Gmail

Route AI-scored approval requests with GPT-4o-mini, Supabase and Gmail

Ready for 3.0

by WeblineIndia ✓ · 18 views · created 2026-08-29 · Document Extraction, AI Summarization

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

Nodes used (9)

OpenAISupabaseGmail

What it does

Quick overview This workflow collects approval requests via an n8n form, uses OpenAI (GPT-4o-mini) to summarize and score risk, stores the request in Supabase, emails the right approver via Gmail with approve/reject links, then updates the Supabase record and notifies the requester by email. How it works 1. Receives a new approval submission from an n8n form with request details like type, title, amount, department, justification, and requester email. 2. Sends the request data to OpenAI (GPT-4o-mini) to generate a short summary plus a risk score, priority, and suggested approval level. 3. Chooses an approver email and approval level based on amount thresholds and the AI risk score, then combines the AI output with the original form data. 4. Creates a new row in the Supabase approvalrequests table with the request details, AI fields, and a generated request ID set to pending. 5. Builds approve/reject URLs that point to a webhook and emails the approver via Gmail with the request summary and one-click action links. 6. Accepts the approver’s click on the approval webhook, updates the matching Supabase record to approved or rejected with audit details, and emails the requester the final outcome via Gmail. Setup 1. Add OpenAI API credentials and ensure the model selection (gpt-4o-mini) is available in your OpenAI account. 2. Add a Supabase credential and create an approvalrequests table with columns that match the fields written by the workflow (for example requestid, status, approveremail, approvallevel, aisummary, riskscore, and priority). 3. Add a Gmail OAuth credential for sending emails to approvers and requesters. 4. Update the webhook base URL used in the approve/reject links to your n8n instance URL and ensure the approve-action webhook path is reachable from email recipients. 5. Replace the hardcoded approver email addresses (manager/financehead/director) with real inboxes for your organization. Additional info How To Customize Nodes Easy Changes - Form fields: Edit "New Approval Request Form" → add/remove fields - AI rules: Modify prompt in "Analyze Risk Priority" node - Amount thresholds: Update expressions in "Prepare AI Form Data" - Approver emails: Change ternary logic in approveremail field - Email templates: Edit HTML in Gmail nodes Advanced Customization - Add Slack/Teams: Replace Gmail nodes - Multi-approver: Add sequential webhooks - Custom fields: Extend Supabase schema + form - Reporting: Add cron trigger for dashboard data Add-ons Immediate Extensions You Can Try - Telegram notifications (parallel to Gmail) - Slack channels per department - Sequential approvals (Manager → Director) - PDF generation of approved requests - Weekly reports to finance team Enterprise Features You Can Consider - Role-based access via n8n RBAC - Multi-tenant (separate Supabase schemas) - Custom branding on forms/emails - Integration with HRIS/Payroll systems Use Case Examples - Purchase Orders: Laptops, software licenses, office supplies - Expense Approvals: Travel, client dinners, training courses - Document Sign-off: Contracts, proposals, policy updates - Internal Requests: Vacation, equipment, remote work setup - Vendor Onboarding: New suppliers, service contracts - Budget Reallocation: Department transfers, project funding - Overtime Authorization: Weekend work, emergency coverage Troubleshooting Guide | Issue | Possible Cause | Solution | | :-- | :-- | :-- | | Form not submitting | Workflow inactive | Activate workflow, use Production URL | | AI returns plain text | Markdown parsing failed | Check "Extract AI JSON Response" code | | Webhook 404 error | Test URL used | Activate workflow, copy Production webhook URL | | Email not sending | Invalid OAuth2 | Reconnect Gmail credentials | | Supabase insert fails | Missing table/columns | Run schema SQL exactly as provided | | "Requester Email Valid?" skips | Empty requestedemailby | Fill email field in form | | Wrong approver | Amount thresholds | Verify logic in "Prepare AI Form Dat

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.