Flag duplicate and risky AP invoices with Gmail, OpenAI and Supabase
Workflow preview
$20/month : Unlimited workflows
2500 executions/month
THE #1 IN WEB SCRAPING
Scrape any website without limits
HOSTINGER
Early Deal
DISCOUNT 20% Try free
DISCOUNT 20%
Self-hosted n8n
Unlimited workflows - from $4.99/mo
#1 hub for scraping, AI & automation
6000+ actors - $5 credits/mo
Overview
๐ 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
[email protected] - 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