# Email Order to Procurement Automation

**Category:** Manufacturing  
**Tools:** Email, OpenAI, Slack  
**Nodes:** 13  
**Built by:** Forgent Systems

Reads purchase orders that arrive by email, extracts them with AI, creates a sales order, checks stock and, if there's a shortage, raises a purchase requisition and a work order.

![Workflow](preview.webp)

## How it works

1. A Gmail trigger picks up an order email with its attachment.
2. The document is extracted into structured data.
3. A sales order is created and stock is checked.
4. Shortages create a purchase requisition and a work order.
5. A summary is posted to Slack and emailed.

## Use cases

- Manufacturers
- B2B suppliers
- Make-to-order businesses

## Data setup

**Google Sheets** (tab: columns)

- **Order tracking → Customer order**: `Order id`, `SKU`, `Customer Name`, `Email`, `Phone`, `Item Name`, `Quantity`, `Price`, `Total`
- **Order tracking → Product inventory**: `Item Name`
- **Order tracking → Purchase Requisition**: `Request Date`, `item name`, `SKU / Item Code`, `Current Quantity`, `Quantity Requested`, `Priority`
- **Order tracking → Work Order Create**: `order id`, `SKU`, `item name`, `Customer name`, `Quantity to Produce`, `Planned  Due Date`

## Setup

1. In n8n open **Workflows → Import from File** and choose `workflow.json`.
2. Connect these credentials:
   - Gmail account
   - Google Sheets account
   - OpenAI account
   - Slack account
3. Point the Sheets / Airtable / Drive / Slack nodes at your own resources (structure above).
4. Replace placeholder emails, phone numbers and `YOUR-FORM-ID` links with your own.
5. Times use the America/New_York timezone and dates use MM/DD/YYYY. Adjust if needed.
6. Run a test execution, then activate.

## Nodes

- **Gmail Trigger** — `n8n-nodes-base.gmailTrigger`
- **Extract from File** — `n8n-nodes-base.extractFromFile`
- **Structured Output Parser** — `@n8n/n8n-nodes-langchain.outputParserStructured`
- **OpenAI Chat Model** — `@n8n/n8n-nodes-langchain.lmChatOpenAi`
- **Send a message** — `n8n-nodes-base.gmail`
- **Extract Invoice Record** — `@n8n/n8n-nodes-langchain.agent`
- **Sales Order Creation** — `n8n-nodes-base.googleSheets`
- **Stock & Shortage Check** — `n8n-nodes-base.googleSheets`
- **If Negative** — `n8n-nodes-base.if`
- **Create Purchase Requisition** — `n8n-nodes-base.googleSheets`
- **Create  Work  Order** — `n8n-nodes-base.googleSheets`
- **Send Order Summary** — `n8n-nodes-base.slack`
- **Sticky Note** — `n8n-nodes-base.stickyNote`
