DEV Community

Alex Kane
Alex Kane

Posted on

n8n for FoodTech/RestaurantTech SaaS Vendors: 5 Automations for FDA FSMA, USDA Class I Recalls, and Food Safety Compliance

If your FoodTech or RestaurantTech SaaS platform processes food safety records, manages recall workflows, or handles order and payment data — you have compliance clocks running that most SaaS engineering teams don't track.

This article maps the five fastest clocks and five n8n workflows that address them.

The 7 FoodTech/RestaurantTech SaaS Compliance Tiers

This framework segments vendors by regulatory exposure:

Tier Key Regulations
RESTAURANT_MANAGEMENT_SAAS USDA HACCP §417, ADA Title III WCAG 2.1 AA, PCI DSS v4.0
FOOD_DELIVERY_PLATFORM_SAAS FDA FSMA §1.279 24h, CCPA §1798.130, ADA Title III
FOOD_SAFETY_COMPLIANCE_SAAS USDA FSIS Class I Recall IMMEDIATE, FDA FSMA §204 24h, HARPC §417
GHOST_KITCHEN_SAAS USDA HACCP §416, FDA FSMA §117 Preventive Controls, local health codes
FOOD_MANUFACTURING_SAAS FDA FSMA §204 Traceability 24h, ISO 22000 CAPA, REACH, USDA Class I
BEVERAGE_ALCOHOL_SAAS TTB 27 CFR Part 1/25/4/5, state ABC licensing, CCPA, PCI DSS
FOODTECH_STARTUP_SAAS FDA FSMA §117 Qualified Facility, CCPA, ADA Title III, PCI DSS v4.0

The 7 Compliance Flags

FSMA_PREVENTIVE_CONTROLS_SUBJECT      # FDA FSMA §417 / 21 CFR Part 117
USDA_FSIS_RECALL_OBLIGATED            # USDA FSIS 9 CFR §381.1 / §317.1
FDA_TRACEABILITY_RULE_SUBJECT         # FDA FSMA §204 / 21 CFR Part 1 Subpart S
TTB_BEVERAGE_ALCOHOL_PERMIT           # TTB 27 CFR Part 1/25/4/5
ADA_ONLINE_ORDERING_SUBJECT           # ADA Title III / WCAG 2.1 AA
PCI_DSS_PAYMENT_PROCESSING            # PCI DSS v4.0
CCPA_COVERED_BUSINESS                 # CCPA §1798.130 / §1798.140
Enter fullscreen mode Exit fullscreen mode

The Clock That Starts Before Your Recall Team Picks Up the Phone

Here is the problem with cloud iPaaS in a food safety context:

USDA FSIS 9 CFR §381.1 / §317.1 Class I Recall covers meat and poultry products where there is a reasonable probability of serious adverse health consequences or death. Upon the product recovery decision, the recall is initiated IMMEDIATELY.

The USDA recall timeline begins at the decision timestamp — not at the moment a human reviews the queue.

If your cloud automation platform receives the recall trigger event at 11:47 PM, and your on-call engineer doesn't review the alert until 2:15 AM — the USDA audit examines what happened in those 2 hours and 28 minutes. Every automated step, every system timestamp, every API call your platform made is USDA exhibit material.

The same logic applies to the FDA FSMA 21 CFR §1.279 24-Hour Outbreak Notification: the clock starts when you reasonably believe a product caused or contributed to a foodborne illness outbreak. If your platform aggregates complaint data and a cluster of similar reports is visible in your database, the 24-hour clock may have started at the first correlated complaint timestamp — not when your compliance team ran the weekly report.

The 10 Fastest FoodTech Compliance Clocks

Clock Regulation Trigger
USDA FSIS Class I Recall 9 CFR §381.1 / §317.1 IMMEDIATE upon product recovery decision
HACCP Corrective Action USDA §417.3 IMMEDIATE upon deviation detection
FDA FSMA Outbreak Notification 21 CFR §1.279 24h from 'reasonably believes'
FDA Traceability Records FSMA §204 / 21 CFR Part 1 Subpart S 24h from FDA request
ADA Demand Response ADA Title III / WCAG 2.1 AA IMMEDIATE/24h from notice
PCI DSS Breach — Card Brands PCI DSS v4.0 24h from detection
PCI DSS Breach — Cardholders PCI DSS v4.0 30 days from detection
CCPA Deletion Request CCPA §1798.130 45 days from receipt
TTB Formula Resubmission 27 CFR Part 25/4/5 30-90 day review cycle
FDA FSMA Qualified Facility §117.5(b) Annual renewal

The 5-Tier Exposure Map

FOOD_SAFETY_COMPLIANCE_SAAS (highest): USDA Class I recall IMMEDIATE + FDA §1.279 24h + FDA §204 24h all active simultaneously during an outbreak investigation. Your platform is the system of record for the recall timeline. USDA and FDA examine your audit logs, timestamps, and notification records.

FOOD_MANUFACTURING_SAAS: FDA §204 Traceability Rule — if you hold Key Data Elements (KDEs) for Food Traceability List (FTL) products (leafy greens, shell eggs, nut butters, finfish, crustaceans, ready-to-eat deli salads), FDA can request all records within 24 hours during an outbreak investigation. Your API response time is the compliance risk.

RESTAURANT_MANAGEMENT_SAAS: HACCP corrective action records are USDA evidence. If your platform is the system of record for HACCP deviations, the corrective action timestamp in your database is what FSIS inspectors look at. Cloud batch-sync that runs every 15 minutes can insert a 15-minute gap into the HACCP record.

