n8n for LogisticsTech SaaS Vendors: 5 Automations for PHMSA, FDA FSMA §204, and CBP ISF Compliance
If you sell SaaS to freight brokers, 3PLs, warehouses, last-mile carriers, or food cold-chain operators — your platform sits inside some of the most legally consequential compliance stacks in the US economy. A PHMSA HAZ
If you sell SaaS to freight brokers, 3PLs, warehouses, last-mile carriers, or food cold-chain operators — your platform sits inside some of the most legally consequential compliance stacks in the US economy.
A PHMSA HAZMAT spill report is due in 30 minutes. An FDA FSMA §204 traceability request must be answered in 24 hours. A CBP ISF late filing triggers $5,000/day. An FMC OSRA-22 unreasonable-refusal finding carries $45,000 per violation.
Your logistics customers don't care about your automation vendor's uptime SLA when the PHMSA duty officer is on the phone at 3 AM.
This article shows five production-ready n8n workflows for LogisticsTech and SupplyChainTech SaaS vendors — with the regulatory context your compliance and sales teams need.
Why LogisticsTech SaaS vendors choose self-hosted n8n
| Compliance driver | Why cloud iPaaS creates risk |
|---|---|
| PHMSA 49 CFR §171.15: 30-min telephonic notice, written within 30 days | Cloud outage during incident = missed 30-min clock. Self-hosted = no vendor dependency on fastest US regulatory clock |
| FDA FSMA §204 Traceability Rule 21 CFR Part 1, Subpart S: 24h FDA document request | Lot-level traceability records must be in your perimeter, immediately retrievable — not locked in a cloud workflow tool's audit log |
| FMC OSRA-22 §41102(c): subpoena readiness for OTI rate filings and accessorial charges | FMC subpoena covers all communications and records — iPaaS vendor data may be compelled independently, outside your legal hold |
| CBP ISF 10+2 19 CFR §149.4: $5,000/day late filing penalty | ISF automation on cloud iPaaS = new 'transmitting party' in CBP's ISF filer chain; security review may expand scope |
| CTPAT Supply Chain Security Criteria: Third-Party Logistics Minimum Security Criteria | CTPAT Tier 2+ requires documented access controls on all IT systems handling shipment data — cloud iPaaS must pass SEVI |
Self-hosted n8n on your own infrastructure: one-time security validation, no ongoing iPaaS vendor SEVI, Git-versioned change management, Postgres audit trail for every compliance event.
Workflow 1: LogisticsTech Customer Onboarding Drip
Segment new customers by tier and compliance profile. Send targeted Day 0 / Day 3 / Day 7 onboarding emails with workflow templates matched to their regulatory scope.
{
"name": "LogisticsTech Customer Onboarding Drip",
"nodes": [
{
"id": "1",
"name": "Webhook - New Customer",
"type": "n8n-nodes-base.webhook",
"parameters": {
"path": "logtech-onboarding",
"responseMode": "onReceived"
},
"position": [
240,
300
]
},
{
"id": "2",
"name": "Code - Classify Tier & Flags",
"type": "n8n-nodes-base.code",
"parameters": {
"jsCode": "\nconst c = $input.first().json;\nconst tier_map = {\n 'enterprise_3pl': 'ENTERPRISE_3PL',\n 'freight_broker': 'FREIGHT_BROKER',\n 'ocean_tms': 'OCEAN_CARRIER_TMS',\n 'warehouse': 'WAREHOUSE_MANAGEMENT_VENDOR',\n 'last_mile': 'LAST_MILE_DELIVERY',\n 'food_cold_chain': 'FOOD_COLD_CHAIN_VENDOR',\n 'customs_broker': 'CUSTOMS_BROKER_SAAS'\n};\nconst tier = tier_map[c.customer_type] || 'FREIGHT_BROKER';\nconst flags = {\n FMC_OTI_LICENSED: !!c.fmc_oti_number,\n FMCSA_BROKER_REGISTERED: !!c.fmcsa_mc_number,\n PHMSA_HAZMAT_REGULATED: !!c.phmsa_registration,\n FDA_FSMA_204_COVERED: !!c.fda_facility_id,\n CBP_ISF_FILER: !!c.cbp_importer_of_record,\n CTPAT_PARTICIPANT: c.ctpat_tier > 0,\n GDPR_EU_CROSS_BORDER: !!c.eu_operations\n};\nreturn [{json: {customer_id: c.customer_id, email: c.email, company: c.company, tier, flags, ts: new Date().toISOString()}}];\n"
},
"position": [
440,
300
]
},
{
"id": "3",
"name": "Gmail - Day 0 Welcome",
"type": "n8n-nodes-base.gmail",
"parameters": {
"operation": "send",
"to": "={{$json.email}}",
"subject": "Welcome to [Platform] \u2014 your logistics compliance quickstart",
"message": "={{$json.tier === 'FOOD_COLD_CHAIN_VENDOR' ? 'Your FDA FSMA \u00a7204 traceability workflow and lot-level KDE template are ready.' : $json.flags.PHMSA_HAZMAT_REGULATED ? 'Your PHMSA 30-min incident pipeline and HAZMAT training tracker are configured.' : 'Your onboarding resources are ready \u2014 reply to schedule your compliance scope review.'}}"
},
"position": [
640,
300
]
},
{
"id": "4",
"name": "Sheets - Log Onboarding",
"type": "n8n-nodes-base.googleSheets",
"parameters": {
"operation": "append",
"spreadsheetId": "YOUR_SHEET_ID",
"range": "Onboarding!A:Z",
"values": {
"customer_id": "={{$json.customer_id}}",
"tier": "={{$json.tier}}",
"flags": "={{JSON.stringify($json.flags)}}",
"ts": "={{$json.ts}}"
}
},
"position": [
840,
300
]
},
{
"id": "5",
"name": "Wait - 3 Days",
"type": "n8n-nodes-base.wait",
"parameters": {
"amount": 3,
"unit": "days"
},
"position": [
1040,
300
]
},
{
"id": "6",
"name": "Gmail - Day 3 Integration Tips",
"type": "n8n-nodes-base.gmail",
"parameters": {
"operation": "send",
"to": "={{$json.email}}",
"subject": "Day 3: Connect your TMS/WMS \u2014 compliance automation tips",
"message": "Day 3 tip: {{$json.flags.CBP_ISF_FILER ? 'Wire your ISF filing API into the PHMSA pipeline for combined customs+hazmat compliance.' : $json.flags.FDA_FSMA_204_COVERED ? 'Your FSMA \u00a7204 KDE schema needs PTI-compliant lot number format \u2014 here is the reference doc.' : 'Your freight broker compliance calendar is ready \u2014 add your FMC tariff renewal dates.'}}"
},
"position": [
1240,
300
]
},
{
"id": "7",
"name": "Wait - 4 Days",
"type": "n8n-nodes-base.wait",
"parameters": {
"amount": 4,
"unit": "days"
},
"position": [
1440,
300
]
},
{
"id": "8",
"name": "Gmail - Day 7 Advanced Features",
"type": "n8n-nodes-base.gmail",
"parameters": {
"operation": "send",
"to": "={{$json.email}}",
"subject": "Day 7: Advanced compliance features for your logistics stack",
"message": "Your Week 1 compliance automation is live. Next: CTPAT Tier 2 security criteria documentation, PHMSA annual registration renewal tracker, and the weekly supply chain KPI dashboard for your CEO."
},
"position": [
1640,
300
]
}
],
"connections": {
"Webhook - New Customer": {
"main": [
[
{
"node": "Code - Classify Tier & Flags",
"type": "main",
"index": 0
}
]
]
},
"Code - Classify Tier & Flags": {
"main": [
[
{
"node": "Gmail - Day 0 Welcome",
"type": "main",
"index": 0
}
]
]
},
"Gmail - Day 0 Welcome": {
"main": [
[
{
"node": "Sheets - Log Onboarding",
"type": "main",
"index": 0
}
]
]
},
"Sheets - Log Onboarding": {
"main": [
[
{
"node": "Wait - 3 Days",
"type": "main",
"index": 0
}
]
]
},
"Wait - 3 Days": {
"main": [
[
{
"node": "Gmail - Day 3 Integration Tips",
"type": "main",
"index": 0
}
]
]
},
"Gmail - Day 3 Integration Tips": {
"main": [
[
{
"node": "Wait - 4 Days",
"type": "main",
"index": 0
}
]
]
},
"Wait - 4 Days": {
"main": [
[
{
"node": "Gmail - Day 7 Advanced Features",
"type": "main",
"index": 0
}
]
]
}
}
}
Workflow 2: Supply Chain API Health Monitor
Poll your platform's compliance-critical APIs every 5 minutes. Detect outages that would break PHMSA incident reporting or FDA FSMA traceability retrieval before regulators call.
{
"name": "Supply Chain API Health Monitor",
"nodes": [
{
"id": "1",
"name": "Schedule - Every 5 Min",
"type": "n8n-nodes-base.scheduleTrigger",
"parameters": {
"rule": {
"interval": [
{
"field": "minutes",
"minutesInterval": 5
}
]
}
},
"position": [
240,
300
]
},
{
"id": "2",
"name": "Code - Define Endpoints",
"type": "n8n-nodes-base.code",
"parameters": {
"jsCode": "\nreturn [\n {json: {name: 'phmsa_incident_api', url: process.env.PHMSA_API_URL || 'https://your-platform.com/api/phmsa/health', regulation: 'PHMSA 49 CFR \u00a7171.15 \u2014 30-min telephonic notice clock (fastest US logistics clock)', severity: 'CRITICAL'}},\n {json: {name: 'fda_fsma_traceability_api', url: process.env.FSMA_API_URL || 'https://your-platform.com/api/fsma/health', regulation: 'FDA FSMA \u00a7204 21 CFR Part 1 Subpart S \u2014 24h lot-level KDE retrieval', severity: 'CRITICAL'}},\n {json: {name: 'fmc_tariff_api', url: process.env.FMC_API_URL || 'https://your-platform.com/api/fmc/health', regulation: 'FMC OSRA-22 \u00a741102(c) \u2014 OTI tariff accuracy and accessorial charge documentation', severity: 'HIGH'}},\n {json: {name: 'cbp_isf_filing_api', url: process.env.CBP_ISF_URL || 'https://your-platform.com/api/cbp/health', regulation: 'CBP ISF 10+2 19 CFR \u00a7149.4 \u2014 late ISF triggers $5,000/day penalty', severity: 'HIGH'}},\n {json: {name: 'ctpat_security_api', url: process.env.CTPAT_API_URL || 'https://your-platform.com/api/ctpat/health', regulation: 'CTPAT Minimum Security Criteria \u2014 shipment data access control documentation', severity: 'MEDIUM'}}\n];\n"
},
"position": [
440,
300
]
},
{
"id": "3",
"name": "HTTP Request - Ping Each",
"type": "n8n-nodes-base.httpRequest",
"parameters": {
"url": "={{$json.url}}",
"method": "GET",
"timeout": 10000,
"ignoreResponseCode": true
},
"position": [
640,
300
]
},
{
"id": "4",
"name": "Code - Check Status",
"type": "n8n-nodes-base.code",
"parameters": {
"jsCode": "\nconst prev = $getWorkflowStaticData('global');\nconst results = [];\nfor (const item of $input.all()) {\n const d = item.json;\n const name = d.name;\n const status = d.statusCode >= 200 && d.statusCode < 300 ? 'UP' : 'DOWN';\n const prevStatus = prev[name] || 'UP';\n if (status === 'DOWN' && prevStatus !== 'DOWN') {\n results.push({json: {...d, status, prevStatus, transition: 'UP_TO_DOWN', alert: true}});\n }\n prev[name] = status;\n}\n$setWorkflowStaticData('global', prev);\nreturn results.length ? results : [{json: {all_healthy: true}}];\n"
},
"position": [
840,
300
]
},
{
"id": "5",
"name": "IF - Alert Needed",
"type": "n8n-nodes-base.if",
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{$json.alert}}",
"value2": true
}
]
}
},
"position": [
1040,
300
]
},
{
"id": "6",
"name": "Slack - Critical Alert",
"type": "n8n-nodes-base.slack",
"parameters": {
"channel": "#logistics-compliance-ops",
"text": "SUPPLY CHAIN API DOWN: {{$json.name}} | Regulation: {{$json.regulation}} | Severity: {{$json.severity}} | Time: {{$now}}"
},
"position": [
1240,
300
]
},
{
"id": "7",
"name": "Gmail - Compliance Team Alert",
"type": "n8n-nodes-base.gmail",
"parameters": {
"operation": "send",
"to": "[email protected]",
"subject": "CRITICAL: {{$json.name}} DOWN \u2014 {{$json.regulation}}",
"message": "API endpoint {{$json.name}} is DOWN as of {{$now}}.\n\nRegulatory exposure: {{$json.regulation}}\n\nImmediate action required if this outage persists during an active incident reporting window."
},
"position": [
1440,
300
]
}
],
"connections": {
"Schedule - Every 5 Min": {
"main": [
[
{
"node": "Code - Define Endpoints",
"type": "main",
"index": 0
}
]
]
},
"Code - Define Endpoints": {
"main": [
[
{
"node": "HTTP Request - Ping Each",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request - Ping Each": {
"main": [
[
{
"node": "Code - Check Status",
"type": "main",
"index": 0
}
]
]
},
"Code - Check Status": {
"main": [
[
{
"node": "IF - Alert Needed",
"type": "main",
"index": 0
}
]
]
},
"IF - Alert Needed": {
"main": [
[
{
"node": "Slack - Critical Alert",
"type": "main",
"index": 0
}
],
[]
]
},
"Slack - Critical Alert": {
"main": [
[
{
"node": "Gmail - Compliance Team Alert",
"type": "main",
"index": 0
}
]
]
}
}
}
Workflow 3: PHMSA / FDA FSMA / FMC / CBP / CTPAT Compliance Deadline Tracker
Track renewal and filing deadlines across all regulatory frameworks. Send tiered alerts — OVERDUE → CRITICAL → URGENT — with penalty citations that make priority obvious.
{
"name": "LogisticsTech Compliance Deadline Tracker",
"nodes": [
{
"id": "1",
"name": "Schedule - Weekdays 8AM",
"type": "n8n-nodes-base.scheduleTrigger",
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 8 * * 1-5"
}
]
}
},
"position": [
240,
300
]
},
{
"id": "2",
"name": "Sheets - Read Deadline Tracker",
"type": "n8n-nodes-base.googleSheets",
"parameters": {
"operation": "read",
"spreadsheetId": "YOUR_SHEET_ID",
"range": "LogisticsDeadlines!A:J"
},
"position": [
440,
300
]
},
{
"id": "3",
"name": "Code - Classify Priority",
"type": "n8n-nodes-base.code",
"parameters": {
"jsCode": "\nconst today = new Date();\nconst alerts = [];\nconst DEADLINE_TYPES = {\n 'PHMSA_HAZMAT_REGISTRATION_ANNUAL': {regulation: '49 CFR \u00a7171.8 \u2014 PHMSA registration', penalty: '$500-$80,000/violation'},\n 'PHMSA_HAZMAT_TRAINING_BIENNIAL': {regulation: '49 CFR \u00a7172.704 \u2014 HM-181 training recertification', penalty: 'Up to $84,425/day'},\n 'FDA_FSMA_204_TRACEABILITY_COMPLIANCE': {regulation: 'FDA FSMA \u00a7204 21 CFR Part 1 Subpart S \u2014 lot-level KDE records', penalty: 'Seizure, injunction, criminal referral 21 USC \u00a7333'},\n 'FMC_OTI_LICENSE_RENEWAL': {regulation: 'FMC 46 CFR Part 515 \u2014 OTI license renewal', penalty: 'License revocation + $10,000 fine 46 USC \u00a741107'},\n 'FMC_TARIFF_ANNUAL_AUDIT': {regulation: 'FMC OSRA-22 \u00a741102(c) \u2014 tariff accuracy review', penalty: '$45,000/violation 46 USC \u00a741108'},\n 'FMCSA_BROKER_ANNUAL_REGISTRATION': {regulation: '49 CFR Part 371 \u2014 FMCSA freight broker license renewal', penalty: 'License revocation + $16,000/day 49 USC \u00a714704'},\n 'CBP_ISF_QUARTERLY_AUDIT': {regulation: 'CBP 19 CFR \u00a7149.4 \u2014 ISF 10+2 compliance audit', penalty: '$5,000-$10,000/late filing liquidated damages'},\n 'CTPAT_ANNUAL_REVIEW': {regulation: 'CTPAT Minimum Security Criteria \u2014 annual self-assessment', penalty: 'CTPAT suspension (loss of CBP trusted trader benefits)'},\n 'DOT_MOTOR_CARRIER_ANNUAL': {regulation: '49 CFR \u00a7390.19 \u2014 motor carrier identification report', penalty: '$1,000-$10,000 49 USC \u00a7521'},\n 'IATA_DANGEROUS_GOODS_CERT': {regulation: 'IATA DGR Edition 65 \u2014 dangerous goods by air certification', penalty: 'IATA suspension + $25,000-$50,000 FAA 14 CFR \u00a7121.135'},\n 'SOC2_TYPE2_RENEWAL': {regulation: 'SOC 2 Type II \u2014 logistics customer contract requirement', penalty: 'Contract termination'},\n 'ANNUAL_PENTEST': {regulation: 'CTPAT IT security criteria \u2014 annual penetration test', penalty: 'CTPAT Tier downgrade'}\n};\nfor (const row of $input.all().map(i => i.json)) {\n if (!row.deadline_type || !row.due_date || row.alert_sent_date === new Date().toISOString().slice(0,10)) continue;\n const due = new Date(row.due_date);\n const days = Math.ceil((due - today) / 86400000);\n const meta = DEADLINE_TYPES[row.deadline_type] || {regulation: row.deadline_type, penalty: 'See compliance calendar'};\n let priority = null;\n if (days < 0) priority = 'OVERDUE';\n else if (days <= 14) priority = 'CRITICAL';\n else if (days <= 30) priority = 'URGENT';\n else if (days <= 60) priority = 'WARNING';\n if (priority) alerts.push({json: {priority, days_overdue: days < 0 ? Math.abs(days) : null, days_remaining: days >= 0 ? days : null, deadline_type: row.deadline_type, due_date: row.due_date, owner: row.owner, regulation: meta.regulation, penalty: meta.penalty}});\n}\nreturn alerts.length ? alerts : [{json: {no_alerts: true}}];\n"
},
"position": [
640,
300
]
},
{
"id": "4",
"name": "IF - Has Alerts",
"type": "n8n-nodes-base.if",
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{!$json.no_alerts}}",
"value2": true
}
]
}
},
"position": [
840,
300
]
},
{
"id": "5",
"name": "Slack - Compliance Alert",
"type": "n8n-nodes-base.slack",
"parameters": {
"channel": "#logistics-compliance",
"text": "{{$json.priority}}: {{$json.deadline_type}} \u2014 {{$json.regulation}} | Penalty: {{$json.penalty}} | Due: {{$json.due_date}} | Owner: {{$json.owner}}"
},
"position": [
1040,
300
]
},
{
"id": "6",
"name": "Gmail - Owner Alert",
"type": "n8n-nodes-base.gmail",
"parameters": {
"operation": "send",
"to": "={{$json.owner}}",
"subject": "{{$json.priority}}: {{$json.deadline_type}} \u2014 {{$json.days_remaining !== null ? $json.days_remaining + ' days remaining' : 'OVERDUE by ' + $json.days_overdue + ' days'}}",
"message": "Compliance deadline: {{$json.deadline_type}}\nRegulation: {{$json.regulation}}\nPenalty risk: {{$json.penalty}}\nDue: {{$json.due_date}}\nStatus: {{$json.priority}}"
},
"position": [
1240,
300
]
}
],
"connections": {
"Schedule - Weekdays 8AM": {
"main": [
[
{
"node": "Sheets - Read Deadline Tracker",
"type": "main",
"index": 0
}
]
]
},
"Sheets - Read Deadline Tracker": {
"main": [
[
{
"node": "Code - Classify Priority",
"type": "main",
"index": 0
}
]
]
},
"Code - Classify Priority": {
"main": [
[
{
"node": "IF - Has Alerts",
"type": "main",
"index": 0
}
]
]
},
"IF - Has Alerts": {
"main": [
[
{
"node": "Slack - Compliance Alert",
"type": "main",
"index": 0
}
],
[]
]
},
"Slack - Compliance Alert": {
"main": [
[
{
"node": "Gmail - Owner Alert",
"type": "main",
"index": 0
}
]
]
}
}
}
Workflow 4: Supply Chain Compliance Incident Pipeline
Webhook-driven incident intake for PHMSA spills, FDA FSMA traceability failures, FMC complaints, CBP ISF violations, and CTPAT security breaches — with regulatory response deadlines and Postgres audit trail.
{
"name": "Supply Chain Compliance Incident Pipeline",
"nodes": [
{
"id": "1",
"name": "Webhook - Incident Report",
"type": "n8n-nodes-base.webhook",
"parameters": {
"path": "supply-chain-incident",
"responseMode": "onReceived",
"responseCode": 200,
"responseData": "={\"incident_id\": \"{{$json.incident_type}}_{{Date.now()}}\", \"ack\": \"received\", \"response_deadline_hours\": \"see regulatory guidance\"}"
},
"position": [
240,
300
]
},
{
"id": "2",
"name": "Code - Classify Incident",
"type": "n8n-nodes-base.code",
"parameters": {
"jsCode": "\nconst d = $input.first().json;\nconst INCIDENT_MAP = {\n 'PHMSA_HAZMAT_SPILL': {deadline_hours: 0.5, regulation: 'PHMSA 49 CFR \u00a7171.15 \u2014 telephonic notice within 30 min to 1-800-424-8802', severity: 'CRITICAL', notify: 'VP Operations + General Counsel + PHMSA Emergency Response'},\n 'FDA_FSMA_204_TRACEABILITY_FAILURE': {deadline_hours: 24, regulation: 'FDA FSMA \u00a7204 21 CFR \u00a71.1455 \u2014 records available within 24h of FDA request', severity: 'CRITICAL', notify: 'VP Compliance + Quality Director + FDA District Office contact'},\n 'FMC_UNREASONABLE_REFUSAL_COMPLAINT': {deadline_hours: 48, regulation: 'FMC OSRA-22 46 USC \u00a741102(c) \u2014 document all cargo booking decisions with objective criteria', severity: 'HIGH', notify: 'Legal Counsel + VP Operations'},\n 'CBP_ISF_LATE_FILING': {deadline_hours: 4, regulation: 'CBP ISF 19 CFR \u00a7149.4 \u2014 $5,000/late/$10,000/inaccurate, liquidated damages bond', severity: 'HIGH', notify: 'Customs Compliance Team + CBP Account Manager'},\n 'CTPAT_SECURITY_BREACH': {deadline_hours: 4, regulation: 'CTPAT Minimum Security Criteria \u2014 document breach, notify CBP Supply Chain Security Specialist', severity: 'HIGH', notify: 'CISO + CTPAT Program Manager + CBP SCSS'},\n 'FMCSA_BROKER_FRAUD_COMPLAINT': {deadline_hours: 72, regulation: 'FMCSA 49 CFR \u00a7371.13 \u2014 maintain surety bond records and respond to DOT complaint', severity: 'MEDIUM', notify: 'Legal Counsel + Compliance Team'},\n 'GDPR_CROSS_BORDER_BREACH': {deadline_hours: 72, regulation: 'GDPR Art.33 \u2014 72h DPA notification for EU personal data breach (shipper/consignee data)', severity: 'HIGH', notify: 'DPO + Legal + EU Lead DPA'},\n 'COLD_CHAIN_TEMPERATURE_EXCURSION': {deadline_hours: 24, regulation: 'FDA FSMA \u00a7204 + FSIS HACCP 9 CFR Part 417 \u2014 temperature deviation requires lot-level trace and FDA/FSIS notification if food safety risk', severity: 'HIGH', notify: 'Quality Director + Food Safety Team + Customer'}\n};\nconst meta = INCIDENT_MAP[d.incident_type] || {deadline_hours: 72, regulation: 'Internal review required', severity: 'MEDIUM', notify: 'Compliance Team'};\nconst deadline = new Date(Date.now() + meta.deadline_hours * 3600000).toISOString();\nreturn [{json: {incident_id: `${d.incident_type}_${Date.now()}`, incident_type: d.incident_type, ...meta, response_deadline: deadline, source_data: d, ts: new Date().toISOString()}}];\n"
},
"position": [
440,
300
]
},
{
"id": "3",
"name": "Postgres - Log Incident",
"type": "n8n-nodes-base.postgres",
"parameters": {
"operation": "executeQuery",
"query": "INSERT INTO supply_chain_incidents (incident_id, incident_type, severity, regulation, response_deadline, source_data, created_at) VALUES ('{{$json.incident_id}}', '{{$json.incident_type}}', '{{$json.severity}}', '{{$json.regulation}}', '{{$json.response_deadline}}', '{{JSON.stringify($json.source_data)}}', '{{$json.ts}}');"
},
"position": [
640,
300
]
},
{
"id": "4",
"name": "Slack - Incident Alert",
"type": "n8n-nodes-base.slack",
"parameters": {
"channel": "#supply-chain-incidents",
"text": "{{$json.severity}} INCIDENT: {{$json.incident_type}} | Regulation: {{$json.regulation}} | Response deadline: {{$json.response_deadline}} | Notify: {{$json.notify}}"
},
"position": [
840,
300
]
},
{
"id": "5",
"name": "Gmail - Compliance Team",
"type": "n8n-nodes-base.gmail",
"parameters": {
"operation": "send",
"to": "[email protected]",
"subject": "{{$json.severity}}: {{$json.incident_type}} \u2014 Response deadline {{$json.response_deadline}}",
"message": "Incident ID: {{$json.incident_id}}\nType: {{$json.incident_type}}\nSeverity: {{$json.severity}}\nRegulatory obligation: {{$json.regulation}}\nResponse deadline: {{$json.response_deadline}}\nNotify immediately: {{$json.notify}}\n\nThis record is logged in Postgres as the compliance audit trail."
},
"position": [
1040,
300
]
}
],
"connections": {
"Webhook - Incident Report": {
"main": [
[
{
"node": "Code - Classify Incident",
"type": "main",
"index": 0
}
]
]
},
"Code - Classify Incident": {
"main": [
[
{
"node": "Postgres - Log Incident",
"type": "main",
"index": 0
}
]
]
},
"Postgres - Log Incident": {
"main": [
[
{
"node": "Slack - Incident Alert",
"type": "main",
"index": 0
}
]
]
},
"Slack - Incident Alert": {
"main": [
[
{
"node": "Gmail - Compliance Team",
"type": "main",
"index": 0
}
]
]
}
}
}
Workflow 5: Weekly LogisticsTech Platform KPI Dashboard
Executive KPI email every Monday 8 AM — compliance incident summary, regulatory deadline status, platform health, and supply chain metrics for CEO and VP Operations.
{
"name": "Weekly LogisticsTech KPI Dashboard",
"nodes": [
{
"id": "1",
"name": "Schedule - Monday 8AM",
"type": "n8n-nodes-base.scheduleTrigger",
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 8 * * 1"
}
]
}
},
"position": [
240,
300
]
},
{
"id": "2",
"name": "Postgres - Platform Metrics",
"type": "n8n-nodes-base.postgres",
"parameters": {
"operation": "executeQuery",
"query": "SELECT COUNT(DISTINCT customer_id) as active_accounts, COUNT(CASE WHEN tier='ENTERPRISE_3PL' THEN 1 END) as enterprise_count, COUNT(CASE WHEN tier='FOOD_COLD_CHAIN_VENDOR' THEN 1 END) as cold_chain_count FROM customer_onboarding WHERE created_at > NOW() - INTERVAL '30 days';"
},
"position": [
440,
300
]
},
{
"id": "3",
"name": "Postgres - Compliance Events",
"type": "n8n-nodes-base.postgres",
"parameters": {
"operation": "executeQuery",
"query": "SELECT incident_type, severity, COUNT(*) as count FROM supply_chain_incidents WHERE created_at > NOW() - INTERVAL '7 days' GROUP BY incident_type, severity ORDER BY CASE severity WHEN 'CRITICAL' THEN 1 WHEN 'HIGH' THEN 2 ELSE 3 END;"
},
"position": [
640,
300
]
},
{
"id": "4",
"name": "Merge - All KPIs",
"type": "n8n-nodes-base.merge",
"parameters": {
"mode": "combine"
},
"position": [
840,
300
]
},
{
"id": "5",
"name": "Code - Build KPI Report",
"type": "n8n-nodes-base.code",
"parameters": {
"jsCode": "\nconst platform = $input.all()[0]?.json || {};\nconst incidents = $input.all().slice(1);\nconst critical = incidents.filter(i => i.json.severity === 'CRITICAL');\nconst high = incidents.filter(i => i.json.severity === 'HIGH');\nconst phmsa_open = incidents.filter(i => i.json.incident_type?.includes('PHMSA')).length;\nconst fsma_open = incidents.filter(i => i.json.incident_type?.includes('FSMA')).length;\nconst ctpat_open = incidents.filter(i => i.json.incident_type?.includes('CTPAT')).length;\nconst cbp_open = incidents.filter(i => i.json.incident_type?.includes('CBP')).length;\nconst flagLine = [\n phmsa_open > 0 ? `[PHMSA INCIDENT OPEN: ${phmsa_open}]` : null,\n fsma_open > 0 ? `[FDA FSMA OPEN: ${fsma_open}]` : null,\n ctpat_open > 0 ? `[CTPAT BREACH: ${ctpat_open}]` : null,\n cbp_open > 0 ? `[CBP ISF OPEN: ${cbp_open}]` : null\n].filter(Boolean).join(' ');\nconst subject = flagLine ? `LOGISTICS KPI \u2014 INCIDENTS OPEN: ${flagLine}` : 'Weekly LogisticsTech KPI \u2014 All Clear';\nreturn [{json: {subject, platform, critical_count: critical.length, high_count: high.length, phmsa_open, fsma_open, ctpat_open, cbp_open, flagLine}}];\n"
},
"position": [
1040,
300
]
},
{
"id": "6",
"name": "Gmail - KPI Report",
"type": "n8n-nodes-base.gmail",
"parameters": {
"operation": "send",
"to": "[email protected]",
"cc": "[email protected]",
"bcc": "[email protected]",
"subject": "={{$json.subject}}",
"message": "Weekly LogisticsTech KPI \u2014 {{new Date().toISOString().slice(0,10)}}\n\nPlatform: {{$json.platform.active_accounts}} active accounts | {{$json.platform.enterprise_count}} enterprise 3PLs | {{$json.platform.cold_chain_count}} FDA FSMA cold chain accounts\n\nCompliance incidents (7d): CRITICAL {{$json.critical_count}} | HIGH {{$json.high_count}}\n- PHMSA HAZMAT open: {{$json.phmsa_open}} (49 CFR \u00a7171.15 \u2014 30-min clock)\n- FDA FSMA \u00a7204 open: {{$json.fsma_open}} (24h FDA request)\n- CTPAT breach open: {{$json.ctpat_open}}\n- CBP ISF violation open: {{$json.cbp_open}}\n\n{{$json.flagLine || 'No open compliance incidents.'}}"
},
"position": [
1240,
300
]
}
],
"connections": {
"Schedule - Monday 8AM": {
"main": [
[
{
"node": "Postgres - Platform Metrics",
"type": "main",
"index": 0
}
]
]
},
"Postgres - Platform Metrics": {
"main": [
[
{
"node": "Postgres - Compliance Events",
"type": "main",
"index": 0
}
]
]
},
"Postgres - Compliance Events": {
"main": [
[
{
"node": "Merge - All KPIs",
"type": "main",
"index": 0
}
]
]
},
"Merge - All KPIs": {
"main": [
[
{
"node": "Code - Build KPI Report",
"type": "main",
"index": 0
}
]
]
},
"Code - Build KPI Report": {
"main": [
[
{
"node": "Gmail - KPI Report",
"type": "main",
"index": 0
}
]
]
}
}
}
Why self-hosted n8n for logistics compliance
| Compliance argument | Self-hosting benefit |
|---|---|
| PHMSA 49 CFR §171.15: 30-min telephonic notice | Self-hosted = no cloud vendor outage during HAZMAT incident. 30-min clock does not pause for SaaS downtime |
| FDA FSMA §204 21 CFR §1.1455: 24h KDE record production | Lot-level traceability records stay in your Postgres. FDA inspector gets records from your system, not a cloud vendor's audit log |
| FMC OSRA-22 §41102(c): subpoena readiness | FMC subpoena covers communications and records — cloud iPaaS audit logs may be compelled separately, breaking your legal hold perimeter |
| CBP ISF 19 CFR §149.4: chain of custody for 10+2 data | CBP CTPAT SEVI assessment: who has access to ISF data? Cloud iPaaS = new entity in scope for CTPAT security validation |
| CTPAT Minimum Security Criteria: IT security documentation | Self-hosted = one-time security assessment, Git-versioned change control. Cloud iPaaS = recurring SEVI renewal every CTPAT audit cycle |
5 buyer questions answered
Q: Our platform files ISF 10+2 via ABI. Does n8n touch CBP directly?
No. n8n orchestrates your existing ISF filing API. The ISF transmission stays in your ABI-certified filing agent chain. n8n adds monitoring, alerting, and Postgres audit trail without becoming an ABI participant.
Q: How does the FDA FSMA §204 traceability workflow handle PTI lot number format?
The KDE schema in the workflow uses PTI-compliant GTIN+lot+date format per FDA's Traceability Lot Code definition in 21 CFR §1.1310. Customize the Code node to match your food supply chain's CTEs (Critical Tracking Events) — growing, receiving, transforming, shipping.
Q: Our PHMSA registration covers multiple modes (road, rail, air). Does the workflow track all?
Yes — the deadline tracker includes PHMSA_HAZMAT_REGISTRATION_ANNUAL for surface modes (49 CFR §171.8) and IATA_DANGEROUS_GOODS_CERT for air (IATA DGR). Add DOT_PIPELINE_ANNUAL for pipeline operators. Each has a separate owner and penalty citation.
Q: We have CTPAT Tier 2. Does n8n count as a new IT system in scope for CTPAT's Minimum Security Criteria?
Self-hosted n8n on your own infrastructure: no. It's your system, within your existing CTPAT IT security boundary. Cloud-hosted iPaaS: yes — it's a new third-party system with access to shipment data, requiring SEVI documentation in your CTPAT annual review.
Q: FMC OSRA-22 expanded ocean shipper rights. Our platform serves ocean carriers. How does the workflow help?
The FMC_TARIFF_ANNUAL_AUDIT deadline type covers 46 CFR Part 520 tariff accuracy. The FMC_UNREASONABLE_REFUSAL_COMPLAINT incident type (48h response) captures the §41102(c) obligation to document objective, non-discriminatory reasons for cargo booking decisions. Both are pre-built in the workflows above.
Get all 15 workflows
These five workflows are part of the FlowKit n8n Automation Templates collection — 15 production-ready workflows for SaaS vendors covering logistics, compliance, customer ops, and reporting.
Get them at stripeai.gumroad.com — individual templates from $12, full bundle $97.
Questions? Drop a comment below or reach out via the store.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.