Flag duplicate and risky AP invoices with Gmail, OpenAI and Supabase
š 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-alerts and 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) and vendors (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 invoices and vendors tables Slack workspace with an alerts channel Custom Workflow Request with Personal Dashboard
kumar@smartflowcraft.com
https://www.smartflowcraft.com/contact
More free templates https://www.smartflowcraft.com/n8n-templates
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