See llms.txt for all machine-readable content.

Webhook and MQTT integration

Save yourself the work of writing custom integrations for Webhook and MQTT and use n8n instead. Build adaptable and scalable Development, Core Nodes, workflows that work with your technology stack. All within a building experience you will love.

How to connect Webhook and MQTT

Create a new workflow and add the first step

In n8n, click the "Add workflow" button in the Workflows tab to create a new workflow. Add the starting point – a trigger on when your workflow should run: an app event, a schedule, a webhook call, another workflow, an AI chat, or a manual trigger. Sometimes, the HTTP Request node might already serve as your starting point.

Webhook and MQTT integration: Create a new workflow and add the first step

IOT device control with MQTT and webhook

. IOT device control with MQTT and webhook This workflow is for users wanting a practical example of how to control IOT systems using the MQTT protocol in an an n8n environment. The template provides typical n8n MQTT and Webhook node implementation and configuration settings necessary to set IOT device inputs and outputs. How it works A webpage with IOT control 'on and 'off' buttons is presented to the user. When a button is selected on the webpage the value is sent via a webhook to trigger the active workflow. The workflow set node then prepares the received value into a message payload. It then passes the message to the MQTT node for publishing the topic with the payload to a cloud based MQTT broker. A remote ESP32 micro-controller subscribes to the broker and reads the payload contained in the topic. The ESP32 will then toggle the GPIO pin depending on the topic payload value. The IOT control webpage The webpage is a simple HTML page containing the clickable 'on' and 'off' buttons. It also has the get webhook URL that sends the selected value to the n8n workflow in this case running locally. The URL webhook format is http://localhost:5678/webhook/pin-control?value=action The webpage code IOT-control.html IOT device The IOT device is an ESP32 micro-controller running on a remote network. To keep it simple GPIO2 is selected as the control output. In this case when the received value is "on" GPIO2 goes high a led will turn on in the ESP32. It will go off when the received value is "off". The program for the ESP32 IOT control is 'main.py' . You will require a micropython interpreter to be uploaded to the ESP32 for the program to run automatically. The code can be easily edited and modified to accommodate any further attached IOT devices. The ESP32 main.py code main.py How to customise this workflow to your needs ESP32 You will need a working ESP32 installed with a micro-python interpreter. The code main.py is provided. The main.py program can loaded and edited with a python IDE. I used Thonny for this example. Use a free MQTT broker to get started. I used "broker.emqx.io" in the code. IOT Control Webpage The webpage contains HTML and can be easily edit to enhance functionality. The embedded webhook is configured for n8n production mode. http://localhost:5678/webhook/pin-control?value=action If you want to run the page in test mode you will use the following URL. http://localhost:5678/webhook-test/pin-control?value=action n8n workflow. The workflow is a good demonstration of how to control IOT devices using n8n. Following these steps will give a good insight for microcontroller automation.

Popular ways to use the Webhook and MQTT integration

Build your own Webhook and MQTT integration

Create custom Webhook and MQTT workflows by choosing triggers and actions. Nodes come with global operations and settings, as well as app-specific parameters that can be configured. You can also use the HTTP Request node to query data from any app or service with a REST API.

Webhook and MQTT integration details

Webhook

Webhook

Webhooks are automatic notifications that apps send when something occurs. They are sent to a certain URL, which is effectively the app's phone number or address, and contain a message or payload. Polling is nearly never quicker than webhooks, and it takes less effort from you.

MQTT

MQTT

MQTT is an OASIS standard messaging protocol for the Internet of Things (IoT). It is intended to link faraway devices with a tiny code footprint and low network traffic by acting as a very lightweight publish/subscribe message transport.

Other integrations with Webhook and MQTT

Save engineering resources

Reduce time spent on customer integrations, engineer faster POCs, keep your customer-specific functionality separate from product all without having to code.

Learn more

FAQ about Webhook integrations

Need help setting up your Webhook and MQTT integration?

Discover our latest community's recommendations and join the discussions about Webhook and MQTT integration.

  • Benjamin Hatton

    Retrieving body from a POST multipart/form-data request

    Benjamin Hatton

    Hi everyone, first of all, I’d like to say I’m really pleased to join the n8n community : I discovered n8n through SeaTable, and I really love it, thanks a lot for all this work and for maintaining a community version :+…

    Open topic
  • Albert Ashkhatoyan

    Some webhooks not working

    Albert Ashkhatoyan

    Hey! I have Migrated my n8n instance to a new machine on AWS and added Postgres DB, Everything exported and imported and seems all workflows exist but some workflows with webhook trigger gives error connection timeout. I…

    Open topic
  • Fideo

    Monday Webhooks in n8n

    Fideo

    Hi guys, I’m new to n8n but has some experience in make.com. I was trying to connect monday webhook inside n8n. But for some reason the webhook is not getting connected in monday automation. It was easier in make.com bu…

    Open topic
  • Víctor González

    Webhook timeout after wait node

    Víctor González

    Hello everyone, I made a n8n workflow trying to circumvent some limitations in a wordpress plugin I use called Funnelkit Automations. Funnelkit has a node based interface to build marketing automations, similar to n8n b…

    Open topic
  • Salomão

    What happens if a webhook misses an event because the server was down?

    Salomão

    Let’s say I have a webhook listening for Stripe payment events and I’m updating my server exactly during the time of a purchase. What happens? And how to prevent missing events? Information on your n8n setup n8n vers…

    Open topic

Looking to integrate Slack and VirusTotal in your company?

Trusted by teams building smarter workflows.

Why

Why use n8n to integrate Webhook with MQTT

Handle branching, merging and iteration easily. Pause your workflow to wait for external events.

Re-run single steps to test changes in no time. And pin your data to avoid generating trigger events every time you execute.

Your data is displayed alongside your settings, making edge cases easy to track down.

Use 1000+ workflow templates available from our core team and our community.

Copy and paste, easily import and export workflows.

Simple enough to 
understand + sophisticated 
enough to ship