Dev.to Security 🔐 Cybersecurity 👁 1 📖 18 min read

n8n for RegTech & Compliance SaaS Vendors: 5 Automations for FinCEN BSA, OFAC, AML, SAR, and CTR Compliance

If you're building SaaS for compliance officers, BSA teams, AML analysts, KYC vendors, or financial crime platforms — your customers live inside a regulatory stack that operates on two clocks you cannot afford to miss: O

If you're building SaaS for compliance officers, BSA teams, AML analysts, KYC vendors, or financial crime platforms — your customers live inside a regulatory stack that operates on two clocks you cannot afford to miss: OFAC says freeze immediately, and FinCEN says file within 30 days.

OFAC SDN match: immediate account freeze required (31 CFR §501.603), then 10 business days to report to OFAC. If your OFAC screening result routes through a cloud iPaaS queue before triggering the freeze, that latency window is a compliance failure. DON'T TIP OFF: 31 CFR §597.701 prohibits notifying the account holder of the freeze — your alerting path must be internal-only. CTR: next business day after any $10,000+ cash transaction (31 CFR §1010.311) — up to $100,000/day for non-filing. FinCEN SAR: 30 calendar days from the date of initial detection of facts that may constitute suspicious activity (31 USC §5318(g)) — not from when a human reviews it, from detection.

These aren't edge cases. They are the daily operational cadence for every bank, credit union, money transmitter, and crypto exchange running a BSA/AML program. The workflows you build into your platform should reflect the exact regulatory clocks your customers are managing.

Here are 5 n8n automation workflows for RegTech and compliance SaaS vendors, covering FinCEN BSA, OFAC SDN screening, AML transaction monitoring, SAR/CTR filing, and the FinCEN 314(a) information sharing program.

Why BSA/AML data belongs inside your network

Compliance SaaS handles some of the most legally sensitive data in financial services:

OFAC SDN screening results (31 CFR §501) contain blocked transaction records that must be reported to OFAC — routing them through a third-party cloud SaaS creates a subprocessor disclosure issue with the Office of Foreign Assets Control. FinCEN SAR data (31 USC §5318(g)) is protected by a safe harbor that prohibits disclosure — SAR content routing through a cloud iPaaS may break that confidentiality boundary. FinCEN 314(a) requests (31 CFR §1010.520) are law enforcement information sharing — routing the subject names through a cloud vendor is not contemplated in the FinCEN 314(a) program. CTR data (31 CFR §1010.311) and CDD beneficial owner records (31 CFR §1010.230) are bank examination targets — a cloud subprocessor in the data path expands your TPSP audit scope. BSA AML program documentation (31 CFR §1020.210) must be available to examiners — on-prem storage eliminates retrieval latency from the exam response window.

Self-hosted n8n keeps your automation layer inside the same network perimeter as your BSA system of record — not a separate cloud vendor with its own TPSP assessment scope.

Workflow 1: RegTech Customer Onboarding Drip

Tier-segmented onboarding sequence for new compliance SaaS customers. Injects regulatory-specific content based on each customer's compliance profile: ENTERPRISE_BANK_COMPLIANCE_PLATFORM, MIDMARKET_CREDIT_UNION_SAAS, AML_TRANSACTION_MONITORING_SAAS, KYC_IDENTITY_VERIFICATION_SAAS, REGULATORY_REPORTING_SAAS, SANCTIONS_SCREENING_SAAS, CRYPTO_COMPLIANCE_SAAS.

Seven compliance flags: FINCEN_BSA_COVERED, SAR_REQUIRED, CTR_REQUIRED, OFAC_SDN_SCREENING, CDD_REQUIRED, AML_PROGRAM_REQUIRED, FATF_COVERED.

Day 0 email injects the applicable penalty clock (OFAC immediate freeze, SAR 30-day detection window, CTR next-business-day) so the customer's BSA officer knows your platform understands their regulatory obligations from the first touchpoint.

