AutomationFlowsAI & RAG › Monitor Data Integrity and Route Severity-based Alerts with Gpt-4o, Email…

Monitor Data Integrity and Route Severity-based Alerts with Gpt-4o, Email…

Original n8n title: Monitor Data Integrity and Route Severity-based Alerts with Gpt-4o, Email and Slack

ByCheng Siong Chin @cschin on n8n.io

This workflow automates continuous data integrity monitoring and intelligent alert management across multiple data sources. Designed for data engineers, IT operations teams, and business intelligence analysts, it solves the critical challenge of detecting data anomalies and…

Cron / scheduled trigger★★★★☆ complexityAI-powered25 nodesHTTP RequestOpenAI ChatOutput Parser StructuredAgentEmail SendSlack
AI & RAG Trigger: Cron / scheduled Nodes: 25 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #13139 — we link there as the canonical source.

This workflow follows the Agent → Emailsend recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "ChSJMM8u3RMVAc9Xja2BN",
  "name": "Intelligent AI-Driven Data Integrity Monitoring System",
  "tags": [],
  "nodes": [
    {
      "id": "c74626fd-8824-418e-8296-5ea7f7397791",
      "name": "Schedule Data Integrity Check",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -448,
        288
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes",
              "minutesInterval": 15
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "2365a95d-a84e-49fa-92b7-60009a3b49fe",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -224,
        288
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "metricsApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Software Metrics API URL__>"
            },
            {
              "id": "id-2",
              "name": "biDashboardApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__BI Dashboard API URL__>"
            },
            {
              "id": "id-3",
              "name": "anomalyThreshold",
              "type": "number",
              "value": 0.75
            },
            {
              "id": "id-4",
              "name": "criticalAlertEmail",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Critical Alert Email Address__>"
            },
            {
              "id": "id-5",
              "name": "executiveReportEmail",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Executive Report Email Address__>"
            },
            {
              "id": "id-6",
              "name": "slackCriticalChannel",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Slack Critical Alerts Channel ID__>"
            },
            {
              "id": "id-7",
              "name": "slackHighPriorityChannel",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Slack High Priority Channel ID__>"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "d98adc00-af2b-47ce-89f1-af26f52fba68",
      "name": "Fetch Software Metrics",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        0,
        192
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.metricsApiUrl }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "905249ca-c017-43aa-85b2-707e2af14517",
      "name": "Fetch BI Dashboard Data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        0,
        384
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.biDashboardApiUrl }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "0e636a03-812c-4307-bfd3-24435d60abb4",
      "name": "Merge Data Sources",
      "type": "n8n-nodes-base.code",
      "position": [
        224,
        288
      ],
      "parameters": {
        "jsCode": "// Merge data from both HTTP requests into a single structured object\nconst items = $input.all();\n\n// Initialize containers for the data\nlet metricsData = null;\nlet biData = null;\n\n// Process all input items to find data from both sources\nfor (const item of items) {\n  // Check if this item came from Fetch Software Metrics\n  if (item.json.metrics || item.json.software) {\n    metricsData = item.json;\n  }\n  // Check if this item came from Fetch BI Dashboard Data\n  else if (item.json.dashboard || item.json.bi) {\n    biData = item.json;\n  }\n  // If the structure is unknown, try to identify by other characteristics\n  else if (!metricsData) {\n    metricsData = item.json;\n  } else if (!biData) {\n    biData = item.json;\n  }\n}\n\n// Create the merged structured object\nconst mergedData = {\n  metrics: metricsData || {},\n  biData: biData || {},\n  timestamp: new Date().toISOString()\n};\n\n// Return the merged data as a single item\nreturn [{ json: mergedData }];"
      },
      "typeVersion": 2
    },
    {
      "id": "1265483a-c584-47c9-bb9d-5fa3c5d8b97d",
      "name": "OpenAI Model - Data Validation",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        456,
        512
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "id",
          "value": "gpt-4o"
        },
        "options": {
          "temperature": 0.2
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "262668b0-74c1-4da0-8658-a66730e1d08a",
      "name": "Validation Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        704,
        512
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"hasAnomaly\": {\n      \"type\": \"boolean\",\n      \"description\": \"Whether an anomaly was detected\"\n    },\n    \"anomalyScore\": {\n      \"type\": \"number\",\n      \"description\": \"Numerical score indicating the severity of the anomaly\"\n    },\n    \"anomalyType\": {\n      \"type\": \"string\",\n      \"description\": \"Type or category of the detected anomaly\"\n    },\n    \"affectedSystems\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\"\n      },\n      \"description\": \"List of systems affected by the anomaly\"\n    },\n    \"dataIntegrityIssues\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\"\n      },\n      \"description\": \"List of data integrity issues identified\"\n    },\n    \"complianceViolations\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\"\n      },\n      \"description\": \"List of compliance violations detected\"\n    },\n    \"gdprConcerns\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\"\n      },\n      \"description\": \"GDPR-related concerns identified\"\n    },\n    \"isoConcerns\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\"\n      },\n      \"description\": \"ISO compliance concerns identified\"\n    },\n    \"recommendations\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\"\n      },\n      \"description\": \"Recommended actions to address the issues\"\n    },\n    \"severity\": {\n      \"type\": \"string\",\n      \"description\": \"Overall severity level of the findings\"\n    }\n  }\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "6c94a73c-ed6b-4e91-b852-f94387e411a3",
      "name": "Data Validation Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        448,
        288
      ],
      "parameters": {
        "text": "=Data to validate: {{ JSON.stringify($json) }}",
        "options": {
          "systemMessage": "You are a Data Validation Agent specialized in inspecting structured software metrics, logs, and BI dashboards for data integrity and anomaly signals.\n\nYour task is to:\n1. Analyze incoming data for completeness, consistency, and accuracy\n2. Detect anomalies including: missing data points, unexpected value ranges, statistical outliers, data type mismatches, timestamp inconsistencies, duplicate records\n3. Identify data integrity issues: referential integrity violations, schema violations, data quality degradation\n4. Flag compliance concerns related to GDPR (data retention, consent tracking, data minimization) and ISO standards (audit trails, access controls, data classification)\n5. Calculate anomaly score (0-1 scale) based on severity and frequency of issues\n6. Classify anomaly type: data_quality, security, compliance, performance, availability\n7. List affected systems and components\n8. Provide specific recommendations for remediation\n9. Assign severity level: low, medium, high, critical\n\nIMPORTANT: You are in READ-ONLY mode. Never suggest making production changes autonomously. All recommendations must require human approval.\n\nReturn structured JSON output with all required fields."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3.1
    },
    {
      "id": "f15be92f-e155-4157-9add-43040deb9d3f",
      "name": "Check for Anomalies",
      "type": "n8n-nodes-base.if",
      "position": [
        800,
        288
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "id-1",
              "operator": {
                "type": "boolean",
                "operation": "equals"
              },
              "leftValue": "={{ $('Data Validation Agent').item.json.hasAnomaly }}",
              "rightValue": true
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "cfc91152-1c98-4926-9599-ec895c670904",
      "name": "OpenAI Model - Orchestration",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1032,
        512
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "id",
          "value": "gpt-4o"
        },
        "options": {
          "temperature": 0.3
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "ba9dbaac-395a-4670-9280-13af5379bbf0",
      "name": "Orchestration Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1160,
        512
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"alertType\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"notificationChannels\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"items\": {\n\t\t\t\t\"type\": \"string\"\n\t\t\t}\n\t\t},\n\t\t\"escalationRequired\": {\n\t\t\t\"type\": \"boolean\"\n\t\t},\n\t\t\"executiveReportRequired\": {\n\t\t\t\"type\": \"boolean\"\n\t\t},\n\t\t\"actionItems\": {\n\t\t\t\"type\": \"array\",\n\t\t\t\"items\": {\n\t\t\t\t\"type\": \"string\"\n\t\t\t}\n\t\t},\n\t\t\"complianceDocumentation\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"auditTrailRequired\": {\n\t\t\t\"type\": \"boolean\"\n\t\t},\n\t\t\"severity\": {\n\t\t\t\"type\": \"string\"\n\t\t},\n\t\t\"priority\": {\n\t\t\t\"type\": \"string\"\n\t\t}\n\t}\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "e69755c9-2996-49fb-83e0-01ab0daa29c9",
      "name": "Orchestration Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1024,
        288
      ],
      "parameters": {
        "text": "=Anomaly data: {{ JSON.stringify($json) }}",
        "options": {
          "systemMessage": "You are an Orchestration Agent responsible for coordinating automated alerts, executive reporting, and workflow escalation for data integrity issues.\n\nYour task is to:\n1. Analyze the anomaly data from the Data Validation Agent\n2. Determine appropriate notification channels based on severity: critical \u2192 email + Slack, high \u2192 Slack, medium/low \u2192 executive report only\n3. Decide if escalation to human review is required (always true for critical and high severity)\n4. Determine if executive report generation is needed\n5. Create specific action items for IT teams with clear priorities\n6. Generate compliance documentation references for GDPR and ISO standards\n7. Specify audit trail requirements for regulatory compliance\n8. Assign priority level: P0 (critical), P1 (high), P2 (medium), P3 (low)\n\nIMPORTANT CONSTRAINTS:\n- You MUST NOT make any deployment or production changes autonomously\n- All actions require human approval and oversight\n- Focus on alerting, reporting, and documentation\n- Ensure compliance with internal IT policies, GDPR, and ISO standards\n- Maintain detailed audit trails for all decisions\n\nReturn structured JSON output with all required fields."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3.1
    },
    {
      "id": "b5ca6335-0778-44b5-9fc0-69f5d1440b64",
      "name": "Route by Severity",
      "type": "n8n-nodes-base.switch",
      "position": [
        1376,
        272
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Critical",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.severity }}",
                    "rightValue": "critical"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "High",
              "conditions": {
                "options": {
                  "leftValue": "",
                  "caseSensitive": false,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.severity }}",
                    "rightValue": "high"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra",
          "renameFallbackOutput": "Medium/Low"
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "48608800-94ed-4b84-8b0e-baa5f2fbbfe1",
      "name": "Send Critical Alert Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1824,
        176
      ],
      "parameters": {
        "html": "=<html>\n<head>\n  <style>\n    body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; }\n    .header { background-color: #d32f2f; color: white; padding: 20px; text-align: center; }\n    .content { padding: 20px; }\n    .section { margin-bottom: 20px; }\n    .section-title { font-weight: bold; color: #d32f2f; margin-bottom: 10px; font-size: 16px; }\n    .detail-item { margin-bottom: 8px; }\n    .label { font-weight: bold; }\n    .severity-critical { color: #d32f2f; font-weight: bold; }\n    .footer { background-color: #f5f5f5; padding: 15px; margin-top: 20px; font-size: 12px; color: #666; }\n  </style>\n</head>\n<body>\n  <div class=\"header\">\n    <h1>\ud83d\udea8 CRITICAL DATA INTEGRITY ALERT</h1>\n  </div>\n  \n  <div class=\"content\">\n    <div class=\"section\">\n      <div class=\"section-title\">Anomaly Details</div>\n      <div class=\"detail-item\"><span class=\"label\">Type:</span> {{ $json.anomalyType }}</div>\n      <div class=\"detail-item\"><span class=\"label\">Description:</span> {{ $json.anomalyDescription }}</div>\n      <div class=\"detail-item\"><span class=\"label\">Detected At:</span> {{ $json.detectedAt }}</div>\n    </div>\n    \n    <div class=\"section\">\n      <div class=\"section-title\">Affected Systems</div>\n      <div class=\"detail-item\">{{ $json.affectedSystems }}</div>\n    </div>\n    \n    <div class=\"section\">\n      <div class=\"section-title\">Compliance Violations</div>\n      <div class=\"detail-item\">{{ $json.complianceViolations }}</div>\n    </div>\n    \n    <div class=\"section\">\n      <div class=\"section-title\">Severity Assessment</div>\n      <div class=\"detail-item\"><span class=\"label\">Severity Level:</span> <span class=\"severity-critical\">{{ $json.severity }}</span></div>\n      <div class=\"detail-item\"><span class=\"label\">Anomaly Score:</span> {{ $json.anomalyScore }}</div>\n    </div>\n    \n    <div class=\"section\">\n      <div class=\"section-title\">Recommended Actions</div>\n      <div class=\"detail-item\">{{ $json.recommendedActions }}</div>\n    </div>\n  </div>\n  \n  <div class=\"footer\">\n    <p>This is an automated alert from the AI-Driven Data Integrity Monitoring System.</p>\n    <p>Immediate action is required. Please review and respond according to your incident response procedures.</p>\n  </div>\n</body>\n</html>",
        "options": {
          "appendAttribution": true
        },
        "subject": "=CRITICAL: Data Integrity Anomaly Detected - {{ $json.anomalyType }}",
        "toEmail": "={{ $('Workflow Configuration').first().json.criticalAlertEmail }}",
        "fromEmail": "user@example.com"
      },
      "typeVersion": 2.1
    },
    {
      "id": "75030d6e-5ecb-4d92-85de-8a302d7100e5",
      "name": "Send Critical Slack Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        1824,
        368
      ],
      "parameters": {
        "text": "=\ud83d\udea8 CRITICAL DATA INTEGRITY ALERT\n\n*Anomaly Type:* {{ $json.anomalyType }}\n*Severity:* {{ $json.severity }}\n*Anomaly Score:* {{ $json.anomalyScore }}\n*Affected Systems:* {{ $json.affectedSystems.join(', ') }}\n\n*Compliance Violations:*\n{{ $json.complianceViolations.join('\\n') }}\n\n*Recommended Actions:*\n{{ $json.recommendations.join('\\n') }}\n\n\u26a0\ufe0f Human review and approval required before taking action.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Workflow Configuration').first().json.slackCriticalChannel }}"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "9f2b8037-b261-46ed-9ba3-390217763569",
      "name": "Send High Priority Slack Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        1824,
        752
      ],
      "parameters": {
        "text": "=\u26a0\ufe0f HIGH PRIORITY: Data Integrity Issue\n\n*Anomaly Type:* {{ $json.anomalyType }}\n*Severity:* {{ $json.severity }}\n*Anomaly Score:* {{ $json.anomalyScore }}\n*Affected Systems:* {{ $json.affectedSystems.join(', ') }}\n\n*Data Integrity Issues:*\n{{ $json.dataIntegrityIssues.join('\\n') }}\n\n*Recommendations:*\n{{ $json.recommendations.join('\\n') }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Workflow Configuration').first().json.slackHighPriorityChannel }}"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "3e425569-929f-43ca-967d-afc938eafa78",
      "name": "Prepare Executive Report",
      "type": "n8n-nodes-base.set",
      "position": [
        1536,
        576
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "reportTitle",
              "type": "string",
              "value": "=Data Integrity Monitoring Report - {{ $now.toFormat('yyyy-MM-dd HH:mm') }}"
            },
            {
              "id": "id-2",
              "name": "anomalySummary",
              "type": "string",
              "value": "={{ $json.anomalyType }}"
            },
            {
              "id": "id-3",
              "name": "severityLevel",
              "type": "string",
              "value": "={{ $json.severity }}"
            },
            {
              "id": "id-4",
              "name": "affectedSystemsList",
              "type": "string",
              "value": "={{ $json.affectedSystems.join(', ') }}"
            },
            {
              "id": "id-5",
              "name": "complianceStatus",
              "type": "string",
              "value": "={{ $json.complianceViolations.length > 0 ? 'Violations Detected' : 'Compliant' }}"
            },
            {
              "id": "id-6",
              "name": "actionItemsSummary",
              "type": "string",
              "value": "={{ $json.recommendations.join('; ') }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "5cd4c527-719a-45c9-af40-851215d39d12",
      "name": "Send Executive Report",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1824,
        560
      ],
      "parameters": {
        "html": "=<!DOCTYPE html>\n<html>\n<head>\n  <style>\n    body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; }\n    .header { background-color: #2c3e50; color: white; padding: 20px; text-align: center; }\n    .section { margin: 20px 0; padding: 15px; border-left: 4px solid #3498db; background-color: #f8f9fa; }\n    .section-title { font-size: 18px; font-weight: bold; color: #2c3e50; margin-bottom: 10px; }\n    .content { padding: 10px; }\n    .metric { display: inline-block; margin: 10px 20px 10px 0; }\n    .metric-label { font-weight: bold; color: #555; }\n    .metric-value { color: #3498db; font-size: 16px; }\n    .status-ok { color: #27ae60; font-weight: bold; }\n    .status-warning { color: #f39c12; font-weight: bold; }\n    .status-critical { color: #e74c3c; font-weight: bold; }\n    .footer { margin-top: 30px; padding: 15px; background-color: #ecf0f1; text-align: center; font-size: 12px; color: #7f8c8d; }\n    ul { margin: 10px 0; padding-left: 20px; }\n    li { margin: 5px 0; }\n  </style>\n</head>\n<body>\n  <div class=\"header\">\n    <h1>Executive Report: Data Integrity Monitoring</h1>\n    <p>Report Date: {{ $now.toFormat('MMMM dd, yyyy') }}</p>\n  </div>\n\n  <div class=\"section\">\n    <div class=\"section-title\">\ud83d\udcca Executive Summary</div>\n    <div class=\"content\">\n      <p>This report provides a comprehensive overview of data integrity monitoring activities, anomaly detection results, and compliance status for the reporting period.</p>\n      <div class=\"metric\">\n        <span class=\"metric-label\">Total Data Sources Monitored:</span>\n        <span class=\"metric-value\">{{ $('Merge Data Sources').item.json.totalSources || 'N/A' }}</span>\n      </div>\n      <div class=\"metric\">\n        <span class=\"metric-label\">Anomalies Detected:</span>\n        <span class=\"metric-value\">{{ $('Data Validation Agent').item.json.anomalyCount || 0 }}</span>\n      </div>\n      <div class=\"metric\">\n        <span class=\"metric-label\">Overall Status:</span>\n        <span class=\"metric-value {{ $('Orchestration Agent').item.json.overallStatus === 'OK' ? 'status-ok' : ($('Orchestration Agent').item.json.overallStatus === 'WARNING' ? 'status-warning' : 'status-critical') }}\">{{ $('Orchestration Agent').item.json.overallStatus || 'UNDER REVIEW' }}</span>\n      </div>\n    </div>\n  </div>\n\n  <div class=\"section\">\n    <div class=\"section-title\">\ud83d\udd0d Anomaly Overview</div>\n    <div class=\"content\">\n      <p><strong>Summary:</strong> {{ $('Data Validation Agent').item.json.anomalySummary || 'No significant anomalies detected during this monitoring period.' }}</p>\n      <ul>\n        <li><strong>Critical Issues:</strong> {{ $('Orchestration Agent').item.json.criticalCount || 0 }}</li>\n        <li><strong>High Priority Issues:</strong> {{ $('Orchestration Agent').item.json.highPriorityCount || 0 }}</li>\n        <li><strong>Medium Priority Issues:</strong> {{ $('Orchestration Agent').item.json.mediumPriorityCount || 0 }}</li>\n      </ul>\n    </div>\n  </div>\n\n  <div class=\"section\">\n    <div class=\"section-title\">\ud83d\udcbb Affected Systems</div>\n    <div class=\"content\">\n      <p>The following systems have been identified with data integrity concerns:</p>\n      <ul>\n        <li><strong>Software Metrics Platform:</strong> {{ $('Fetch Software Metrics').item.json.status || 'Operational' }}</li>\n        <li><strong>BI Dashboard:</strong> {{ $('Fetch BI Dashboard Data').item.json.status || 'Operational' }}</li>\n        <li><strong>Data Integration Layer:</strong> {{ $('Merge Data Sources').item.json.integrationStatus || 'Operational' }}</li>\n      </ul>\n      <p><em>Detailed system-level analysis: {{ $('Orchestration Agent').item.json.affectedSystemsDetails || 'All systems within acceptable parameters.' }}</em></p>\n    </div>\n  </div>\n\n  <div class=\"section\">\n    <div class=\"section-title\">\u2705 Compliance Status</div>\n    <div class=\"content\">\n      <p><strong>GDPR Compliance:</strong> <span class=\"{{ $('Orchestration Agent').item.json.gdprCompliant ? 'status-ok' : 'status-critical' }}\">{{ $('Orchestration Agent').item.json.gdprCompliant ? 'COMPLIANT' : 'NON-COMPLIANT' }}</span></p>\n      <p><strong>ISO 27001 Compliance:</strong> <span class=\"{{ $('Orchestration Agent').item.json.isoCompliant ? 'status-ok' : 'status-critical' }}\">{{ $('Orchestration Agent').item.json.isoCompliant ? 'COMPLIANT' : 'NON-COMPLIANT' }}</span></p>\n      <p><em>Compliance Notes:</em> {{ $('Orchestration Agent').item.json.complianceNotes || 'All compliance requirements are being met. Regular audits continue as scheduled.' }}</p>\n    </div>\n  </div>\n\n  <div class=\"section\">\n    <div class=\"section-title\">\u26a0\ufe0f Data Integrity Issues</div>\n    <div class=\"content\">\n      <p>{{ $('Data Validation Agent').item.json.integrityIssuesDescription || 'No critical data integrity issues identified. All data sources are synchronized and validated.' }}</p>\n      <ul>\n        <li><strong>Data Consistency:</strong> {{ $('Data Validation Agent').item.json.consistencyScore || '98%' }}</li>\n        <li><strong>Data Completeness:</strong> {{ $('Data Validation Agent').item.json.completenessScore || '99%' }}</li>\n        <li><strong>Data Accuracy:</strong> {{ $('Data Validation Agent').item.json.accuracyScore || '97%' }}</li>\n      </ul>\n    </div>\n  </div>\n\n  <div class=\"section\">\n    <div class=\"section-title\">\ud83c\udfaf Recommended Actions</div>\n    <div class=\"content\">\n      <p>Based on the analysis, the following actions are recommended:</p>\n      <ul>\n        <li>{{ $('Orchestration Agent').item.json.recommendation1 || 'Continue regular monitoring schedule' }}</li>\n        <li>{{ $('Orchestration Agent').item.json.recommendation2 || 'Review and update data validation rules quarterly' }}</li>\n        <li>{{ $('Orchestration Agent').item.json.recommendation3 || 'Conduct team training on data quality best practices' }}</li>\n        <li>{{ $('Orchestration Agent').item.json.recommendation4 || 'Implement automated remediation for common issues' }}</li>\n      </ul>\n    </div>\n  </div>\n\n  <div class=\"section\">\n    <div class=\"section-title\">\ud83d\udcc5 Next Steps</div>\n    <div class=\"content\">\n      <ul>\n        <li><strong>Immediate:</strong> {{ $('Orchestration Agent').item.json.immediateAction || 'Address any critical alerts identified in this report' }}</li>\n        <li><strong>Short-term (1-2 weeks):</strong> {{ $('Orchestration Agent').item.json.shortTermAction || 'Review and optimize data validation thresholds' }}</li>\n        <li><strong>Long-term (1-3 months):</strong> {{ $('Orchestration Agent').item.json.longTermAction || 'Enhance monitoring capabilities with additional data sources' }}</li>\n      </ul>\n      <p><strong>Next Report:</strong> {{ $now.plus({ days: 7 }).toFormat('MMMM dd, yyyy') }}</p>\n    </div>\n  </div>\n\n  <div class=\"footer\">\n    <p>This report was automatically generated by the AI-Driven Data Integrity Monitoring System</p>\n    <p>For questions or concerns, please contact the Data Governance Team</p>\n    <p>&copy; {{ $now.toFormat('yyyy') }} Company Name. All rights reserved.</p>\n  </div>\n</body>\n</html>",
        "options": {
          "appendAttribution": true
        },
        "subject": "=Executive Report: Data Integrity Monitoring - {{ $now.toFormat('yyyy-MM-dd') }}",
        "toEmail": "={{ $('Workflow Configuration').first().json.executiveReportEmail }}",
        "fromEmail": "user@example.com"
      },
      "typeVersion": 2.1
    },
    {
      "id": "42d21581-aa7c-40e1-a5c5-f55b7fd77779",
      "name": "Log Compliance Audit Trail",
      "type": "n8n-nodes-base.code",
      "position": [
        2048,
        288
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "// Comprehensive Audit Trail Log for GDPR and ISO Compliance\n\nconst timestamp = new Date().toISOString();\nconst inputData = $input.item.json;\n\n// Extract anomaly details from previous nodes\nconst anomalyDetails = {\n  detectedAt: timestamp,\n  anomalyType: inputData.anomalyType || 'Unknown',\n  severity: inputData.severity || 'Unknown',\n  affectedSystems: inputData.affectedSystems || [],\n  dataPoints: inputData.dataPoints || {},\n  validationResults: inputData.validationResults || {},\n  orchestrationDecisions: inputData.orchestrationDecisions || {}\n};\n\n// Extract actions taken\nconst actionsTaken = {\n  alertsSent: inputData.alertsSent || [],\n  remediationSteps: inputData.remediationSteps || [],\n  escalationLevel: inputData.escalationLevel || 'None',\n  automatedActions: inputData.automatedActions || []\n};\n\n// Extract notification channels used\nconst notificationChannels = {\n  email: inputData.emailSent || false,\n  slack: inputData.slackSent || false,\n  recipients: inputData.recipients || [],\n  messageIds: inputData.messageIds || []\n};\n\n// Compliance documentation\nconst complianceDocumentation = {\n  gdprCompliance: {\n    dataProcessingLawfulness: 'Automated monitoring for data integrity',\n    legalBasis: 'Legitimate interest - Article 6(1)(f) GDPR',\n    dataMinimization: 'Only necessary metrics collected',\n    purposeLimitation: 'Data integrity and security monitoring',\n    retentionPeriod: '90 days',\n    dataSubjectRights: 'Audit logs available upon request'\n  },\n  isoCompliance: {\n    standard: 'ISO 27001:2013',\n    controlObjective: 'A.12.4.1 Event Logging',\n    evidenceType: 'Automated audit trail',\n    reviewFrequency: 'Real-time monitoring with daily reviews'\n  }\n};\n\n// User approval status\nconst userApprovalStatus = {\n  requiresApproval: inputData.severity === 'critical' || inputData.severity === 'high',\n  approvalStatus: inputData.approvalStatus || 'Pending',\n  approvedBy: inputData.approvedBy || null,\n  approvalTimestamp: inputData.approvalTimestamp || null,\n  approvalComments: inputData.approvalComments || ''\n};\n\n// Create comprehensive audit log entry\nconst auditLogEntry = {\n  logId: `AUDIT-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,\n  timestamp: timestamp,\n  workflowName: 'AI-Driven Data Integrity Monitoring',\n  workflowExecutionId: $execution.id,\n  anomalyDetails: anomalyDetails,\n  actionsTaken: actionsTaken,\n  notificationChannels: notificationChannels,\n  complianceDocumentation: complianceDocumentation,\n  userApprovalStatus: userApprovalStatus,\n  metadata: {\n    nodeExecutionId: $execution.id,\n    executionMode: $execution.mode,\n    retentionDate: new Date(Date.now() + 90 * 24 * 60 * 60 * 1000).toISOString(),\n    complianceVersion: '1.0',\n    auditTrailVersion: '2.0'\n  }\n};\n\n// Log to console for debugging\nconsole.log('Compliance Audit Trail Created:', auditLogEntry);\n\n// Return the audit log entry\nreturn {\n  json: auditLogEntry\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "c5fd76b7-7e1c-498c-9396-11a41035004f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        752,
        -320
      ],
      "parameters": {
        "color": 4,
        "width": 608,
        "height": 352,
        "content": "## Prerequisites\nOpenAI or Nvidia API credentials for AI-powered analysis, API access to software metrics platforms\n## Use Cases\nSaaS platforms monitoring service health metrics, e-commerce businesses tracking inventory data quality\n## Customization\nAdjust scheduling frequency for monitoring intervals, modify severity thresholds for alert classification\n## Benefits\nReduces mean time to detection by 75%, eliminates manual data quality checks"
      },
      "typeVersion": 1
    },
    {
      "id": "b28afeb9-0dd2-4c1a-8dfa-9d34f8091cae",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        272,
        -336
      ],
      "parameters": {
        "width": 448,
        "height": 352,
        "content": "## Setup Steps\n1. Configure Schedule Data Integrity Check trigger with monitoring frequency\n2. Connect Workflow Configuration node with data source parameters\n3. Set up Fetch Software Metrics and Fetch BI Dashboard Data nodes with respective API credentials\n4. Configure Merge Data Sources node for data consolidation logic\n5. Connect Data Validation Agent with OpenAI/Nvidia API credentials for anomaly detection\n6. Set up Orchestration Agent with AI API credentials for severity assessment\n7. Configure Check for Anomalies node with routing conditions\n8. Connect Route by Severity node with classification logic"
      },
      "typeVersion": 1
    },
    {
      "id": "1266b91f-f6ab-4e0c-ad6e-97fedc372d0b",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -464,
        -288
      ],
      "parameters": {
        "width": 704,
        "height": 288,
        "content": "## How It Works\nThis workflow automates continuous data integrity monitoring and intelligent alert management across multiple data sources. Designed for data engineers, IT operations teams, and business intelligence analysts, it solves the critical challenge of detecting data anomalies and orchestrating appropriate responses based on severity levels. The system operates on scheduled intervals, fetching data from software metrics APIs and BI dashboards, then merging these sources for comprehensive analysis. It employs AI-powered validation and orchestration agents to detect anomalies, assess severity, and determine optimal response strategies. The workflow intelligently routes alerts based on severity classification, triggering critical notifications via email and Slack for high-priority issues while sending standard reports for routine findings. By maintaining detailed compliance audit logs and preparing executive summaries, it ensures stakeholders receive timely, actionable intelligence while creating audit trails for data quality monitoring initiatives."
      },
      "typeVersion": 1
    },
    {
      "id": "38989ff0-5c6e-437a-a494-961a8bce2cba",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -512,
        80
      ],
      "parameters": {
        "color": 7,
        "width": 896,
        "height": 544,
        "content": "## Multi-Source Data Collection\n**What:** Fetches and merges data from software metrics APIs and BI dashboard sources on scheduled intervals\n**Why:** Ensures comprehensive monitoring coverage by combining operational metrics with business intelligence for complete visibility\n"
      },
      "typeVersion": 1
    },
    {
      "id": "b29b03fa-367d-4ce9-ab2e-6389f5d6f565",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        992,
        80
      ],
      "parameters": {
        "color": 7,
        "width": 1216,
        "height": 896,
        "content": "## Severity-Based Alert Routing\n**What:** Routes alerts through severity-specific channels with tailored messaging for critical, high-priority, and standard notifications\n**Why:** Ensures urgent issues receive immediate attention while preventing alert fatigue from routine findings"
      },
      "typeVersion": 1
    },
    {
      "id": "8e8723fe-7105-417f-ac7c-128a1243d5ac",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        80
      ],
      "parameters": {
        "color": 7,
        "width": 544,
        "height": 720,
        "content": "## AI-Powered Anomaly Detection\n**What:** Processes merged data through dual AI agents for validation and intelligent orchestration of anomaly findings\n**Why:** Leverages AI to detect subtle patterns and determine appropriate severity classifications beyond simple threshold-based rules\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "d8316c61-cb28-4db0-bc3f-5bb0c6f4d068",
  "connections": {
    "Route by Severity": {
      "main": [
        [
          {
            "node": "Send Critical Alert Email",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Critical Slack Alert",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send High Priority Slack Alert",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Prepare Executive Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Data Sources": {
      "main": [
        [
          {
            "node": "Data Validation Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for Anomalies": {
      "main": [
        [
          {
            "node": "Orchestration Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Orchestration Agent": {
      "main": [
        [
          {
            "node": "Route by Severity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Data Validation Agent": {
      "main": [
        [
          {
            "node": "Check for Anomalies",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Executive Report": {
      "main": [
        [
          {
            "node": "Log Compliance Audit Trail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Software Metrics": {
      "main": [
        [
          {
            "node": "Merge Data Sources",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Fetch Software Metrics",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch BI Dashboard Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch BI Dashboard Data": {
      "main": [
        [
          {
            "node": "Merge Data Sources",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Executive Report": {
      "main": [
        [
          {
            "node": "Send Executive Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validation Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Data Validation Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Send Critical Alert Email": {
      "main": [
        [
          {
            "node": "Log Compliance Audit Trail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Critical Slack Alert": {
      "main": [
        [
          {
            "node": "Log Compliance Audit Trail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Orchestration Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Orchestration Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Model - Orchestration": {
      "ai_languageModel": [
        [
          {
            "node": "Orchestration Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Data Integrity Check": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Model - Data Validation": {
      "ai_languageModel": [
        [
          {
            "node": "Data Validation Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Send High Priority Slack Alert": {
      "main": [
        [
          {
            "node": "Log Compliance Audit Trail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow automates continuous data integrity monitoring and intelligent alert management across multiple data sources. Designed for data engineers, IT operations teams, and business intelligence analysts, it solves the critical challenge of detecting data anomalies and…

Source: https://n8n.io/workflows/13139/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This workflow automates end-to-end patient care coordination by monitoring appointment schedules, clinical events, and care milestones while orchestrating personalized communications across multiple c

HTTP Request, Agent, OpenAI Chat +5
AI & RAG

This workflow automates comprehensive risk signal detection and regulatory compliance management across financial and claims data sources. Designed for risk management teams, compliance officers, and

HTTP Request, Agent, OpenAI Chat +5
AI & RAG

This workflow automates satellite data processing by ingesting raw geospatial data, applying AI analysis, and submitting formatted reports to regulatory authorities. Designed for environmental agencie

HTTP Request, Agent, OpenAI Chat +4
AI & RAG

This workflow automates end-to-end supply chain visibility and logistics coordination for manufacturers, distributors, and retailers managing complex multi-tier supply networks. Designed for supply ch

HTTP Request, OpenAI Chat, Output Parser Structured +4
AI & RAG

This workflow automates programme performance monitoring and governance oversight through intelligent AI-driven analysis and multi-tool orchestration. Designed for programme managers, portfolio manage

HTTP Request, Agent, OpenAI Chat +4