Skip to main content

Real-time IoT anomaly detection with MQTT, GPT-4o-mini AI, and multi-channel alerts

Workflow preview

Workflow preview
100%
Real-time IoT anomaly detection with MQTT, GPT-4o-mini AI, and multi-channel alerts preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

How It Works MQTT ingests real time sensor data from connected devices. The workflow normalizes the values and trains or retrains machine learning models on a defined schedule. An AI agent detects ...

Best for

  • Engineering automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.mqtttrigger, n8n-nodes-base.set, n8n-nodes-base.code, n8n-nodes-base.postgres, n8n-nodes-base.aggregate, @n8n/n8n-nodes-langchain.agent, @n8n/n8n-nodes-langchain.lmchatopenai, n8n-nodes-base.if

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Cheng Siong Chin.

Original n8n.io source

1.1 Workflow description

Title
Real-time IoT anomaly detection with MQTT, GPT-4o-mini AI, and multi-channel alerts
Workflow name
Real-time IoT anomaly detection with MQTT, GPT-4o-mini AI, and multi-channel alerts

How It Works

MQTT ingests real-time sensor data from connected devices. The workflow normalizes the values and trains or retrains machine learning models on a defined schedule. An AI agent detects anomalies, validates the results for accuracy, and ensures reliable alerts. Detected issues are then routed to dashboards for visualization and sent via email notifications to relevant stakeholders, enabling timely monitoring and response.

Setup Steps

  1. MQTT: Configure broker connection, set topic subscriptions, and verify data flow.
  2. ML Model: Define retraining schedule and specify historical data sources for model updates.
  3. AI Agent: Connect Claude or OpenAI APIs and configure anomaly validation prompts.
  4. Alerts: Set dashboard URL and email recipients to receive real-time notifications.

Prerequisites

MQTT broker credentials; historical training data; OpenAI/Claude API key; dashboard access; email service

Use Cases

IoT sensor monitoring; server performance tracking; network traffic anomalies; application log analysis; predictive maintenance alerts

Customization

Adjust sensitivity thresholds; swap ML models; modify notification channels; add Slack/Teams integration; customize validation rules

Benefits

Reduces detection latency 95%; eliminates manual monitoring; prevents false alerts; enables rapid incident response; improves system reliability

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - MQTT Sensor Data Ingestion

Type / Role
n8n-nodes-base.mqttTrigger - mqttTrigger
Config choices
Version 1

Block 2 - Workflow Configuration

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 3 - Edge Preprocessing & Validation

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 4 - Normalize Sensor Data

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 5 - Store Raw Data in Time-Series DB

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 6 - Aggregate Sensor Readings

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 7 - AI Anomaly Detection Agent

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 3

Block 8 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 9 - Check for Anomalies

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 10 - Store Anomaly Records

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 11 - Send Alert to Dashboard API

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.3

Block 12 - Send Slack Alert

Type / Role
n8n-nodes-base.slack - slack
Config choices
Version 2.3

Block 13 - Send Email Alert

Type / Role
n8n-nodes-base.emailSend - emailSend
Config choices
Version 2.1

Block 14 - Model Retraining Schedule

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 15 - Fetch Historical Data for Retraining

Type / Role
n8n-nodes-base.postgres - postgres
Config choices
Version 2.6

Block 16 - Retrain ML Model via API

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.3

Block 17 - Statistical Anomaly Detection

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 18 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 19 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 20 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 23 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 24 - Sticky Note6

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Showing the first 24 of 28 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Real-time IoT anomaly detection with MQTT, GPT-4o-mini AI, and multi-channel alerts
Complexity advanced
Nodes 28
Categories Engineering, AI Summarization
Author Cheng Siong Chin
Published 12 Nov 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/10759/10759.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Real-time IoT anomaly detection with MQTT, GPT-4o-mini AI, and multi-channel alerts do?

How It Works MQTT ingests real time sensor data from connected devices. The workflow normalizes the values and trains or retrains machine learning models on a defined schedule. An AI agent detects ...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Engineering, AI Summarization use case.