Automate sales order prioritization with ERP-WMS-TMS integration based on SLA tiers
This n8n workflow automates the prioritization and scheduling of sales orders based on customer SLAs, urgency, and profitability. It ensures that high-priority and SLA-critical orders are picked, packed, and dispatched first—improving fulfillment speed, customer satisfaction, and operational efficiency across warehouses and logistics.
Key Features
- Automated Order Fetching: Periodically retrieves all pending or confirmed sales orders from ERP systems.
- Dynamic SLA-Based Prioritization: Calculates order priority scores using urgency, customer tier, order value, and profit margin.
- Intelligent SLA Monitoring: Identifies SLA breaches and automatically flags them for immediate handling.
- Automated Task Creation: Generates urgent picking tasks and alerts warehouse managers in real-time.
- Smart Scheduling: Optimizes picking and dispatch timelines based on urgency and capacity.
- Seamless ERP & TMS Integration: Updates order statuses and schedules dispatches automatically.
- Operational Transparency: Sends end-of-cycle summary reports via email to operations teams.
Workflow Process
-
Schedule Trigger
- Runs every 15 minutes to ensure orders are frequently evaluated.
- Maintains real-time responsiveness without overloading systems.
-
Fetch Pending Orders
- Retrieves all orders in pending or confirmed state from ERP API.
- Configurable limit (e.g., 100 orders per run) for controlled processing.
-
Fetch Customer SLA Data
- Collects SLA tiers, delivery timeframes, and customer-specific priorities from ERP or CRM API.
- Supports dynamic customer segmentation (Gold, Silver, Bronze tiers).
-
Calculate Priority Scores
-
Assigns weighted priority scores based on multiple criteria:
- Urgency: 40%
- Tier: 30%
- Order Value: 20%
- Profit Margin: 10%
-
Produces a composite score used for sorting and scheduling.
-
-
Check if SLA Critical
- Detects if any order is close to or past SLA deadlines.
- Routes SLA-breached orders for immediate escalation.
-
Create Urgent Picking Task
- Generates warehouse picking tasks for critical orders.
- Assigns to senior pickers or rapid response teams.
-
Alert Warehouse Manager
- Sends instant SMS and email alerts for SLA-critical or high-priority orders.
- Ensures immediate managerial attention.
-
Batch Normal Orders
- Groups non-critical orders into batches of 10 for optimized processing.
- Reduces load on WMS while maintaining steady throughput.
-
Generate Picking Schedule
-
Creates smart picking schedules based on urgency:
- High Priority: Same-day
- Normal: Within 1 day
- Low: Within 2–3 days
-
-
Create Bulk Picking Tasks
- Pushes picking tasks into WMS (Warehouse Management System).
- Uses auto-assignment and route optimization logic.
-
Generate Dispatch Schedule
- Builds dispatch timelines according to delivery method: Express, Priority, or Standard.
- Syncs with transport capacity data.
-
Schedule Dispatches in TMS
- Sends dispatch requests to TMS (Transport Management System).
- Books carriers and reserves capacity for each batch.
-
Update Order Statuses
- Updates ERP with new order statuses, schedules, and expected delivery dates.
- Maintains a unified view across systems.
-
Generate Summary Report
-
Creates a summary JSON report including:
- Total orders processed
- SLA-critical cases
- Dispatch breakdowns
- Next deadlines
-
-
Send Summary Notification
- Emails the operations team with execution summary and performance metrics.
- Ensures team alignment and SLA visibility.
Industries That Benefit
This automation is especially valuable for:
- E-commerce & Retail: To prioritize same-day or express deliveries for VIP customers.
- Logistics & 3PL Providers: For meeting tight SLAs across multiple clients and delivery tiers.
- Manufacturing & B2B Distribution: Ensures high-value or contractual orders are prioritized.
- Pharma & Healthcare: Critical for time-sensitive and compliance-driven deliveries.
- Consumer Goods & FMCG: Helps manage high-volume dispatch with smart scheduling.
Prerequisites
- ERP system with API access (e.g., SAP, Odoo, NetSuite).
- WMS and TMS integrations with order/task APIs.
- SMTP and SMS gateway credentials for notifications.
- n8n instance with HTTP, Function, Email, and Scheduler nodes installed.
Modification Options
- Customize priority scoring weights per business type.
- Integrate AI for predictive SLA breach forecasting.
- Add Slack/Teams channels for real-time operational alerts.
- Implement escalation routing for unassigned urgent tasks.
- Extend reports to include OTIF (On-Time-In-Full) metrics.
Explore More AI-Powered Workflows: Contact us for customized supply chain and order management automation.
Automate Sales Order Prioritization with ERP/WMS/TMS Integration
This n8n workflow automates the process of fetching and prioritizing sales orders, likely integrating with various enterprise systems (ERP, WMS, TMS) to ensure timely and efficient order fulfillment based on predefined Service Level Agreement (SLA) tiers.
What it does
This workflow is designed to streamline sales order management by:
- Scheduled Polling: Regularly triggers at a set interval to initiate the order prioritization process.
- Fetching Sales Orders: Makes an HTTP request to an external API (likely an ERP, WMS, or TMS system) to retrieve a list of sales orders.
- Processing Orders in Batches: Iterates through the retrieved sales orders, processing them in manageable batches to handle large datasets efficiently.
- Conditional Prioritization Logic: Evaluates each sales order against specific conditions to determine its priority (e.g., based on SLA tiers, order value, customer type).
- Custom Code Execution: Executes custom JavaScript code to perform advanced data manipulation or apply complex business logic for prioritization.
- Conditional Routing: Routes orders based on the prioritization logic to different subsequent steps (not explicitly defined in this JSON, but implied by the
Ifnode's purpose).
Prerequisites/Requirements
- API Endpoint: Access to an API endpoint for your ERP, WMS, or TMS system that provides sales order data.
- API Credentials: Any necessary authentication credentials (API keys, tokens, etc.) for the external API.
- n8n Instance: A running n8n instance to host and execute the workflow.
Setup/Usage
- Import the Workflow: Import the provided JSON into your n8n instance.
- Configure Schedule Trigger:
- Open the "Schedule Trigger" node.
- Set the desired interval for how often the workflow should run (e.g., every hour, daily).
- Configure HTTP Request Node:
- Open the "HTTP Request" node.
- Set the
URLto your sales order API endpoint. - Configure the
Method(e.g., GET, POST) and any necessaryHeadersorBodyparameters for authentication and data retrieval.
- Configure Loop Over Items (Split in Batches) Node:
- Review the batch size if needed, though default settings are often sufficient.
- Configure If Node:
- Open the "If" node.
- Define the conditions based on your SLA tiers or prioritization rules. For example, you might check
item.json.slaTier === 'Premium'oritem.json.orderValue > 1000. - Connect the
TrueandFalsebranches to subsequent nodes that handle different priority levels (these would need to be added to the workflow).
- Configure Code Node:
- Open the "Code" node.
- Modify the JavaScript code to implement any specific data transformations, calculations, or complex prioritization logic required for your sales orders.
- Activate the Workflow: Once configured, activate the workflow to start the automated prioritization process.
Related Templates
Automate invoice processing with OCR, GPT-4 & Salesforce opportunity creation
PDF Invoice Extractor (AI) End-to-end pipeline: Watch Drive ➜ Download PDF ➜ OCR text ➜ AI normalize to JSON ➜ Upsert Buyer (Account) ➜ Create Opportunity ➜ Map Products ➜ Create OLI via Composite API ➜ Archive to OneDrive. --- Node by node (what it does & key setup) 1) Google Drive Trigger Purpose: Fire when a new file appears in a specific Google Drive folder. Key settings: Event: fileCreated Folder ID: google drive folder id Polling: everyMinute Creds: googleDriveOAuth2Api Output: Metadata { id, name, ... } for the new file. --- 2) Download File From Google Purpose: Get the file binary for processing and archiving. Key settings: Operation: download File ID: ={{ $json.id }} Creds: googleDriveOAuth2Api Output: Binary (default key: data) and original metadata. --- 3) Extract from File Purpose: Extract text from PDF (OCR as needed) for AI parsing. Key settings: Operation: pdf OCR: enable for scanned PDFs (in options) Output: JSON with OCR text at {{ $json.text }}. --- 4) Message a model (AI JSON Extractor) Purpose: Convert OCR text into strict normalized JSON array (invoice schema). Key settings: Node: @n8n/n8n-nodes-langchain.openAi Model: gpt-4.1 (or gpt-4.1-mini) Message role: system (the strict prompt; references {{ $json.text }}) jsonOutput: true Creds: openAiApi Output (per item): $.message.content → the parsed JSON (ensure it’s an array). --- 5) Create or update an account (Salesforce) Purpose: Upsert Buyer as Account using an external ID. Key settings: Resource: account Operation: upsert External Id Field: taxid_c External Id Value: ={{ $json.message.content.buyer.tax_id }} Name: ={{ $json.message.content.buyer.name }} Creds: salesforceOAuth2Api Output: Account record (captures Id) for downstream Opportunity. --- 6) Create an opportunity (Salesforce) Purpose: Create Opportunity linked to the Buyer (Account). Key settings: Resource: opportunity Name: ={{ $('Message a model').item.json.message.content.invoice.code }} Close Date: ={{ $('Message a model').item.json.message.content.invoice.issue_date }} Stage: Closed Won Amount: ={{ $('Message a model').item.json.message.content.summary.grand_total }} AccountId: ={{ $json.id }} (from Upsert Account output) Creds: salesforceOAuth2Api Output: Opportunity Id for OLI creation. --- 7) Build SOQL (Code / JS) Purpose: Collect unique product codes from AI JSON and build a SOQL query for PricebookEntry by Pricebook2Id. Key settings: pricebook2Id (hardcoded in script): e.g., 01sxxxxxxxxxxxxxxx Source lines: $('Message a model').first().json.message.content.products Output: { soql, codes } --- 8) Query PricebookEntries (Salesforce) Purpose: Fetch PricebookEntry.Id for each Product2.ProductCode. Key settings: Resource: search Query: ={{ $json.soql }} Creds: salesforceOAuth2Api Output: Items with Id, Product2.ProductCode (used for mapping). --- 9) Code in JavaScript (Build OLI payloads) Purpose: Join lines with PBE results and Opportunity Id ➜ build OpportunityLineItem payloads. Inputs: OpportunityId: ={{ $('Create an opportunity').first().json.id }} Lines: ={{ $('Message a model').first().json.message.content.products }} PBE rows: from previous node items Output: { body: { allOrNone:false, records:[{ OpportunityLineItem... }] } } Notes: Converts discount_total ➜ per-unit if needed (currently commented for standard pricing). Throws on missing PBE mapping or empty lines. --- 10) Create Opportunity Line Items (HTTP Request) Purpose: Bulk create OLIs via Salesforce Composite API. Key settings: Method: POST URL: https://<your-instance>.my.salesforce.com/services/data/v65.0/composite/sobjects Auth: salesforceOAuth2Api (predefined credential) Body (JSON): ={{ $json.body }} Output: Composite API results (per-record statuses). --- 11) Update File to One Drive Purpose: Archive the original PDF in OneDrive. Key settings: Operation: upload File Name: ={{ $json.name }} Parent Folder ID: onedrive folder id Binary Data: true (from the Download node) Creds: microsoftOneDriveOAuth2Api Output: Uploaded file metadata. --- Data flow (wiring) Google Drive Trigger → Download File From Google Download File From Google → Extract from File → Update File to One Drive Extract from File → Message a model Message a model → Create or update an account Create or update an account → Create an opportunity Create an opportunity → Build SOQL Build SOQL → Query PricebookEntries Query PricebookEntries → Code in JavaScript Code in JavaScript → Create Opportunity Line Items --- Quick setup checklist 🔐 Credentials: Connect Google Drive, OneDrive, Salesforce, OpenAI. 📂 IDs: Drive Folder ID (watch) OneDrive Parent Folder ID (archive) Salesforce Pricebook2Id (in the JS SOQL builder) 🧠 AI Prompt: Use the strict system prompt; jsonOutput = true. 🧾 Field mappings: Buyer tax id/name → Account upsert fields Invoice code/date/amount → Opportunity fields Product name must equal your Product2.ProductCode in SF. ✅ Test: Drop a sample PDF → verify: AI returns array JSON only Account/Opportunity created OLI records created PDF archived to OneDrive --- Notes & best practices If PDFs are scans, enable OCR in Extract from File. If AI returns non-JSON, keep “Return only a JSON array” as the last line of the prompt and keep jsonOutput enabled. Consider adding validation on parsing.warnings to gate Salesforce writes. For discounts/taxes in OLI: Standard OLI fields don’t support per-line discount amounts directly; model them in UnitPrice or custom fields. Replace the Composite API URL with your org’s domain or use the Salesforce node’s Bulk Upsert for simplicity.
Tax deadline management & compliance alerts with GPT-4, Google Sheets & Slack
AI-Driven Tax Compliance & Deadline Management System Description Automate tax deadline monitoring with AI-powered insights. This workflow checks your tax calendar daily at 8 AM, uses GPT-4 to analyze upcoming deadlines across multiple jurisdictions, detects overdue and critical items, and sends intelligent alerts via email and Slack only when immediate action is required. Perfect for finance teams and accounting firms who need proactive compliance management without manual tracking. 🏛️🤖📊 Good to Know AI-Powered: GPT-4 provides risk assessment and strategic recommendations Multi-Jurisdiction: Handles Federal, State, and Local tax requirements automatically Smart Alerts: Only notifies executives when deadlines are overdue or critical (≤3 days) Priority Classification: Categorizes deadlines as Overdue, Critical, High, or Medium priority Dual Notifications: Critical alerts to leadership + daily summaries to team channel Complete Audit Trail: Logs all checks and deadlines to Google Sheets for compliance records How It Works Daily Trigger - Runs at 8:00 AM every morning Fetch Data - Pulls tax calendar and company configuration from Google Sheets Analyze Deadlines - Calculates days remaining, filters by jurisdiction/entity type, categorizes by priority AI Analysis - GPT-4 provides strategic insights and risk assessment on upcoming deadlines Smart Routing - Only sends alerts if overdue or critical deadlines exist Critical Alerts - HTML email to executives + Slack alert for urgent items Team Updates - Slack summary to finance channel with all upcoming deadlines Logging - Records compliance check results to Google Sheets for audit trail Requirements Google Sheets Structure Sheet 1: TaxCalendar DeadlineID | DeadlineName | DeadlineDate | Jurisdiction | Category | AssignedTo | IsActive FED-Q1 | Form 1120 Q1 | 2025-04-15 | Federal | Income | John Doe | TRUE Sheet 2: CompanyConfig (single row) Jurisdictions | EntityType | FiscalYearEnd Federal, California | Corporation | 12-31 Sheet 3: ComplianceLog (auto-populated) Date | AlertLevel | TotalUpcoming | CriticalCount | OverdueCount 2025-01-15 | HIGH | 12 | 3 | 1 Credentials Needed Google Sheets - Service Account OAuth2 OpenAI - API Key (GPT-4 access required) SMTP - Email account for sending alerts Slack - Bot Token with chat:write permission Setup Steps Import workflow JSON into n8n Add all 4 credentials Replace these placeholders: YOURTAXCALENDAR_ID - Tax calendar sheet ID YOURCONFIGID - Company config sheet ID YOURLOGID - Compliance log sheet ID C12345678 - Slack channel ID tax@company.com - Sender email cfo@company.com - Recipient email Share all sheets with Google service account email Invite Slack bot to channels Test workflow manually Activate the trigger Customizing This Workflow Change Alert Thresholds: Edit "Analyze Deadlines" node: Critical: Change <= 3 to <= 5 for 5-day warning High: Change <= 7 to <= 14 for 2-week notice Medium: Change <= 30 to <= 60 for 2-month lookout Adjust Schedule: Edit "Daily Tax Check" trigger: Change hour/minute for different run time Add multiple trigger times for tax season (8 AM, 2 PM, 6 PM) Add More Recipients: Edit "Send Email" node: To: cfo@company.com, director@company.com CC: accounting@company.com BCC: archive@company.com Customize Email Design: Edit "Format Email" node to change colors, add logo, or modify layout Add SMS Alerts: Insert Twilio node after "Is Critical" for emergency notifications Integrate Task Management: Add HTTP Request node to create tasks in Asana/Jira for critical deadlines Troubleshooting | Issue | Solution | |-------|----------| | No deadlines found | Check date format (YYYY-MM-DD) and IsActive = TRUE | | AI analysis failed | Verify OpenAI API key and account credits | | Email not sending | Test SMTP credentials and check if critical condition met | | Slack not posting | Invite bot to channel and verify channel ID format | | Permission denied | Share Google Sheets with service account email | 📞 Professional Services Need help with implementation or customization? Our team offers: 🎯 Custom workflow development 🏢 Enterprise deployment support 🎓 Team training sessions 🔧 Ongoing maintenance 📊 Custom reporting & dashboards 🔗 Additional API integrations Discover more workflows – Get in touch with us
Automated weekly security audit reports with Gmail delivery
🔒 N8N Security Audit Report - Automated Weekly Email 🎯 What does this workflow do? This workflow automatically generates and emails a comprehensive security audit report for your N8N instance every week. It identifies potential security risks related to: Credentials 🔑 : Exposed or insecure credentials Nodes 🧩 : Sensitive nodes (Code, HTTP Request, SSH, FTP, etc.) Instance settings 🏢 : Global security configuration Community nodes 📦 : Third-party nodes that may pose risks The report includes direct links to affected workflows, execution statuses, and actionable recommendations. --- ✨ Key Features 📊 Smart Risk Assessment Calculates overall risk level: 🟩 Low / 🟧 Moderate / 🟥 High Tracks unique credentials (not just total occurrences) Provides detailed breakdown by node type 🔗 Direct Workflow Links Clickable links to each workflow mentioned Shows last execution status (🟢 success / 🔴 failed) Displays execution timestamps 🌍 Bilingual Support Full support for French and English Switch language with a single variable 📧 Beautiful HTML Email Clean, professional formatting Color-coded risk levels Emoji icons for easy scanning --- 🚀 Quick Setup (5 minutes) 1️⃣ Configure Credentials N8N API: Generate an API key in your N8N settings Gmail OAuth2: Set up OAuth2 for Gmail sending 2️⃣ Set Your Variables Edit the "Set Config Variables" node: javascript { "email_to": "your.email@domain.com", "project_name": "My-N8N-Project", "server_url": "https://n8n.yourdomain.com", // NO trailing slash! "Language": "EN" // or "FR" } 3️⃣ Test & Activate Click "Execute Workflow" to test Check your email inbox Activate for weekly automation --- 📧 Example Report Output Subject: 🔒 Audit Report My-Project – Risk 🟧 Moderate Content: 📊 Summary • Credentials involved: 8 (5 unique) • Nodes involved: 12 💻 code: 4 🌐 httpRequest: 3 🔐 ssh: 2 • Community nodes: 1 • Overall risk level: 🟧 Moderate 🔐 Credentials Risk Report 🔹 Credentials with full access 🔑 My AWS Credentials 🔑 Database Admin 📋 Workflow: Data Processing Pipeline 🟢 (25-10-2024 06:15 → 06:16) 💻 Process Data 🌐 API Call 🧩 Nodes Risk Report [...detailed node analysis...] --- 🎨 Customization Options Change Schedule Modify the "Schedule Trigger" node to run: Daily at 8 AM Monthly on the 1st Custom cron expression Add Recipients Add multiple emails in the Gmail node's toList parameter Adjust Risk Thresholds Edit the JavaScript in "Format Audit Report" nodes to customize when risk levels change Use Different Email Service Replace Gmail node with: SMTP Microsoft Outlook SendGrid Any email service N8N supports --- 💡 Use Cases ✅ Compliance Monitoring: Track security posture for audits ✅ Team Awareness: Keep your team informed of security status ✅ Change Detection: Notice when new risky nodes are added ✅ Best Practices: Get recommendations to improve security ✅ Multi-Environment: Run separate instances for dev/staging/prod --- 🔧 Technical Details Nodes Used: 8 Credentials Required: 2 (N8N API + Gmail OAuth2) External Dependencies: None N8N Version: Compatible with latest N8N versions Execution Time: ~10-20 seconds --- 📋 Requirements N8N instance with API access Gmail account (or other email service) N8N API key with audit permissions Valid SSL certificate for workflow links (recommended) --- 🐛 Troubleshooting Empty report? → Check your N8N API key has audit permissions Workflow links don't work? → Verify server_url is correct and has no trailing slash No execution status shown? → Workflows must have been executed at least once Wrong language displayed? → Set Language to exactly "FR" or "EN" (uppercase) --- 🌟 Why This Template? Unlike basic monitoring tools, this workflow: ✅ Provides context-aware security analysis ✅ Links directly to affected workflows ✅ Shows real execution data (not just theoretical risks) ✅ Calculates unique credential exposure (not just counts) ✅ Supports bilingual reports ✅ Delivers actionable recommendations --- 🤝 Feedback & Support Found this helpful? Please rate the template! Have suggestions? Drop a comment below. Pro tip: Combine this with N8N's native alerting for real-time incident response! --- Tags: security audit monitoring compliance automation email reporting credentials governance --- 📜 License MIT - Feel free to modify and share!