Flag anomalous B2B orders with Google Sheets, Gemini, and Slack
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)
- Schedule Trigger
n8n-nodes-base.scheduleTrigger - Edit Fields (Set)
n8n-nodes-base.set - Google Sheets
n8n-nodes-base.googleSheets - AI Agent
@n8n/n8n-nodes-langchain.agent - Google Gemini Chat Model
@n8n/n8n-nodes-langchain.lmChatGoogleGemini - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - If
n8n-nodes-base.if - Slack
n8n-nodes-base.slack - Summarize
n8n-nodes-base.summarize
What it does
Quick overview Youtube Video: https://youtu.be/f7Kh1qxL9I This workflow runs every 15 minutes to review pending distributor orders stored in Google Sheets, enriches them with customer, product, credit, returns, and order-history stats, uses Google Gemini to assess anomaly risk, updates the order status, and posts high-risk cases to Slack. How it works 1. Runs every 15 minutes on a schedule. 2. Pulls the first order marked as “Pending” from the Orders tab in Google Sheets. 3. Looks up the matching customer profile, order history, product details, credit position, and recent returns from related Google Sheets tabs and computes historical averages and maximums. 4. Builds a consolidated context object (order, customer, history ratios, credit utilization, and returns metrics) and sends it to Google Gemini to produce a structured risk assessment. 5. Updates the order row in Google Sheets with the AI-derived risk level, risk score, risk reason, and sets the status to Approved or Under Review. 6. If the order requires review, appends a new case to the ReviewCases tab and sends a formatted alert to the configured Slack channel. 7. Appends an audit entry to the AuditLog tab in Google Sheets with the model name and the final decision details. Setup 1. Create a Google Sheets document with tabs named Orders, Customers, OrderHistory, Products, Credit, Returns, ReviewCases, and AuditLog, and ensure the columns referenced in the workflow (for example OrderID, Status, CustomerID, SKU, Quantity, OrderValue) exist. 2. Add Google Sheets Service Account credentials in n8n and share the target spreadsheet with the service account email. 3. Set your Google Sheet ID and Slack channel ID in the Config step, and adjust the currency symbol if needed. 4. Add a Slack OAuth credential with permission to post messages to the target channel. 5. Add Google Gemini (Google PaLM) API credentials for the Gemini chat model used by the AI Agent.