π§Ύ Flag duplicate and risky AP invoices with Gmail, OpenAI and Supabase
β‘ 50 views Β· π§Ύ Invoice Processing
Description
π How it works
Monitors your AP inbox for incoming invoices, extracts structured data with AI, runs duplicate and vendor history checks against Supabase, then scores each invoice for fraud risk β routing suspicious ones to Slack and your AP team before any payment is processed.
- π¬ Gmail Trigger monitors your accounts payable inbox in real time
- π€ AI Agent extracts invoice number, vendor, amount, currency, dates and line items into structured JSON β no manual data entry
- π Checks Supabase for duplicate invoice numbers already in the system
- π’ Checks vendor payment history β flags unknown vendors and amount deviations above 50% from the vendorβs historical average
- π§ Second AI Agent scores fraud risk: low / medium / high / critical with specific fraud indicators and a recommended action
- π¨ High/critical risk β posts a detailed Slack alert to
#invoice-alertsand emails your AP manager with a hold notice - ποΈ Logs every processed invoice to Supabase with risk score and status
π οΈ Set up steps
Estimated setup time: ~20 minutes
- Gmail Trigger β connect Gmail OAuth2; point it at your AP inbox
- OpenAI β connect OpenAI API credential (used by both AI Agent nodes)
- Supabase β connect Supabase API credential; create two tables:
invoices(invoice_number, vendor_name, amount, status, risk_level, created_at) andvendors(vendor_name, avg_amount, total_invoices, flagged) - Slack β connect Slack OAuth2; update the channel name
#invoice-alerts - Gmail (Send) β connect Gmail OAuth2; replace
ap-manager@example.com - Follow the sticky notes inside the workflow for per-node guidance
π Prerequisites
- Gmail account receiving invoices
- OpenAI API key (GPT-4o)
- Supabase project with
invoicesandvendorstables - Slack workspace with an alerts channel
Custom Workflow Request with Personal Dashboard
https://www.smartflowcraft.com/contact
More free templates
https://www.smartflowcraft.com/n8n-templates
π Nodes Used
Slack, Gmail, Supabase, Gmail Trigger, AI Agent, OpenAI Chat Model
π₯ Import
Download workflow.json and import into n8n:
Workflow menu β Import from File