FOOD_DELIVERY_PLATFORM_SAAS: FDA §1.279 'reasonably believes' standard — if your platform aggregates complaint data and an illness cluster is detectable in your raw data, the 24-hour clock may start at the first correlated data point. Your analytics pipeline latency is a compliance risk.

BEVERAGE_ALCOHOL_SAAS: TTB formula approval is a gated workflow. Cloud automation managing formula submissions must handle TTB rejection response windows and state ABC notice requirements across 50 different state licensing frameworks.

Why Self-Hosted n8n Matters for FoodTech

Four architectural reasons self-hosted n8n fits food safety compliance better than cloud iPaaS:

1. HACCP record custody (FDA §117.150): FDA regulations require food facility records be maintained under the control of the facility and accessible for FDA inspection. A cloud iPaaS audit trail is stored on vendor infrastructure — outside the facility's control boundary. Self-hosted n8n keeps HACCP workflow logs within the facility's own infrastructure.

2. USDA recall timestamp integrity: USDA examines the recall timeline during investigations. Cloud automation logs are vendor-side records, not facility-controlled records. Self-hosted n8n provides a database-backed audit trail (Postgres) that the facility controls and can produce to USDA without third-party involvement.

3. FDA §1.279 'reasonably believes' clock: The clock starts at the earliest system detection. If your cloud analytics has a polling cycle, you may not detect the illness cluster until minutes or hours after it was detectable in raw data. Self-hosted n8n with real-time webhook processing from your complaint system fires the FDA notification clock at T+0 from complaint receipt.

4. FDA §204 24-hour traceability response: Cloud iPaaS APIs may have rate limits, maintenance windows, or SLA gaps. If FDA issues a traceability records request during a cloud maintenance window, the 24-hour clock keeps running. Self-hosted n8n on your own infrastructure has no third-party uptime dependency for the traceability response pipeline.

Workflow 1: Tier-Segmented Onboarding Drip

Routes new FoodTech/RestaurantTech customers to tier-specific compliance onboarding based on their regulatory profile.

