Detect early payment invoice opportunities with Groq and Google Sheets
Quick Overview This workflow runs daily to fetch invoice data from an HTTP endpoint, calculate early-payment savings and annualized ROI, and use Groq (Llama 3.3) to prioritize eligible discounts. It logs eligible and expired invoices to Google Sheets and emails a digest of HIGH-priority recommendations via Gmail.
How it works Runs every day at 9:00 to start an invoice scan. Fetches invoice records from an external HTTP API endpoint. Calculates potential savings, days saved by paying early, annualized ROI, and whether each invoice is still eligible before the discount deadline. Routes eligible invoices to Groq (Llama 3.3) to return a JSON decision with a YES/NO recommendation, HIGH/MEDIUM/LOW priority, and a short reason, then normalizes the AI response. Appends eligible invoice evaluations (including ROI, savings, priority, recommendation, and reason) to a Google Sheets log. Filters for invoices marked YES and HIGH priority, aggregates them into a daily batch, and emails a plain-text digest to the finance team via Gmail. Marks ineligible invoices as expired with a skip reason and appends them to a separate Google Sheets audit log.
Setup Add a Groq API credential and ensure the selected Groq model is available in your account. Add Google Sheets OAuth2 credentials and update the spreadsheet ID, sheet tabs, and column headers to match your logging sheets. Add Gmail OAuth2 credentials and set the target recipient(s) for the finance summary email. Update the invoice API URL to your real invoice source and ensure each record includes amount, discount_percent, discount_deadline, payment_due, vendor, and vendor_email fields. Adjust the available cash amount and the ROI/cash threshold rules in the prompt and/or data preparation step to match your finance policy.
Related Templates
Track OpenAI Token Usage and AI Agent Metrics with Google Sheets Dashboard
What it does Captures token usage and cost from your AI Agent/LLM. Logs model, tokens, cost, tool use, and conversation ...
Summarize SERPBear data with AI (via Openrouter) and save it to Baserow
Who's this for? If you own a website and need to analyze your keyword rankings If you need to create a keyword report on...
Send Daily Weather Forecasts from OpenWeatherMap to Telegram with Smart Formatting
🌤️ Daily Weather Forecast Bot A comprehensive n8n workflow that fetches detailed weather forecasts from OpenWeatherMap...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments