MQTT n8n integrationAutomate MQTT with n8n.
Your devices already talk to a broker, so why keep n8n out of that conversation? An MQTT n8n integration rests on two nodes: the MQTT node publishes a message to a topic you name, and the MQTT Trigger subscribes to topics and starts a workflow when a message lands there. One operation, one credential, one broker.
Verified Trustpilot reviews · AI, automation & growth agency
What does an MQTT n8n integration actually give you?
MQTT is a publish and subscribe protocol: a device sends a message to a topic on a broker, and everything subscribed to that topic receives a copy. n8n ships two nodes for it. The MQTT node publishes, with Topic and Message as its two required fields. The MQTT Trigger goes the other way, listening on the topics you hand it so that an incoming message starts a workflow.
Start with the reading side, because that is where most MQTT work begins. A workshop full of temperature probes publishes on topics like plant/line1/temp. The MQTT Trigger subscribes, and every message becomes an item you can append to a sheet through Google Sheets or store in a table through Postgres. No script on the device side, no polling loop to maintain.
Second scenario: routing. A door sensor publishes once when it opens outside working hours, and the workflow turns that raw payload into a readable line in a channel with Slack. The Only Message option is what makes that pleasant, since it strips the envelope and leaves you the payload alone.
Third scenario: writing back. The MQTT node publishes a command to a device topic, and the Retain option tells the broker to keep that last message. Normally a message published to a topic with no subscriber is discarded. With Retain on, a device that connects later still picks up the last instruction it missed.
One thing worth saying plainly, because it changes how you plan a project. On most integrations, when an operation is missing you drop in a generic HTTP node and call the API yourself. That is not the case here. The MQTT credential opens a connection to a broker, not an HTTP API, so there is no generic node to fall back on. What these two nodes expose is what n8n can do with MQTT.
So the honest limit: the node publishes, and that is all it does. Reading happens through the trigger, and anything else your broker offers stays outside n8n. If you are weighing platforms before you build, the n8n review covers the ground, and n8n training goes through credentials and expressions properly.
How do you connect n8n to your MQTT broker?
- 01
Get a broker running first
The credential connects to a broker, so one has to exist before n8n has anything to talk to. MQTT publishes a list of servers and brokers on its own site, and your provider's documentation is the reference for the connection details. Keep three things within reach for the next step: the Protocol the broker expects, its Host, and the Port it accepts connections on.
- 02
Create the broker connection credential
In n8n, open the Credentials menu and create an MQTT credential, the reusable saved login that both nodes read from a dropdown. Pick the Protocol, which decides the URL n8n builds:
Mqttfor a standardmqtt:URL,Mqttsfor the securemqtts:one,Wsfor a WebSocketws:URL. Then fill the Host, the Port, and the Username and Password the broker expects. - 03
Set the session and certificate options
Two toggles are worth a look before saving. Turn Clean Session off if you want to receive QoS 1 and 2 messages that arrived while the connection was down. Leave Client ID blank and n8n generates one, though a fixed or expression based value helps you identify a connection later; n8n suggests putting
n8nin it for easier auditing. If your broker uses SSL, turn the SSL toggle on and add the certificates it asks for.
What starts a workflow from MQTT ?
MQTT Trigger is the node that starts a workflow when something happens in MQTT. Activate the workflow and every event it receives becomes one execution.
What you see in n8n
Configuration notes
01Subscribe to topics with the MQTT Trigger
Version 1 of the MQTT Trigger holds a subscription open on your broker and hands each incoming message to the workflow as an item.
Key parameters
- Topics: the topics to subscribe to, several at once separated by commas. Wildcard characters work,
+for a single level and#for multiple levels, soplant/+/tempcatches every line andplant/#catches the whole tree. - Topics also carries the quality of service. Every subscription uses QoS 0 by default; write the level you want after a colon to change it, as in
topicA:1,topicB:2.
02Shape the payload with trigger Options
The Options collection decides what the rest of your workflow actually receives, and getting it right here saves a Code node later.
Key parameters
- JSON Parse Body: n8n tries to parse the message into an object, which is what you want when devices publish JSON and you plan to read a field with
{{ $json.temperature }}. - Only Message: returns the message property alone, without the surrounding structure. Convenient for a plain text payload you just want to forward.
- Parallel Processing: messages are handled in parallel, or turned off, kept in the order they arrived.
What can the MQTT node do?
The MQTT node exposes one operation. For each one: the node as you configure it in n8n, the required fields, and our field notes.
Operations index
Push messages to MQTT
executeWhat you see in n8n
Notes & use cases
The node publishes a message on a topic, and the broker passes it to whatever subscribes there.
Key parameters
- Topic: required, the topic to publish to, often built from an earlier node with
{{ $json.device }}. - Message: required, the message to publish. Empty means the node stops.
- Send Input Data: sends the data the node receives as JSON instead.
- QoS:
0received at most once,1at least once,2exactly once. - Retain: the broker keeps this last message on the topic.
Need help automating MQTT with n8n?
A person reads every message.
MQTT and n8n, the questions that come up
01Is the MQTT n8n integration free in n8n?
02What credentials does the MQTT node need?
03What are the limits of the MQTT node in n8n?
04Does the MQTT Trigger react in real time?
05n8n or Make for MQTT?
Get our weekly integration tips.
No spam. Unsubscribe anytime.



