See llms.txt for all machine-readable content.

Back to Templates

Plan weekly inventory reorders with Groq and Gmail approvals

Quick overview

This workflow runs every Monday to calculate inventory reorder points and purchase orders from n8n Data Tables, uses Groq to draft buyer and supplier notes, and sends an approval email via Gmail before emailing approved purchase orders to suppliers and logging the result.

How it works

  1. Runs every Monday at 8am and loads configuration values such as lookback days, service factor, and approval wait time.
  2. Reads active product, stock, and supplier data plus the last 28 days of sales from n8n Data Tables.
  3. Calculates average daily demand, safety stock, reorder points, and suggested order quantities, then groups reorder lines into one purchase order per supplier.
  4. Sends the calculated plan to Groq to generate a short buyer summary and a brief note for each supplier, falling back to built-in text if the AI step fails.
  5. Builds HTML purchase orders and a stock health table, then emails the buyer a Gmail approval request if there are orders or a stock-check email if there are none.
  6. If the buyer approves, saves each purchase order as sent in an n8n Data Table and emails each supplier their purchase order via Gmail; if declined, saves each purchase order as declined.

Setup

  1. Create and select your n8n Data Tables for products, daily sales, and purchase order logging (inv_products, inv_daily_sales, and inv_purchase_orders) and ensure the columns match the workflow mappings.
  2. Update the placeholders in “Set Configuration Parameters” (at minimum business_name and buyer_email) and adjust currency and planning values as needed.
  3. Add Groq credentials for the LLM step and Gmail credentials for the buyer approval email and supplier purchase order emails.
  4. Populate inv_products with supplier emails, lead times, MOQ, and case pack values, and keep on_hand/on_order and inv_daily_sales up to date so reorder calculations remain accurate.