Automates B2B order processing from unstructured emails: AI extracts order data (SKUs, quantities, addresses, PO numbers), matches customers in CRM, checks credit limits and inventory availability, then either auto-creates ERP orders or routes exceptions to humans for review.
Email received → Claude AI extracts structured order → CRM customer match → Credit check → Inventory check → Auto-fulfill or route exception
# Run with mock AI (no API key needed — demonstrates full pipeline)
python main.py --mock
# Run with live Claude API
export ANTHROPIC_API_KEY=your-key-here
pip install -r requirements.txt
python main.py
# Process a single email
python main.py --mock --index 0The demo includes 3 realistic B2B order emails that demonstrate different processing paths:
| Customer | Result | Why | |
|---|---|---|---|
| PO #FF-2026-0412 | Freshfields Retail (existing) | AUTO-FULFILL | All checks pass |
| New order - urgent | Berlin Organic (new customer) | HUMAN REVIEW | New customer + low stock warning |
| March batch order | Supershop B.V. (existing, 3 locations) | AUTO-FULFILL | Multi-location order, partial stock on 1 item |
From any email format, Claude extracts:
- Customer name, contact, email
- PO number (any format)
- Payment terms
- New customer flag
- VAT ID
- Delivery address(es) with line items grouped by location
- SKU codes, product descriptions, quantities
- Special instructions
- Uses mock customer/inventory data (production would query real ERP/CRM APIs)
- Mock mode available for demo without API key
- No PDF attachment parsing (production would add OCR via Claude vision)
- No actual ERP/WMS API calls (production would use REST endpoints)
- IMAP inbox monitoring (or n8n webhook trigger)
- Real ERP API integration (SAP, Dynamics, Exact Online)
- PDF order form parsing via Claude vision API
- n8n workflow orchestration for fulfillment pipeline
- Slack/WhatsApp notifications for exceptions
- Invoice auto-generation on shipment
- Payment reconciliation module
- Supplier invoice verification with 3-way match