{
  "name": "FoodTech/RestaurantTech Onboarding Drip (Tier-Segmented)",
  "nodes": [
    {
      "id": "1",
      "name": "Webhook New Customer",
      "type": "n8n-nodes-base.webhook",
      "parameters": {
        "path": "foodtech-restauranttech-onboard",
        "responseMode": "responseNode"
      },
      "position": [
        250,
        300
      ]
    },
    {
      "id": "2",
      "name": "Switch Route by Tier",
      "type": "n8n-nodes-base.switch",
      "parameters": {
        "mode": "rules",
        "rules": {
          "values": [
            {
              "conditions": {
                "string": [
                  {
                    "value1": "={{ $json.tier }}",
                    "operation": "equals",
                    "value2": "RESTAURANT_MANAGEMENT_SAAS"
                  }
                ]
              }
            },
            {
              "conditions": {
                "string": [
                  {
                    "value1": "={{ $json.tier }}",
                    "operation": "equals",
                    "value2": "FOOD_DELIVERY_PLATFORM_SAAS"
                  }
                ]
              }
            },
            {
              "conditions": {
                "string": [
                  {
                    "value1": "={{ $json.tier }}",
                    "operation": "equals",
                    "value2": "FOOD_SAFETY_COMPLIANCE_SAAS"
                  }
                ]
              }
            },
            {
              "conditions": {
                "string": [
                  {
                    "value1": "={{ $json.tier }}",
                    "operation": "equals",
                    "value2": "GHOST_KITCHEN_SAAS"
                  }
                ]
              }
            },
            {
              "conditions": {
                "string": [
                  {
                    "value1": "={{ $json.tier }}",
                    "operation": "equals",
                    "value2": "FOOD_MANUFACTURING_SAAS"
                  }
                ]
              }
            },
            {
              "conditions": {
                "string": [
                  {
                    "value1": "={{ $json.tier }}",
                    "operation": "equals",
                    "value2": "BEVERAGE_ALCOHOL_SAAS"
                  }
                ]
              }
            }
          ]
        }
      },
      "position": [
        500,
        300
      ]
    },
    {
      "id": "3",
      "name": "Gmail Restaurant Mgmt Welcome HACCP",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "to": "={{ $('Webhook New Customer').item.json.email }}",
        "subject": "USDA HACCP Corrective Action + ADA WCAG 2.1 AA Online Ordering \u2014 Your Restaurant Management SaaS Onboarding Checklist",
        "message": "Welcome to FlowKit. As a restaurant management SaaS vendor: (1) USDA FSIS 9 CFR \u00a7417.3 HACCP Corrective Actions: if your platform manages production or food safety records for USDA-inspected establishments, a HACCP deviation requires immediate corrective action and written documentation. The corrective action record must identify the cause of the deviation, the disposition of the affected product, and the preventive measure to ensure it will not recur. If your platform is the system of record and an alert fires after hours, the cloud batch-sync cycle may delay the corrective action trigger \u2014 and the written record timestamp is FDA/USDA evidence. (2) ADA Title III WCAG 2.1 AA: online ordering platforms serving the public are Title III places of public accommodation under the Ninth Circuit (Robles v. Domino's 2019) and Eleventh Circuit (Gil v. Winn-Dixie 2021). An accessibility demand letter starts an IMMEDIATE obligation to remediate. Serial plaintiff firms file hundreds of cases per year against restaurant ordering platforms. (3) PCI DSS v4.0 Requirement 10.4.1: daily log review for all in-scope system components. If your platform processes payment data, your logging pipeline is PCI scope."
      },
      "position": [
        800,
        50
      ]
    },
    {
      "id": "4",
      "name": "Gmail Food Delivery Welcome FSMA",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "to": "={{ $('Webhook New Customer').item.json.email }}",
        "subject": "FDA FSMA \u00a71.279 24-Hour Foodborne Illness Notification + CCPA + ADA \u2014 Your Food Delivery Platform SaaS Onboarding Checklist",
        "message": "As a food delivery platform SaaS vendor: (1) FDA FSMA 21 CFR \u00a71.279 Foodborne Illness Outbreak Notification: if your platform has information that reasonably suggests a product caused or contributed to a foodborne illness outbreak, FDA must be notified within 24 hours. 'Reasonably believes' is an objective standard \u2014 if your platform aggregates complaint data and a cluster of similar illness reports is visible in your database, the 24-hour clock may have started. A cloud analytics pipeline that runs hourly may detect the cluster after the clock has already started based on raw complaint timestamps. (2) CCPA \u00a71798.130: food delivery platforms processing consumer PII from California residents must respond to consumer requests within 45 days. If your platform manages customer data, the CCPA service provider definition under \u00a71798.140(ag)(2) must prohibit data use beyond contracted services. (3) ADA Title III WCAG 2.1 AA: food delivery apps and websites are public accommodations. Inaccessible checkout flows are the most litigated area."
      },
      "position": [
        800,
        200
      ]
    },
    {
      "id": "5",
      "name": "Gmail Food Safety Welcome Recall",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "to": "={{ $('Webhook New Customer').item.json.email }}",
        "subject": "USDA FSIS Class I Recall IMMEDIATE + FDA FSMA \u00a7117 HARPC \u2014 Your Food Safety Compliance SaaS Onboarding Checklist",
        "message": "As a food safety compliance SaaS vendor: (1) USDA FSIS 9 CFR \u00a7381.1 / 9 CFR \u00a7317.1 Class I Recall: for meat and poultry products where there is a reasonable probability of serious adverse health consequences, the recall is initiated IMMEDIATELY upon the product recovery decision. If your platform triggers the recall workflow, the timestamp of your first automated action is the USDA exhibit for the recall timeline. A cloud automation that fires at T+0 but your human review doesn't happen until T+4h creates a 4-hour gap in the recall audit trail that USDA will examine. (2) FDA FSMA \u00a7417 / 21 CFR Part 117 HARPC: food facilities subject to Preventive Controls must have a written food safety plan including hazard analysis, preventive controls, monitoring, corrective actions, and verification. If your platform manages the hazard analysis data, your cloud storage is in scope for FDA inspection. (3) FDA FSMA \u00a7204 Traceability Rule 21 CFR Part 1 Subpart S: upon FDA request, covered food facilities must provide Key Data Elements (KDEs) within 24 hours. If your traceability platform holds the critical tracking events (CTEs), the 24-hour response clock starts at FDA request receipt."
      },
      "position": [
        800,
        350
      ]
    },
    {
      "id": "6",
      "name": "Gmail Food Mfg Welcome EPA FSMA",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "to": "={{ $('Webhook New Customer').item.json.email }}",
        "subject": "FDA FSMA \u00a7204 24-Hour Traceability Records + USDA FSIS Class I Recall + ISO 22000 \u2014 Your Food Manufacturing SaaS Onboarding Checklist",
        "message": "As a food manufacturing SaaS vendor: (1) FDA FSMA \u00a7204 Food Traceability Rule 21 CFR Part 1 Subpart S: manufacturers of foods on the Food Traceability List (FTL) \u2014 leafy greens, shell eggs, nut butters, fresh herbs, ready-to-eat deli salads, finfish, crustaceans, mollusks, tropical tree fruits \u2014 must maintain Key Data Elements (KDEs) and Critical Tracking Events (CTEs). Upon FDA request during an outbreak investigation, records must be provided within 24 hours. If your manufacturing SaaS holds KDEs and your API response time is measured in hours, the 24-hour window is tight. (2) USDA FSIS Class I Recall: food manufacturers using FSIS-inspected facilities face the most immediate recall obligation in food safety law. Your platform's alert-to-human-review latency is the recall timeline risk. (3) ISO 22000:2018 \u00a78.5.4 Corrective Actions and \u00a78.9 Nonconformity and Corrective Action: audit evidence must show root cause analysis and timeline. Cloud workflow logs are ISO 22000 audit artifacts."
      },
      "position": [
        800,
        500
      ]
    },
    {
      "id": "7",
      "name": "Gmail Bev Alcohol Welcome TTB",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "to": "={{ $('Webhook New Customer').item.json.email }}",
        "subject": "TTB 27 CFR Part 1 Beverage Alcohol Permit + COLA + Formula Approval \u2014 Your Beverage Alcohol SaaS Onboarding Checklist",
        "message": "As a beverage alcohol SaaS vendor: (1) TTB 27 CFR Part 1: manufacturers, importers, and wholesalers of beverage alcohol require federal basic permits. If your platform manages formula submissions, label (COLA) approvals, or permit applications, TTB formula approval timelines (typically 30-90 days) are workflow-gated. Automated resubmission on rejection requires compliance with TTB 27 CFR Part 25 (beer) / Part 4 (wine) / Part 5 (distilled spirits) formula requirements. (2) State ABC license: alcohol beverage control licensing is state-specific. Most states require advance notice of formula or label changes that may constitute new product registration. If your platform manages state compliance filings, the notice-to-filing workflow must account for state-specific deadlines. (3) CCPA + TTB data: customer purchase data from DTC alcohol shipments is subject to both CCPA and state DTC shipping law. A CCPA deletion request on a repeat customer's purchase history must be reconciled against TTB audit retention requirements."
      },
      "position": [
        800,
        650
      ]
    },
    {
      "id": "8",
      "name": "Wait 3 Days",
      "type": "n8n-nodes-base.wait",
      "parameters": {
        "resume": "timeInterval",
        "unit": "days",
        "value": 3
      },
      "position": [
        1050,
        300
      ]
    },
    {
      "id": "9",
      "name": "Gmail Day 4 Compliance Checkpoint",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "to": "={{ $('Webhook New Customer').item.json.email }}",
        "subject": "Day 4: Your FoodTech Compliance Deadline Calendar",
        "message": "Your 4-day check-in. The n8n compliance workflow tracks: USDA FSIS Class I recall IMMEDIATE, FDA FSMA \u00a71.279 24h outbreak notification, FDA FSMA \u00a7204 24h traceability records, HACCP corrective action IMMEDIATE, ADA WCAG 2.1 AA demand IMMEDIATE, TTB formula/COLA timelines, PCI DSS v4.0 daily log review, CCPA 45-day request response."
      },
      "position": [
        1300,
        300
      ]
    },
    {
      "id": "10",
      "name": "Wait 4 More Days",
      "type": "n8n-nodes-base.wait",
      "parameters": {
        "resume": "timeInterval",
        "unit": "days",
        "value": 4
      },
      "position": [
        1550,
        300
      ]
    },
    {
      "id": "11",
      "name": "Gmail Day 8 Advanced CTA",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "to": "={{ $('Webhook New Customer').item.json.email }}",
        "subject": "Day 8: Advanced FoodTech Compliance Workflows Available",
        "message": "Next: the USDA recall and FDA FSMA incident pipeline (8 event types) and the FoodTech API health monitor. Available in the FlowKit bundle: https://stripeai.gumroad.com"
      },
      "position": [
        1800,
        300
      ]
    }
  ],
  "connections": {
    "Webhook New Customer": {
      "main": [
        [
          {
            "node": "Switch Route by Tier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch Route by Tier": {
      "main": [
        [
          {
            "node": "Gmail Restaurant Mgmt Welcome HACCP",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Gmail Food Delivery Welcome FSMA",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Gmail Food Safety Welcome Recall",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Gmail Food Safety Welcome Recall",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Gmail Food Mfg Welcome EPA FSMA",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Gmail Bev Alcohol Welcome TTB",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Restaurant Mgmt Welcome HACCP": {
      "main": [
        [
          {
            "node": "Wait 3 Days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Food Delivery Welcome FSMA": {
      "main": [
        [
          {
            "node": "Wait 3 Days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Food Safety Welcome Recall": {
      "main": [
        [
          {
            "node": "Wait 3 Days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Food Mfg Welcome EPA FSMA": {
      "main": [
        [
          {
            "node": "Wait 3 Days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Bev Alcohol Welcome TTB": {
      "main": [
        [
          {
            "node": "Wait 3 Days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 3 Days": {
      "main": [
        [
          {
            "node": "Gmail Day 4 Compliance Checkpoint",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Day 4 Compliance Checkpoint": {
      "main": [
        [
          {
            "node": "Wait 4 More Days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 4 More Days": {
      "main": [
        [
          {
            "node": "Gmail Day 8 Advanced CTA",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Workflow 2: USDA FSIS/FDA FSMA/HACCP Compliance Deadline Tracker

Daily scan of compliance deadlines with urgency routing — USDA Class I, FDA §1.279, FDA §204, HACCP, ADA, PCI, CCPA, TTB.

{
  "name": "USDA FSIS/FDA FSMA/HACCP/TTB Compliance Deadline Tracker",
  "nodes": [
    {
      "id": "1",
      "name": "Schedule Daily 6AM",
      "type": "n8n-nodes-base.scheduleTrigger",
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "triggerAtHour": 6
            }
          ]
        }
      },
      "position": [
        250,
        300
      ]
    },
    {
      "id": "2",
      "name": "Google Sheets Read Compliance Deadlines",
      "type": "n8n-nodes-base.googleSheets",
      "parameters": {
        "operation": "getAll",
        "sheetId": "YOUR_SHEET_ID",
        "range": "Deadlines!A2:L1000"
      },
      "position": [
        500,
        300
      ]
    },
    {
      "id": "3",
      "name": "Code Calculate Regulatory Clocks",
      "type": "n8n-nodes-base.code",
      "parameters": {
        "jsCode": "const now = new Date(); const results = []; for (const item of $input.all()) { const d = item.json; const deadline = new Date(d.deadline_date); const hoursRemaining = (deadline - now) / (1000 * 60 * 60); const daysRemaining = Math.ceil((deadline - now) / (1000 * 60 * 60 * 24)); let severity; if (d.clock_type === 'USDA_FSIS_CLASS_I_RECALL_IMMEDIATE' && hoursRemaining <= 0) { severity = 'RECALL_BREACH'; } else if (d.clock_type === 'FDA_FSMA_1_279_OUTBREAK_24H' && hoursRemaining <= 0) { severity = 'FDA_BREACH'; } else if (d.clock_type === 'FDA_FSMA_204_TRACEABILITY_24H' && hoursRemaining <= 0) { severity = 'FDA_BREACH'; } else if (d.clock_type === 'HACCP_CORRECTIVE_ACTION_IMMEDIATE' && hoursRemaining <= 0) { severity = 'CRITICAL'; } else if (d.clock_type === 'ADA_WCAG_DEMAND_IMMEDIATE' && hoursRemaining <= 0) { severity = 'CRITICAL'; } else if (d.clock_type === 'USDA_FSIS_CLASS_I_RECALL_IMMEDIATE' && hoursRemaining <= 2) { severity = 'CRITICAL'; } else if (d.clock_type === 'FDA_FSMA_1_279_OUTBREAK_24H' && hoursRemaining <= 4) { severity = 'CRITICAL'; } else if (d.clock_type === 'PCI_DSS_BREACH_CARD_BRAND_24H' && hoursRemaining <= 4) { severity = 'CRITICAL'; } else if (d.clock_type === 'CCPA_DELETION_REQUEST_45DAY' && daysRemaining <= 7) { severity = 'HIGH'; } else if (d.clock_type === 'PCI_DSS_BREACH_CARDHOLDER_30DAY' && daysRemaining <= 7) { severity = 'HIGH'; } else if (d.clock_type === 'TTB_FORMULA_APPROVAL_90DAY' && daysRemaining <= 14) { severity = 'HIGH'; } else if (d.clock_type === 'FDA_FSMA_QUALIFIED_FACILITY_ANNUAL' && daysRemaining <= 30) { severity = 'MEDIUM'; } else if (d.clock_type === 'ISO_22000_CAPA_CLOSURE' && daysRemaining <= 14) { severity = 'MEDIUM'; } else if (daysRemaining <= 1) { severity = 'CRITICAL'; } else if (daysRemaining <= 7) { severity = 'HIGH'; } else if (daysRemaining <= 30) { severity = 'MEDIUM'; } else { severity = 'OK'; } if (severity !== 'OK') { results.push({ json: { ...d, hoursRemaining: Math.round(hoursRemaining), daysRemaining, severity, calculatedAt: now.toISOString() } }); } } return results;"
      },
      "position": [
        750,
        300
      ]
    },
    {
      "id": "4",
      "name": "Filter Critical and High",
      "type": "n8n-nodes-base.filter",
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.severity }}",
              "operation": "notEquals",
              "value2": "OK"
            }
          ]
        }
      },
      "position": [
        1000,
        300
      ]
    },
    {
      "id": "5",
      "name": "Gmail Compliance Alert",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "to": "={{ $json.compliance_contact_email }}",
        "subject": "={{ '[' + $json.severity + '] ' + $json.clock_type + ' \u2014 ' + $json.account_name + ' \u2014 ' + $json.daysRemaining + ' days remaining' }}",
        "message": "={{ 'FoodTech Compliance Alert\\n\\nAccount: ' + $json.account_name + '\\nClock Type: ' + $json.clock_type + '\\nRegulation: ' + $json.regulation_cite + '\\nDeadline: ' + $json.deadline_date + '\\nHours Remaining: ' + $json.hoursRemaining + '\\nDays Remaining: ' + $json.daysRemaining + '\\nSeverity: ' + $json.severity + '\\n\\nAction Required: ' + $json.action_required + '\\n\\nThis alert was generated by your FlowKit n8n compliance workflow.' }}"
      },
      "position": [
        1250,
        300
      ]
    },
    {
      "id": "6",
      "name": "Google Sheets Log Alert Sent",
      "type": "n8n-nodes-base.googleSheets",
      "parameters": {
        "operation": "append",
        "sheetId": "YOUR_SHEET_ID",
        "range": "AlertLog!A:H",
        "values": [
          [
            "={{ $json.account_name }}",
            "={{ $json.clock_type }}",
            "={{ $json.regulation_cite }}",
            "={{ $json.deadline_date }}",
            "={{ $json.severity }}",
            "={{ $json.daysRemaining }}",
            "={{ $now.toISO() }}",
            "ALERT_SENT"
          ]
        ]
      },
      "position": [
        1500,
        300
      ]
    }
  ],
  "connections": {
    "Schedule Daily 6AM": {
      "main": [
        [
          {
            "node": "Google Sheets Read Compliance Deadlines",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets Read Compliance Deadlines": {
      "main": [
        [
          {
            "node": "Code Calculate Regulatory Clocks",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code Calculate Regulatory Clocks": {
      "main": [
        [
          {
            "node": "Filter Critical and High",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Critical and High": {
      "main": [
        [
          {
            "node": "Gmail Compliance Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Compliance Alert": {
      "main": [
        [
          {
            "node": "Google Sheets Log Alert Sent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Workflow 3: FoodTech API Health Monitor

10-minute health checks on FSMA traceability API, HACCP records API, recall management API, payment gateway, and ADA accessibility API — with compliance risk annotation on each failure.

{
  "name": "FoodTech API Health Monitor (FSMA Traceability + HACCP + PCI + ADA)",
  "nodes": [
    {
      "id": "1",
      "name": "Schedule Every 10 Minutes",
      "type": "n8n-nodes-base.scheduleTrigger",
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes",
              "triggerAtMinute": 10
            }
          ]
        }
      },
      "position": [
        250,
        300
      ]
    },
    {
      "id": "2",
      "name": "HTTP Check FSMA Traceability API",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "url": "={{ $vars.FSMA_TRACEABILITY_API_HEALTH_URL }}",
        "method": "GET",
        "timeout": 10000
      },
      "position": [
        500,
        100
      ]
    },
    {
      "id": "3",
      "name": "HTTP Check HACCP Records API",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "url": "={{ $vars.HACCP_RECORDS_API_HEALTH_URL }}",
        "method": "GET",
        "timeout": 10000
      },
      "position": [
        500,
        250
      ]
    },
    {
      "id": "4",
      "name": "HTTP Check Recall Management API",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "url": "={{ $vars.RECALL_MGMT_API_HEALTH_URL }}",
        "method": "GET",
        "timeout": 10000
      },
      "position": [
        500,
        400
      ]
    },
    {
      "id": "5",
      "name": "HTTP Check Payment Gateway",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "url": "={{ $vars.PAYMENT_GATEWAY_HEALTH_URL }}",
        "method": "GET",
        "timeout": 10000
      },
      "position": [
        500,
        550
      ]
    },
    {
      "id": "6",
      "name": "HTTP Check ADA Accessibility API",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "url": "={{ $vars.ADA_ACCESSIBILITY_API_HEALTH_URL }}",
        "method": "GET",
        "timeout": 10000
      },
      "position": [
        500,
        700
      ]
    },
    {
      "id": "7",
      "name": "Code Evaluate Health Results",
      "type": "n8n-nodes-base.code",
      "parameters": {
        "jsCode": "const checks = [\n  { name: 'fsma_traceability_api', result: $('HTTP Check FSMA Traceability API').item.json, risk: 'FDA_FSMA_204_24H_RECORDS_GAP' },\n  { name: 'haccp_records_api', result: $('HTTP Check HACCP Records API').item.json, risk: 'HACCP_CORRECTIVE_ACTION_DELAY' },\n  { name: 'recall_management_api', result: $('HTTP Check Recall Management API').item.json, risk: 'USDA_FSIS_CLASS_I_RECALL_DELAY' },\n  { name: 'payment_gateway', result: $('HTTP Check Payment Gateway').item.json, risk: 'PCI_DSS_V4_PAYMENT_OUTAGE' },\n  { name: 'ada_accessibility_api', result: $('HTTP Check ADA Accessibility API').item.json, risk: 'ADA_TITLE_III_ONLINE_ORDERING_DOWN' }\n];\nconst degraded = checks.filter(c => !c.result || c.result.status !== 200);\nif (degraded.length === 0) return [];\nreturn degraded.map(c => ({ json: { endpoint: c.name, risk: c.risk, status: c.result ? c.result.status : 'TIMEOUT', detectedAt: new Date().toISOString() } }));"
      },
      "position": [
        800,
        400
      ]
    },
    {
      "id": "8",
      "name": "Gmail Alert Food Safety Team",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "to": "={{ $vars.FOOD_SAFETY_TEAM_EMAIL }}",
        "subject": "={{ '[FOOD SAFETY ALERT] ' + $json.endpoint + ' DOWN \u2014 ' + $json.risk }}",
        "message": "={{ 'FoodTech API Health Alert\\n\\nEndpoint: ' + $json.endpoint + '\\nRisk: ' + $json.risk + '\\nStatus: ' + $json.status + '\\nDetected: ' + $json.detectedAt + '\\n\\nImmediate action required. USDA FSIS Class I Recall and FDA FSMA traceability clocks cannot be met if these APIs are degraded. Self-hosted n8n eliminates this third-party dependency.' }}"
      },
      "position": [
        1050,
        400
      ]
    }
  ],
  "connections": {
    "Schedule Every 10 Minutes": {
      "main": [
        [
          {
            "node": "HTTP Check FSMA Traceability API",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Check HACCP Records API",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Check Recall Management API",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Check Payment Gateway",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "HTTP Check ADA Accessibility API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Check FSMA Traceability API": {
      "main": [
        [
          {
            "node": "Code Evaluate Health Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Check HACCP Records API": {
      "main": [
        [
          {
            "node": "Code Evaluate Health Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Check Recall Management API": {
      "main": [
        [
          {
            "node": "Code Evaluate Health Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Check Payment Gateway": {
      "main": [
        [
          {
            "node": "Code Evaluate Health Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Check ADA Accessibility API": {
      "main": [
        [
          {
            "node": "Code Evaluate Health Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code Evaluate Health Results": {
      "main": [
        [
          {
            "node": "Gmail Alert Food Safety Team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Workflow 4: USDA Recall/FDA FSMA/HACCP Incident Pipeline

Webhook-driven incident intake for 8 food safety event types — from USDA Class I recall IMMEDIATE to FDA §1.279 24h to HACCP corrective action to CCPA deletion request.

{
  "name": "USDA Recall/FDA FSMA/HACCP Incident Pipeline",
  "nodes": [
    {
      "id": "1",
      "name": "Webhook Food Safety Event",
      "type": "n8n-nodes-base.webhook",
      "parameters": {
        "path": "food-safety-incident",
        "responseMode": "responseNode"
      },
      "position": [
        250,
        400
      ]
    },
    {
      "id": "2",
      "name": "Code Route by Event Type",
      "type": "n8n-nodes-base.code",
      "parameters": {
        "jsCode": "const event = $json.event_type;\nconst now = new Date();\nlet deadline, action, severity, regulation;\nif (event === 'USDA_FSIS_CLASS_I_RECALL_DECISION') {\n  deadline = new Date(now.getTime() + 30 * 60 * 1000); // IMMEDIATE \u2014 30 min internal SLA\n  action = 'Initiate USDA FSIS Class I recall IMMEDIATELY. Notify FSIS District Office. Issue press release. Coordinate with distributors. Clock started at: ' + now.toISOString();\n  severity = 'RECALL_IMMEDIATE';\n  regulation = 'USDA FSIS 9 CFR \u00a7381.1 / \u00a7317.1 Class I Recall';\n} else if (event === 'FDA_FSMA_1279_OUTBREAK_SUSPECTED') {\n  deadline = new Date(now.getTime() + 24 * 60 * 60 * 1000);\n  action = 'FDA FSMA \u00a71.279: notify FDA within 24 hours of reasonably believing product caused/contributed to outbreak. Clock started at: ' + now.toISOString();\n  severity = 'CRITICAL';\n  regulation = 'FDA FSMA 21 CFR \u00a71.279 24-Hour Notification';\n} else if (event === 'FDA_FSMA_204_TRACEABILITY_REQUEST') {\n  deadline = new Date(now.getTime() + 24 * 60 * 60 * 1000);\n  action = 'FDA FSMA \u00a7204 Traceability Rule: provide Key Data Elements (KDEs) and Critical Tracking Events (CTEs) within 24 hours of FDA request. Clock started at: ' + now.toISOString();\n  severity = 'CRITICAL';\n  regulation = 'FDA FSMA \u00a7204 / 21 CFR Part 1 Subpart S';\n} else if (event === 'HACCP_DEVIATION_DETECTED') {\n  deadline = new Date(now.getTime() + 60 * 60 * 1000);\n  action = 'USDA \u00a7417.3 HACCP Corrective Action IMMEDIATE: identify and correct the cause, determine disposition of affected product, document in HACCP records. Clock started at: ' + now.toISOString();\n  severity = 'CRITICAL';\n  regulation = 'USDA FSIS 9 CFR \u00a7417.3 HACCP Corrective Action';\n} else if (event === 'ADA_ACCESSIBILITY_DEMAND_RECEIVED') {\n  deadline = new Date(now.getTime() + 24 * 60 * 60 * 1000);\n  action = 'ADA Title III: acknowledge demand and begin WCAG 2.1 AA remediation plan. Clock started at: ' + now.toISOString();\n  severity = 'HIGH';\n  regulation = 'ADA Title III / WCAG 2.1 AA';\n} else if (event === 'PCI_DSS_BREACH_DETECTED') {\n  deadline = new Date(now.getTime() + 24 * 60 * 60 * 1000);\n  action = 'PCI DSS v4.0: notify card brands within 24 hours. Notify cardholders within 30 days. Engage QIR. Clock started at: ' + now.toISOString();\n  severity = 'CRITICAL';\n  regulation = 'PCI DSS v4.0 Incident Response';\n} else if (event === 'CCPA_DELETION_REQUEST_RECEIVED') {\n  deadline = new Date(now.getTime() + 45 * 24 * 60 * 60 * 1000);\n  action = 'CCPA \u00a71798.130: respond to consumer deletion request within 45 days. Clock started at: ' + now.toISOString();\n  severity = 'MEDIUM';\n  regulation = 'CCPA \u00a71798.130';\n} else if (event === 'TTB_FORMULA_REJECTION_RECEIVED') {\n  deadline = new Date(now.getTime() + 7 * 24 * 60 * 60 * 1000);\n  action = 'TTB formula rejection: review rejection reason and prepare corrected formula submission. TTB resubmission typically 30-90 day review cycle. Clock started at: ' + now.toISOString();\n  severity = 'HIGH';\n  regulation = 'TTB 27 CFR Part 25/4/5 Formula Approval';\n} else {\n  deadline = new Date(now.getTime() + 24 * 60 * 60 * 1000);\n  action = 'Unknown food safety event \u2014 route to compliance team immediately.';\n  severity = 'HIGH';\n  regulation = 'Unknown';\n}\nreturn [{ json: { ...$json, deadline: deadline.toISOString(), action, severity, regulation, receivedAt: now.toISOString() } }];"
      },
      "position": [
        500,
        400
      ]
    },
    {
      "id": "3",
      "name": "Postgres Log Incident",
      "type": "n8n-nodes-base.postgres",
      "parameters": {
        "operation": "insert",
        "table": "food_safety_incidents",
        "additionalFields": {
          "columns": "account_id,event_type,regulation,severity,action,received_at,deadline,raw_payload",
          "values": "={{ [$json.account_id, $json.event_type, $json.regulation, $json.severity, $json.action, $json.receivedAt, $json.deadline, JSON.stringify($json)] }}"
        }
      },
      "position": [
        750,
        400
      ]
    },
    {
      "id": "4",
      "name": "Gmail Food Safety Lead + Legal",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "to": "={{ $vars.FOOD_SAFETY_LEAD_EMAIL }}",
        "bcc": "={{ $vars.LEGAL_COUNSEL_EMAIL }}",
        "subject": "={{ '[' + $json.severity + '] FOOD SAFETY INCIDENT: ' + $json.event_type + ' \u2014 ' + $json.regulation }}",
        "message": "={{ 'FOOD SAFETY INCIDENT NOTIFICATION\\n\\nAccount: ' + $json.account_name + '\\nEvent Type: ' + $json.event_type + '\\nRegulation: ' + $json.regulation + '\\nSeverity: ' + $json.severity + '\\n\\nRequired Action: ' + $json.action + '\\n\\nDeadline: ' + $json.deadline + '\\nReceived At: ' + $json.receivedAt + '\\n\\nThis notification was generated automatically by your FlowKit compliance workflow. The clock started at the timestamp above \u2014 not when your team opens this email.' }}"
      },
      "position": [
        1000,
        400
      ]
    },
    {
      "id": "5",
      "name": "Respond Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ received: true, event_type: $json.event_type, deadline: $json.deadline, severity: $json.severity, receivedAt: $json.receivedAt }) }}"
      },
      "position": [
        1250,
        400
      ]
    }
  ],
  "connections": {
    "Webhook Food Safety Event": {
      "main": [
        [
          {
            "node": "Code Route by Event Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code Route by Event Type": {
      "main": [
        [
          {
            "node": "Postgres Log Incident",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Postgres Log Incident": {
      "main": [
        [
          {
            "node": "Gmail Food Safety Lead + Legal",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Food Safety Lead + Legal": {
      "main": [
        [
          {
            "node": "Respond Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Workflow 5: Weekly FoodTech/RestaurantTech KPI Dashboard

Monday 8AM ET executive report — account counts by tier, MRR, open compliance incidents by type and severity.

{
  "name": "Weekly FoodTech/RestaurantTech KPI Dashboard",
  "nodes": [
    {
      "id": "1",
      "name": "Schedule Monday 8AM ET",
      "type": "n8n-nodes-base.scheduleTrigger",
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 13 * * 1"
            }
          ]
        }
      },
      "position": [
        250,
        300
      ]
    },
    {
      "id": "2",
      "name": "Postgres Query Account KPIs",
      "type": "n8n-nodes-base.postgres",
      "parameters": {
        "operation": "executeQuery",
        "query": "SELECT tier, COUNT(*) as account_count, SUM(mrr_usd) as total_mrr, COUNT(CASE WHEN fsma_flag THEN 1 END) as fsma_accounts, COUNT(CASE WHEN fsis_recall_flag THEN 1 END) as fsis_recall_accounts, COUNT(CASE WHEN ttb_permit_flag THEN 1 END) as ttb_accounts, COUNT(CASE WHEN pci_dss_flag THEN 1 END) as pci_accounts FROM foodtech_accounts WHERE status = 'active' GROUP BY tier ORDER BY total_mrr DESC"
      },
      "position": [
        500,
        300
      ]
    },
    {
      "id": "3",
      "name": "Postgres Query Open Incidents",
      "type": "n8n-nodes-base.postgres",
      "parameters": {
        "operation": "executeQuery",
        "query": "SELECT event_type, severity, COUNT(*) as count FROM food_safety_incidents WHERE resolved = false AND created_at > NOW() - INTERVAL '7 days' GROUP BY event_type, severity ORDER BY severity, count DESC"
      },
      "position": [
        500,
        500
      ]
    },
    {
      "id": "4",
      "name": "Code Build KPI Report",
      "type": "n8n-nodes-base.code",
      "parameters": {
        "jsCode": "const kpis = $('Postgres Query Account KPIs').all().map(i => i.json);\nconst incidents = $('Postgres Query Open Incidents').all().map(i => i.json);\nconst totalMrr = kpis.reduce((s, k) => s + parseFloat(k.total_mrr || 0), 0);\nconst totalAccounts = kpis.reduce((s, k) => s + parseInt(k.account_count || 0), 0);\nconst recallAccounts = kpis.reduce((s, k) => s + parseInt(k.fsis_recall_accounts || 0), 0);\nconst fsmaAccounts = kpis.reduce((s, k) => s + parseInt(k.fsma_accounts || 0), 0);\nconst criticalIncidents = incidents.filter(i => i.severity === 'RECALL_IMMEDIATE' || i.severity === 'CRITICAL').reduce((s, i) => s + parseInt(i.count || 0), 0);\nconst lines = [\n  'FOODTECH/RESTAURANTTECH WEEKLY KPI DASHBOARD',\n  'Week ending: ' + new Date().toISOString().split('T')[0],\n  '',\n  'PORTFOLIO SUMMARY',\n  'Total Accounts: ' + totalAccounts,\n  'Total MRR: $' + totalMrr.toFixed(2),\n  'FSMA Preventive Controls Accounts: ' + fsmaAccounts,\n  'USDA FSIS Recall-Obligated Accounts: ' + recallAccounts,\n  '',\n  'OPEN COMPLIANCE INCIDENTS (last 7 days)',\n  'Critical/Recall Immediate: ' + criticalIncidents,\n  ...incidents.map(i => '  ' + i.event_type + ' [' + i.severity + ']: ' + i.count),\n  '',\n  'TIER BREAKDOWN',\n  ...kpis.map(k => '  ' + k.tier + ': ' + k.account_count + ' accounts, $' + parseFloat(k.total_mrr || 0).toFixed(2) + ' MRR')\n];\nreturn [{ json: { report: lines.join('\\n'), totalMrr, totalAccounts, criticalIncidents, generatedAt: new Date().toISOString() } }];"
      },
      "position": [
        750,
        400
      ]
    },
    {
      "id": "5",
      "name": "Gmail Weekly Report CEO",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "to": "={{ $vars.CEO_EMAIL }}",
        "subject": "={{ 'FoodTech Weekly KPI \u2014 ' + $json.totalAccounts + ' accounts, $' + parseFloat($json.totalMrr).toFixed(2) + ' MRR, ' + $json.criticalIncidents + ' critical incidents' }}",
        "message": "={{ $json.report }}"
      },
      "position": [
        1000,
        400
      ]
    }
  ],
  "connections": {
    "Schedule Monday 8AM ET": {
      "main": [
        [
          {
            "node": "Postgres Query Account KPIs",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Postgres Query Open Incidents",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Postgres Query Account KPIs": {
      "main": [
        [
          {
            "node": "Code Build KPI Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Postgres Query Open Incidents": {
      "main": [
        [
          {
            "node": "Code Build KPI Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code Build KPI Report": {
      "main": [
        [
          {
            "node": "Gmail Weekly Report CEO",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Where to Get These Workflows

All 5 workflows are available individually or as a bundle at stripeai.gumroad.com.

The FoodTech/RestaurantTech pack includes pre-configured tiers, all 7 compliance flags, and the incident pipeline with Postgres logging.


FlowKit — ready-to-use n8n automation templates for SaaS vendors. New compliance packs published weekly.

Top comments (0)