Templates / Flag anomalous B2B orders with Google Sheets, Gemini, and Slack

Flag anomalous B2B orders with Google Sheets, Gemini, and Slack

Ready for 3.0

by iamvaar ✓ · 0 views · created 2026-10-08 · CRM, AI Summarization

Ready 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)

Google SheetsAI AgentGoogle Gemini Chat ModelStructured Output ParserSlack

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.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.