{
  "name": "RegTech Compliance SaaS Customer Onboarding",
  "nodes": [
    {
      "id": "trigger-1",
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "parameters": {
        "path": "regtech-onboard",
        "httpMethod": "POST"
      }
    },
    {
      "id": "tier-router-1",
      "name": "Tier Router",
      "type": "n8n-nodes-base.switch",
      "parameters": {
        "dataType": "string",
        "value1": "={{$json.customer_tier}}",
        "rules": {
          "rules": [
            {
              "value2": "ENTERPRISE_BANK_COMPLIANCE_PLATFORM"
            },
            {
              "value2": "MIDMARKET_CREDIT_UNION_SAAS"
            },
            {
              "value2": "AML_TRANSACTION_MONITORING_SAAS"
            },
            {
              "value2": "KYC_IDENTITY_VERIFICATION_SAAS"
            },
            {
              "value2": "REGULATORY_REPORTING_SAAS"
            },
            {
              "value2": "SANCTIONS_SCREENING_SAAS"
            },
            {
              "value2": "CRYPTO_COMPLIANCE_SAAS"
            }
          ]
        }
      }
    },
    {
      "id": "flag-check-1",
      "name": "Flag Check",
      "type": "n8n-nodes-base.code",
      "parameters": {
        "jsCode": "\nconst flags = $input.first().json.compliance_flags || [];\nconst tier = $input.first().json.customer_tier || 'UNKNOWN';\nconst penaltyMap = {\n  FINCEN_BSA_COVERED: 'FinCEN BSA 31 USC \u00a75318 \u2014 willful violations up to $250,000/day',\n  SAR_REQUIRED: 'SAR filing 30 calendar days from detection (31 USC \u00a75318(g)) \u2014 civil penalty up to $57,317/day',\n  CTR_REQUIRED: 'CTR next business day after $10k+ cash (31 CFR \u00a71010.311) \u2014 $10,000\u2013$100,000/day failure to file',\n  OFAC_SDN_SCREENING: 'OFAC SDN match \u2014 immediate account freeze + 10 business days to OFAC (31 CFR \u00a7501.603)',\n  CDD_REQUIRED: 'CDD Rule 31 CFR \u00a71010.230 \u2014 beneficial owner verification at account opening',\n  AML_PROGRAM_REQUIRED: 'BSA AML Program 31 CFR \u00a71020.210 \u2014 annual review, policies, BSA officer, training, independent audit',\n  FATF_COVERED: 'FATF GAFI Recommendations \u2014 40 Recommendations + risk-based AML/CFT program'\n};\nconst clocks = flags.map(f => penaltyMap[f] || f).join('\\n');\nreturn [{json: {tier, flags, clocks, ts: new Date().toISOString()}}];\n"
      }
    },
    {
      "id": "day0-email-1",
      "name": "Day 0 Email",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "operation": "send",
        "toList": "={{$json.customer_email}}",
        "subject": "Your FinCEN/OFAC compliance clocks start now \u2014 day 0 orientation",
        "message": "={{$json.clocks}}"
      }
    },
    {
      "id": "wait-3-1",
      "name": "Wait 3 Days",
      "type": "n8n-nodes-base.wait",
      "parameters": {
        "amount": 3,
        "unit": "days"
      }
    },
    {
      "id": "day3-email-1",
      "name": "Day 3 Email \u2014 SAR Workflow Intro",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "operation": "send",
        "toList": "={{$json.customer_email}}",
        "subject": "SAR clock: 30 days from detection \u2014 automate it",
        "message": "Day 3: The SAR filing clock starts from the date of initial detection of suspicious activity \u2014 not from when your compliance team reviews it. Here is how our workflow captures the detection timestamp automatically."
      }
    },
    {
      "id": "wait-7-1",
      "name": "Wait 7 Days",
      "type": "n8n-nodes-base.wait",
      "parameters": {
        "amount": 4,
        "unit": "days"
      }
    },
    {
      "id": "day7-email-1",
      "name": "Day 7 Email \u2014 OFAC Screening",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "operation": "send",
        "toList": "={{$json.customer_email}}",
        "subject": "OFAC SDN: the immediate freeze clock",
        "message": "Day 7: OFAC matches require immediate account action \u2014 the freeze must happen before the transaction clears. Cloud iPaaS queue latency can push you past that window. This is why OFAC screening runs inside your network."
      }
    }
  ],
  "connections": {
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Tier Router",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tier Router": {
      "main": [
        [
          {
            "node": "Flag Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Flag Check": {
      "main": [
        [
          {
            "node": "Day 0 Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Day 0 Email": {
      "main": [
        [
          {
            "node": "Wait 3 Days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 3 Days": {
      "main": [
        [
          {
            "node": "Day 3 Email \u2014 SAR Workflow Intro",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Day 3 Email \u2014 SAR Workflow Intro": {
      "main": [
        [
          {
            "node": "Wait 7 Days",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 7 Days": {
      "main": [
        [
          {
            "node": "Day 7 Email \u2014 OFAC Screening",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Workflow 2: RegTech API Health Monitor

Polls 5 critical compliance API endpoints every 5 minutes. Uses $getWorkflowStaticData to track UP/DOWN state transitions — only fires a Slack alert when an endpoint transitions from UP to DOWN, suppressing noise on sustained outages.

Five endpoints with regulatory context: fincen_bsa_api (31 USC §5318 — $250k/day willful violation if filing fails silently), ofac_sdn_api (OFAC SDN — immediate freeze required; downtime means unchecked sanctioned transactions), kyc_cdd_api (31 CFR §1010.230 — CDD rule beneficial owner verification; account opening gated on this endpoint), sar_ctr_api (FinCEN SAR 30-day/CTR next business day — missed filing up to $100k/day), aml_monitoring_api (31 CFR §1020.210 — transaction monitoring; silent failure = undetected suspicious activity).

{
  "name": "RegTech Compliance API Health Monitor",
  "nodes": [
    {
      "id": "cron-2",
      "name": "Every 5 Minutes",
      "type": "n8n-nodes-base.scheduleTrigger",
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "*/5 * * * *"
            }
          ]
        }
      }
    },
    {
      "id": "endpoints-2",
      "name": "Define Endpoints",
      "type": "n8n-nodes-base.code",
      "parameters": {
        "jsCode": "\nreturn [\n  {json: {name: 'fincen_bsa_api', url: 'https://your-fincen-bsa-endpoint/health', reg: '31 USC \u00a75318 \u2014 $250k/day willful violation if filing fails silently'}},\n  {json: {name: 'ofac_sdn_api', url: 'https://your-ofac-screening-endpoint/health', reg: 'OFAC SDN \u2014 immediate freeze required; downtime = unchecked sanctioned transactions'}},\n  {json: {name: 'kyc_cdd_api', url: 'https://your-kyc-cdd-endpoint/health', reg: '31 CFR \u00a71010.230 \u2014 CDD rule beneficial owner verification; account opening gated on this endpoint'}},\n  {json: {name: 'sar_ctr_api', url: 'https://your-sar-ctr-endpoint/health', reg: 'FinCEN SAR 30-day/CTR next business day \u2014 missed filing = $10k\u2013$100k/day'}},\n  {json: {name: 'aml_monitoring_api', url: 'https://your-aml-monitoring-endpoint/health', reg: '31 CFR \u00a71020.210 \u2014 AML program transaction monitoring; silent failure = undetected suspicious activity'}}\n];\n"
      }
    },
    {
      "id": "http-check-2",
      "name": "HTTP Health Check",
      "type": "n8n-nodes-base.httpRequest",
      "parameters": {
        "url": "={{$json.url}}",
        "method": "GET",
        "timeout": 5000,
        "continueOnFail": true
      }
    },
    {
      "id": "state-2",
      "name": "State Tracker",
      "type": "n8n-nodes-base.code",
      "parameters": {
        "jsCode": "\nconst store = $getWorkflowStaticData('global');\nif (!store.endpointState) store.endpointState = {};\nconst name = $('Define Endpoints').first().json.name;\nconst reg = $('Define Endpoints').first().json.reg;\nconst wasUp = store.endpointState[name] !== 'DOWN';\nconst isUp = $input.first().json.statusCode === 200;\nstore.endpointState[name] = isUp ? 'UP' : 'DOWN';\nconst justWentDown = !isUp && wasUp;\nreturn [{json: {name, reg, status: isUp ? 'UP' : 'DOWN', justWentDown, ts: new Date().toISOString()}}];\n"
      }
    },
    {
      "id": "filter-2",
      "name": "Filter New Outages",
      "type": "n8n-nodes-base.filter",
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{$json.justWentDown}}",
              "value2": true
            }
          ]
        }
      }
    },
    {
      "id": "slack-2",
      "name": "Slack Alert",
      "type": "n8n-nodes-base.slack",
      "parameters": {
        "channel": "#compliance-alerts",
        "text": "={{$json.name}} DOWN \u2014 {{$json.reg}}"
      }
    }
  ],
  "connections": {
    "Every 5 Minutes": {
      "main": [
        [
          {
            "node": "Define Endpoints",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Define Endpoints": {
      "main": [
        [
          {
            "node": "HTTP Health Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Health Check": {
      "main": [
        [
          {
            "node": "State Tracker",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "State Tracker": {
      "main": [
        [
          {
            "node": "Filter New Outages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter New Outages": {
      "main": [
        [
          {
            "node": "Slack Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Workflow 3: FinCEN / OFAC / OCC Compliance Deadline Tracker

Runs weekday mornings against a Google Sheets deadline register. Routes by severity — OVERDUE, CRITICAL (≤14d), URGENT (≤30d), WARNING (≤60d), NOTICE (≤90d). Sends Slack alerts to #compliance-critical and email to deadline owners. Deduplication prevents repeat alerts on the same open item.

Twelve deadline types: FinCEN SAR Annual Program Review, CTR Exemption List Annual Review (31 CFR §1020.315), OFAC SDN Screening Procedure Annual Review, BSA AML Program Annual Audit (31 CFR §1020.210), CDD Rule Beneficial Owner Annual Review (31 CFR §1010.230), FinCEN 314(b) Voluntary Sharing Annual Registration, FFIEC Cybersecurity Assessment Annual, OCC BSA/AML Exam Preparation Annual, FinCEN Currency Transaction Report Annual Reconcile, SOC 2 Type 2 Renewal, ISO 27001 Surveillance Audit, State Money Transmitter License Annual Renewal.

{
  "name": "FinCEN / OFAC / OCC Compliance Deadline Tracker",
  "nodes": [
    {
      "id": "cron-3",
      "name": "Weekday 8 AM",
      "type": "n8n-nodes-base.scheduleTrigger",
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 8 * * 1-5"
            }
          ]
        }
      }
    },
    {
      "id": "sheets-3",
      "name": "Read Deadline Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "parameters": {
        "operation": "getAll",
        "documentId": "your-sheet-id",
        "sheetName": "ComplianceDeadlines"
      }
    },
    {
      "id": "classify-3",
      "name": "Classify Severity",
      "type": "n8n-nodes-base.code",
      "parameters": {
        "jsCode": "\nconst store = $getWorkflowStaticData('global');\nif (!store.alerted) store.alerted = {};\nconst today = new Date();\nconst results = [];\nfor (const item of $input.all()) {\n  const d = item.json;\n  const due = new Date(d.due_date);\n  const daysLeft = Math.floor((due - today) / 86400000);\n  let severity = null;\n  if (daysLeft < 0) severity = 'OVERDUE';\n  else if (daysLeft <= 14) severity = 'CRITICAL';\n  else if (daysLeft <= 30) severity = 'URGENT';\n  else if (daysLeft <= 60) severity = 'WARNING';\n  else if (daysLeft <= 90) severity = 'NOTICE';\n  if (!severity) continue;\n  const key = d.deadline_id + '_' + d.due_date;\n  if (store.alerted[key]) continue;\n  store.alerted[key] = true;\n  results.push({json: {...d, severity, daysLeft}});\n}\nreturn results;\n"
      }
    },
    {
      "id": "slack-3",
      "name": "Slack #compliance-critical",
      "type": "n8n-nodes-base.slack",
      "parameters": {
        "channel": "#compliance-critical",
        "text": "={{$json.severity}}: {{$json.deadline_type}} \u2014 {{$json.daysLeft}} days ({{$json.due_date}})"
      }
    },
    {
      "id": "email-3",
      "name": "Email Deadline Owner",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "operation": "send",
        "toList": "={{$json.owner_email}}",
        "subject": "={{$json.severity}}: {{$json.deadline_type}} due {{$json.due_date}}",
        "message": "={{$json.deadline_type}} is {{$json.daysLeft}} days away. Regulatory reference: {{$json.reg_ref}}"
      }
    }
  ],
  "connections": {
    "Weekday 8 AM": {
      "main": [
        [
          {
            "node": "Read Deadline Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Deadline Sheet": {
      "main": [
        [
          {
            "node": "Classify Severity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Classify Severity": {
      "main": [
        [
          {
            "node": "Slack #compliance-critical",
            "type": "main",
            "index": 0
          },
          {
            "node": "Email Deadline Owner",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Workflow 4: RegTech Incident & OFAC Alert Pipeline

Webhook-triggered incident router. Classifies by incident type, maps the regulatory clock and escalation path, fires Slack and Gmail simultaneously, logs to Google Sheets audit trail, responds 200 OK.

Eight incident types with exact clocks:

OFAC_SANCTIONS_MATCH — Immediate. Freeze account under 31 CFR §501.603. Do NOT tip off account holder (31 CFR §597.701 — tipping off prohibition). Report to OFAC within 10 business days. Cloud iPaaS queue latency between OFAC match and account freeze is a compliance failure window — this is the sharpest real-time argument for self-hosted n8n in the entire financial compliance stack.

FINCEN_SAR_FILING_REQUIRED — 30 calendar days from detection (31 USC §5318(g)). The clock starts at detection, not at human review. Extend to 60 days if no suspect identified. Civil penalty up to $57,317/day. Criminal: up to $250,000 + 5 years.

CTR_FILING_DUE — Next business day (31 CFR §1010.311). $10k–$100k/day failure to file. Structuring to avoid CTR = separate federal offense under 31 USC §5324. Alert fires at transaction detection, not end of day.

AML_HIGH_RISK_ALERT — 24 hours. Transaction monitoring alert escalation. SAR evaluation window begins at detection timestamp. BSA officer review within 24h or the SAR 30-day clock is already running.

KYC_EDD_REQUIRED — 48 hours. Enhanced Due Diligence under 31 CFR §1010.610. Beneficial owner verification (31 CFR §1010.230). Account activity may be restricted pending EDD completion.

FINCEN_314A_REQUEST — 10 business days (31 CFR §1010.520(b)(2)). Search records for named subject. Respond via FinCEN SISS portal. Non-response = FinCEN escalation.

FATF_HIGH_RISK_JURISDICTION — 48 hours. Customer or counterparty linked to FATF grey/black-list jurisdiction. Update CDD risk matrix. Re-screen existing book of business.

REGULATORY_SYSTEM_DOWNTIME — 4 hours. FinCEN BSA E-Filing, OFAC screening, or AML monitoring offline. Manual fallback procedures activate. Retroactive SAR review required for any transaction that could not be screened during the outage window.

{
  "name": "RegTech Incident & OFAC Alert Pipeline",
  "nodes": [
    {
      "id": "webhook-4",
      "name": "Incident Webhook",
      "type": "n8n-nodes-base.webhook",
      "parameters": {
        "path": "regtech-incident",
        "httpMethod": "POST"
      }
    },
    {
      "id": "router-4",
      "name": "Incident Router",
      "type": "n8n-nodes-base.code",
      "parameters": {
        "jsCode": "\nconst INCIDENTS = {\n  \"OFAC_SANCTIONS_MATCH\": {\n    \"clock\": \"Immediate\",\n    \"action\": \"Freeze account NOW (31 CFR \\u00a7501.603). Report to OFAC within 10 business days. Do not tip off account holder (31 CFR \\u00a7597.701). Cloud iPaaS queue latency between OFAC hit and account freeze = compliance failure window.\",\n    \"escalation\": \"BSA Officer + Chief Compliance Officer + OFAC Reporting Desk\"\n  },\n  \"FINCEN_SAR_FILING_REQUIRED\": {\n    \"clock\": \"30 calendar days from detection (31 USC \\u00a75318(g))\",\n    \"action\": \"If suspect identified: 30-day SAR deadline. If no suspect: 60-day extension allowed. Civil penalty up to $57,317/day for non-filing. Criminal: up to $250,000 + 5 years imprisonment.\",\n    \"escalation\": \"BSA Officer + Legal Counsel + FinCEN BSA E-Filing\"\n  },\n  \"CTR_FILING_DUE\": {\n    \"clock\": \"Next business day after $10,000+ cash transaction (31 CFR \\u00a71010.311)\",\n    \"action\": \"File FinCEN Form 112. $10k\\u2013$100k/day civil penalty. Criminal: up to $250,000. Structuring to avoid CTR = separate 5-year federal offense. Alert fires at transaction detection, not end of day.\",\n    \"escalation\": \"BSA Officer + FinCEN BSA E-Filing system\"\n  },\n  \"AML_HIGH_RISK_ALERT\": {\n    \"clock\": \"24 hours\",\n    \"action\": \"Transaction monitoring alert escalation. BSA Officer review within 24h. Enhanced Due Diligence (EDD) activation if confirmed high-risk. SAR evaluation window starts at detection timestamp.\",\n    \"escalation\": \"BSA Officer + Transaction Monitoring Team\"\n  },\n  \"KYC_EDD_REQUIRED\": {\n    \"clock\": \"48 hours\",\n    \"action\": \"High-risk customer identified \\u2014 Enhanced Due Diligence required (31 CFR \\u00a71010.610). Beneficial owner verification (31 CFR \\u00a71010.230). Risk score update in CDD system. Account activity may be restricted pending EDD.\",\n    \"escalation\": \"KYC Team + BSA Officer\"\n  },\n  \"FINCEN_314A_REQUEST\": {\n    \"clock\": \"10 business days (31 CFR \\u00a71010.520(b)(2))\",\n    \"action\": \"FinCEN 314(a) information request received. Search customer records for named subject. Respond via FinCEN Secure Information Sharing System (SISS). Non-response = FinCEN escalation.\",\n    \"escalation\": \"BSA Officer + FinCEN SISS Portal\"\n  },\n  \"FATF_HIGH_RISK_JURISDICTION\": {\n    \"clock\": \"48 hours\",\n    \"action\": \"Customer or counterparty linked to FATF grey/black-list jurisdiction. Update CDD risk matrix. Enhanced monitoring or relationship termination depending on FATF status. Re-screen existing book of business.\",\n    \"escalation\": \"Chief Compliance Officer + BSA Officer + Relationship Manager\"\n  },\n  \"REGULATORY_SYSTEM_DOWNTIME\": {\n    \"clock\": \"4 hours\",\n    \"action\": \"FinCEN BSA E-Filing, OFAC screening, or AML monitoring system offline. Manual fallback procedures activate. Document all transactions that could not be screened during downtime \\u2014 retroactive SAR review required if AML monitoring was down during suspicious activity window.\",\n    \"escalation\": \"BSA Officer + Compliance Director + IT Security\"\n  }\n};\nconst type = $input.first().json.incident_type;\nconst meta = INCIDENTS[type] || {clock: 'Unknown', action: 'Manual review required', escalation: 'BSA Officer'};\nreturn [{json: {...($input.first().json), ...meta, ts: new Date().toISOString()}}];\n"
      }
    },
    {
      "id": "slack-4",
      "name": "Slack Alert",
      "type": "n8n-nodes-base.slack",
      "parameters": {
        "channel": "#compliance-critical",
        "text": "={{$json.incident_type}} \u2014 Clock: {{$json.clock}} \u2014 {{$json.action}}"
      }
    },
    {
      "id": "email-4",
      "name": "Email Escalation",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "operation": "send",
        "toList": "={{$json.escalation_email}}",
        "subject": "INCIDENT: {{$json.incident_type}} \u2014 {{$json.clock}}",
        "message": "={{$json.action}} | Escalation: {{$json.escalation}} | Timestamp: {{$json.ts}}"
      }
    },
    {
      "id": "sheets-4",
      "name": "Log to Audit Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "parameters": {
        "operation": "append",
        "documentId": "your-sheet-id",
        "sheetName": "IncidentLog",
        "fieldsUi": {
          "values": [
            {
              "fieldId": "A",
              "fieldValue": "={{$json.ts}}"
            },
            {
              "fieldId": "B",
              "fieldValue": "={{$json.incident_type}}"
            },
            {
              "fieldId": "C",
              "fieldValue": "={{$json.clock}}"
            },
            {
              "fieldId": "D",
              "fieldValue": "={{$json.escalation}}"
            }
          ]
        }
      }
    },
    {
      "id": "respond-4",
      "name": "Respond 200",
      "type": "n8n-nodes-base.respondToWebhook",
      "parameters": {
        "responseCode": 200,
        "responseBody": "{\"status\":\"routed\"}"
      }
    }
  ],
  "connections": {
    "Incident Webhook": {
      "main": [
        [
          {
            "node": "Incident Router",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Incident Router": {
      "main": [
        [
          {
            "node": "Slack Alert",
            "type": "main",
            "index": 0
          },
          {
            "node": "Email Escalation",
            "type": "main",
            "index": 0
          },
          {
            "node": "Log to Audit Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log to Audit Sheet": {
      "main": [
        [
          {
            "node": "Respond 200",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Workflow 5: Weekly RegTech Platform KPI Dashboard

Monday 8 AM dual Postgres query (account events plus compliance events), Merge node, Code node builds an HTML table with week-over-week delta via $getWorkflowStaticData, emails CEO and CCO (BCC CISO), posts one-liner to Slack #weekly-kpi.

KPIs tracked: active accounts, new accounts (7d), OFAC screens (7d), OFAC hits (7d), SARs filed (7d), SARs open, CTRs filed (7d), AML alerts (7d), FinCEN 314(a) requests (30d). The SAR and OFAC hit rows are the compliance debt signal that regulators and examiners look at first.

{
  "name": "Weekly RegTech Platform KPI Dashboard",
  "nodes": [
    {
      "id": "cron-5",
      "name": "Monday 8 AM",
      "type": "n8n-nodes-base.scheduleTrigger",
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 8 * * 1"
            }
          ]
        }
      }
    },
    {
      "id": "pg-accounts-5",
      "name": "Postgres \u2014 Account Events",
      "type": "n8n-nodes-base.postgres",
      "parameters": {
        "operation": "executeQuery",
        "query": "SELECT COUNT(DISTINCT customer_id) as active_accounts, COUNT(CASE WHEN event_type='ACCOUNT_OPENED' AND created_at > NOW()-INTERVAL '7 days' THEN 1 END) as new_accounts_7d, COUNT(CASE WHEN event_type='OFAC_SCREEN' AND created_at > NOW()-INTERVAL '7 days' THEN 1 END) as ofac_screens_7d, COUNT(CASE WHEN event_type='OFAC_HIT' AND created_at > NOW()-INTERVAL '7 days' THEN 1 END) as ofac_hits_7d FROM account_events WHERE created_at > NOW()-INTERVAL '30 days'"
      }
    },
    {
      "id": "pg-compliance-5",
      "name": "Postgres \u2014 Compliance Events",
      "type": "n8n-nodes-base.postgres",
      "parameters": {
        "operation": "executeQuery",
        "query": "SELECT COUNT(CASE WHEN event_type='SAR_FILED' AND created_at > NOW()-INTERVAL '7 days' THEN 1 END) as sars_filed_7d, COUNT(CASE WHEN event_type='SAR_PENDING' THEN 1 END) as sars_open, COUNT(CASE WHEN event_type='CTR_FILED' AND created_at > NOW()-INTERVAL '7 days' THEN 1 END) as ctrs_filed_7d, COUNT(CASE WHEN event_type='AML_ALERT' AND created_at > NOW()-INTERVAL '7 days' THEN 1 END) as aml_alerts_7d, COUNT(CASE WHEN event_type='314A_REQUEST' AND created_at > NOW()-INTERVAL '30 days' THEN 1 END) as fincen_314a_30d FROM compliance_events"
      }
    },
    {
      "id": "merge-5",
      "name": "Merge KPIs",
      "type": "n8n-nodes-base.merge",
      "parameters": {
        "mode": "combine",
        "combinationMode": "mergeByPosition"
      }
    },
    {
      "id": "report-5",
      "name": "Build HTML Report",
      "type": "n8n-nodes-base.code",
      "parameters": {
        "jsCode": "\nconst store = $getWorkflowStaticData('global');\nconst prev = store.lastWeekKPIs || {};\nconst cur = {...$('Postgres \u2014 Account Events').first().json, ...$('Postgres \u2014 Compliance Events').first().json};\nconst delta = (k) => {\n  const d = (cur[k] || 0) - (prev[k] || 0);\n  return d > 0 ? `+${d}` : `${d}`;\n};\nconst html = `<table border='1' cellpadding='6' style='border-collapse:collapse;font-family:monospace'>\n<tr><th>KPI</th><th>This Week</th><th>WoW</th></tr>\n<tr><td>Active Accounts</td><td>${cur.active_accounts}</td><td>${delta('active_accounts')}</td></tr>\n<tr><td>New Accounts (7d)</td><td>${cur.new_accounts_7d}</td><td>${delta('new_accounts_7d')}</td></tr>\n<tr><td>OFAC Screens (7d)</td><td>${cur.ofac_screens_7d}</td><td>${delta('ofac_screens_7d')}</td></tr>\n<tr><td>OFAC Hits (7d)</td><td>${cur.ofac_hits_7d}</td><td>${delta('ofac_hits_7d')}</td></tr>\n<tr><td>SARs Filed (7d)</td><td>${cur.sars_filed_7d}</td><td>${delta('sars_filed_7d')}</td></tr>\n<tr><td>SARs Open</td><td>${cur.sars_open}</td><td>${delta('sars_open')}</td></tr>\n<tr><td>CTRs Filed (7d)</td><td>${cur.ctrs_filed_7d}</td><td>${delta('ctrs_filed_7d')}</td></tr>\n<tr><td>AML Alerts (7d)</td><td>${cur.aml_alerts_7d}</td><td>${delta('aml_alerts_7d')}</td></tr>\n<tr><td>FinCEN 314(a) (30d)</td><td>${cur.fincen_314a_30d}</td><td>${delta('fincen_314a_30d')}</td></tr>\n</table>`;\nstore.lastWeekKPIs = cur;\nreturn [{json: {html, cur, ts: new Date().toISOString()}}];\n"
      }
    },
    {
      "id": "email-5",
      "name": "Email CEO + CCO",
      "type": "n8n-nodes-base.gmail",
      "parameters": {
        "operation": "send",
        "toList": "[email protected],[email protected]",
        "bccList": "[email protected]",
        "subject": "Weekly RegTech KPI \u2014 {{$json.ts.slice(0,10)}}",
        "message": "={{$json.html}}",
        "emailType": "html"
      }
    },
    {
      "id": "slack-5",
      "name": "Slack #weekly-kpi",
      "type": "n8n-nodes-base.slack",
      "parameters": {
        "channel": "#weekly-kpi",
        "text": "Weekly: {{$json.cur.sars_open}} SARs open | {{$json.cur.ofac_hits_7d}} OFAC hits | {{$json.cur.ctrs_filed_7d}} CTRs filed | {{$json.cur.aml_alerts_7d}} AML alerts \u2014 full report in email"
      }
    }
  ],
  "connections": {
    "Monday 8 AM": {
      "main": [
        [
          {
            "node": "Postgres \u2014 Account Events",
            "type": "main",
            "index": 0
          },
          {
            "node": "Postgres \u2014 Compliance Events",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Postgres \u2014 Account Events": {
      "main": [
        [
          {
            "node": "Merge KPIs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Postgres \u2014 Compliance Events": {
      "main": [
        [
          {
            "node": "Merge KPIs",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Merge KPIs": {
      "main": [
        [
          {
            "node": "Build HTML Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build HTML Report": {
      "main": [
        [
          {
            "node": "Email CEO + CCO",
            "type": "main",
            "index": 0
          },
          {
            "node": "Slack #weekly-kpi",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

The OFAC freeze clock: why it matters for iPaaS architecture

OFAC SDN matching is the only clock in financial compliance that requires an action — freeze — before any reporting window even opens. The freeze must happen at the point of transaction detection, not after a human reviews an alert queue. If your OFAC screening result travels through a cloud iPaaS message queue before triggering the account freeze, that queue latency is the interval during which a sanctioned transaction could clear.

Self-hosted n8n, running inside your network perimeter alongside your OFAC screening engine, eliminates that latency from the critical freeze path. The OFAC SISS report that follows (10 business days) can tolerate network hops — the freeze cannot.

The secondary concern is tipping off: 31 CFR §597.701 prohibits notifying a blocked person of their blocked status in a way that could allow them to evade future controls. A cloud iPaaS with external logging or monitoring visibility on alert payloads creates a disclosure risk that an on-prem automation layer does not.

Self-hosting argument for RegTech SaaS

Five reasons compliance SaaS procurement teams ask about iPaaS data handling:

OFAC SDN result sovereignty: blocked transaction records under 31 CFR §501 must be reported to OFAC — routing through a cloud SaaS creates a subprocessor in the OFAC data chain. FinCEN SAR safe harbor: 31 USC §5318(g)(2) grants SAR filers immunity only if SAR contents are not disclosed — cloud iPaaS log access by the vendor could pierce that safe harbor. FinCEN 314(a) law enforcement data: subject names in 314(a) requests are not for transmission to non-bank third parties — a cloud automation layer in the 314(a) response workflow is outside the program's intent. CDD beneficial owner records: 31 CFR §1010.230 records are OCC/FDIC/FinCEN exam targets — self-hosted Postgres storage removes the cloud retrieval latency from the exam response window. SOC 2 CC9.2: every cloud automation vendor you route BSA data through is a TPSP in scope for your next exam. Self-hosted n8n = zero additional scope expansion.

Get the complete workflow pack

All 5 workflows above — with full import-ready JSON — plus 10 more RegTech, compliance, and financial crime prevention workflows are available in the FlowKit n8n Automation Pack at stripeai.gumroad.com. Individual templates: $12–$29. Full bundle (15 workflows): $97.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.