Validate procurement records and learn error patterns with Gemini and Data Tables
Ready for 3.0Ready 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)
- Webhook
n8n-nodes-base.webhook - Edit Fields (Set)
n8n-nodes-base.set - Code
n8n-nodes-base.code - Data table
n8n-nodes-base.dataTable - Merge
n8n-nodes-base.merge - If
n8n-nodes-base.if - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm - Respond to Webhook
n8n-nodes-base.respondToWebhook - Google Gemini Chat Model
@n8n/n8n-nodes-langchain.lmChatGoogleGemini
What it does
Quick Overview This workflow receives procurement line-item data via a webhook, validates and normalizes it, checks for known recurring error patterns in an n8n Data Table, and uses Google Gemini to detect semantic anomalies when needed, returning an immediate JSON accept/reject response and learning new error patterns. How it works 1. Receives a procurement record as a POST request via a webhook. 2. Applies configurable rules to normalize fields (including unit aliases) and run deterministic checks for required fields, quantity/price validity, subtotal math, and tax calculations. 3. Builds a pattern signature from key fields and looks it up in the n8n Data Table to see if the same error pattern has been seen before. 4. If a trusted recurring pattern is found (high confidence and enough occurrences), reuses the stored correction details and skips AI review. 5. If no trusted pattern is found, sends the record and deterministic results to Google Gemini to identify contextual anomalies (for example category, coding, supplier-item, or unit inconsistencies) and suggested corrections. 6. Combines deterministic errors, historical pattern matches, and Gemini findings into a single decision and returns a JSON response indicating whether the record is accepted along with any detected issues. 7. When issues are detected, upserts the error pattern (including counts, confidence, and summary) into the n8n Data Table to improve future detections. Setup 1. Create an n8n Data Table named procurementerrorpatterns with columns such as patternkey, supplier, itemcode, errortype, incorrectvalue, suggestedvalue, reason, occurrencecount, confidence, firstseen, lastseen, source, and issuesummary. 2. Add a Google Gemini (PaLM) credential and select it in the Google Gemini Chat Model node. 3. Review and adjust the defaults in the workflow (required fields, default currency and tax rate, subtotal/tax tolerances, and AI/pattern confidence and recurring thresholds) to match your procurement rules. 4. Send JSON records to the webhook endpoint (copy the production URL from the webhook node), using fields like supplier, itemcode, description, category, quantity, unit, unitprice, subtotal, taxrate, taxamount, and currency.