Quick Overview
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). An n8n automation workflow template by Khairul Muhtadin.
Khairul Muhtadin
web
free
Others in the same category, ranked by how often they are opened.