Real-time IoT Anomaly Detection with MQTT, GPT-4o-mini AI, and Multi-channel Alerts — n8n Workflow

High complexity Trigger17 nodes⚒️ Engineeringby Cheng Siong Chin

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 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

MQTT: Configure broker connection, set topic sub

Nodes used

Send EmailHTTP RequestPostgresSlackCodeAI AgentOpenAI Chat Model

Workflow Preview

Loading workflow preview...

How it Works

  1. 1

    Trigger

    The workflow starts with a trigger trigger.

  2. 2

    Process

    Data flows through 17 nodes, connecting agent, aggregate, code.

  3. 3

    Output

    The workflow completes its automation and delivers the result to the configured destination.

Node Details (17)

SE

Send Email

emailSend

#1
HT

HTTP Request

httpRequest

#2
PO

Postgres

postgres

#3
SL

Slack

slack

#4
CO

Code

code

#5
AI

AI Agent

n8n-nodes-langchain.agent

#6
OP

OpenAI Chat Model

n8n-nodes-langchain.lmChatOpenAi

#7

How to Import This Workflow

  1. 1Click Download JSON button on the right to save the workflow file.
  2. 2Open your n8n instance. Go to Workflows → New → Import from file.
  3. 3Select the downloaded real-time-iot-anomaly-detection-with-mqtt-gpt-4o-mini-ai-and-multi-channel-alerts file and click Import.
  4. 4Set up credentials for each service node (API keys, OAuth, etc.).
  5. 5Click Test Workflow to verify everything works, then activate it.

Or paste directly in n8n → Import from JSON:

{ "name": "Real-time IoT Anomaly Detection with MQTT, GPT-4o-mini AI, and Multi-channel Alerts", "nodes": [...], ...}

Integrations

agentaggregatecodeemailsendhttprequestiflmchatopenaimqtttriggerpostgresscheduletriggersetslack

Get This Workflow

Download and import in one click

View on n8n.io
Nodes17
Complexityhigh
Triggertrigger
CategoryEngineering

Created by

Cheng Siong Chin

Cheng Siong Chin

@cschin

Tags

agentaggregatecodeemailsendhttprequestiflmchatopenaimqtttriggerpostgresscheduletrigger

New to n8n?

n8n is a free, open-source workflow automation tool. Self-host it or use the cloud version.

Get n8n Free →