Validate wholesale order emails against a Google Sheets price list with Gmail and GPT-4o
Quick Overview This workflow monitors Gmail for unread wholesale order emails, uses OpenAI to extract order line items, validates them against a Google Sheets price list, and then sends either a confirmation or a revision request by email while logging the order and alerting the order desk via Telegram, plus a weekly digest.
How it works Triggers every minute when an unread Gmail message arrives matching the search filter is:unread subject:(wholesale order). Normalizes key fields from the email (sender, subject, received time, and body text) and routes very short emails to an error log. Uses OpenAI (gpt-4o-mini) to extract structured order data (customer details, PO number, delivery date, notes, and line items) from the email text. Loads the PriceList tab from Google Sheets and checks each extracted line for valid SKUs, active status, case-pack multiples, and any quoted price mismatches. If issues are found, emails the customer a revision request listing the problems, logs the order to the Orders tab in Google Sheets, and alerts the order desk in Telegram. If no issues are found, emails an order confirmation with priced lines, logs the order to Google Sheets, and alerts the order desk in Telegram. Marks the original Gmail message as read after the order is logged. Every Monday at 08:00, reads the past week’s Orders from Google Sheets, uses OpenAI to write a short digest email, then sends the digest via Gmail and posts a Telegram summary.
Setup Connect Gmail OAuth2 credentials and adjust the Gmail trigger search query and mailbox/label settings to match how your wholesale orders arrive. Connect an OpenAI API credential and confirm the selected model (gpt-4o-mini) is available in your account. Connect Google Sheets OAuth2 credentials and update the spreadsheet ID and sheet names, ensuring you have PriceList, Orders, and Errors tabs. Populate the PriceList sheet with the expected columns (at least sku, product, unit_price, case_pack, and status) so matching and validation work correctly. Connect a Telegram bot credential and set the target chat ID for order desk alerts. Update the weekly digest recipient email address in the digest email step (currently set to test@atlr.dev).
Related Templates
Transform Gmail Newsletters into Insightful LinkedIn Posts Using OpenAI
Who Is This For? This workflow is perfect for content creators, marketers, and business professionals who receive regu...
Compare Lists and Identify Common Items & Differences Using Custom Keys
This workflow compares two lists of objects (List A and List B) using a user-specified key (e.g. email, id, domain) and ...
AI Email Classifier & Auto-Delete for Gmail (SPAM/OFFER Cleaner)
This workflow is designed for freelancers, solopreneurs, and business owners who receive a high volume of irrelevant mes...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments