Skip to content
The Things Stack documentation home
Getting Started Concepts Cloud Enterprise Integrations API Hardware
Getting Started Concepts
Cloud Enterprise
Integrations API Hardware
Get The Things Stack

    Recent searches

      Popular pages

      • Getting Started
      • Adding Gateways
      • Adding Devices
      • Payload Formatters
      • Webhooks
      • Authentication

      No results for “”.

      • Check the spelling, or try fewer or more general words.
      • Ask the community on The Things Network Forum
      • Contact support
      ↑↓ to navigate ↵ to open Esc to close

      Integrations

      • Overview
      • Adding Applications
      • Data Formats
      • Payload Formatters
      • Webhooks
      • Storage Integration
      • Integrate with popular IoT platforms
      • Other integrations
        • MQTT Server
        • Pub/Sub
        • Node-RED
          • Setup
          • Receive Events and Messages
          • Send Messages
        • IFTTT
      • Application Packages
      • Examples

      Receive Events and Messages

      Updated 20 January 2025 Edit on GitHub
      Copy page
      • View as MarkdownThis page as plain text
      • Open in ChatGPTAsk questions about this page
      • Open in ClaudeAsk questions about this page

      This section follows the process of setting up a flow which subscribes and listens to the events and messages that are being published by the MQTT server.

      Configure MQTT In Node

      Place the mqtt in node on the dashboard. Double-click on the node to configure its properties.

      In the Server dropdown menu, select Add new mqtt-broker and click on the button besides to edit it.

      In the Connection tab, under Server, provide the address of the MQTT server (without port) from The Things Stack Console (the address shown on the image at the bottom of the Setup section).

      Provide the port in the Port field next to it, to define if you want an insecure or a TLS-secured connection with the server.

      In this example, TLS-secured connection is to be established, so the Port value is set to 8883. In this case you should also check the Enable secure (SSL/TLS) connection box.

      Configuring MQTT Server connection information

      In the Security tab, enter the Username and Password according to the values in The Things Stack Console (the credentials shown on the image at the bottom of the Setup section).

      Configuring MQTT Server credentials

      Go back to Properties and set the Topic value to # (to subscribe to all topics).

      A full list of topics that you can subscribe to can be found in MQTT Server guide. Instead of subscribing to all uplink topics, you can choose the ones you want to listen. For example, you can subscribe to v3/{application_id}/devices/{device_id}/up to only listen to uplink messages.

      Also, make sure to read a note on using the tenant ID in multi-tenant The Things Stack environments, because these topics can have a slightly different format.

      Select the QoS value from the listed options and set Output parameter to a parsed JSON object.

      Configure Debug Nodes

      Add two debug nodes and connect both to the mqtt in node. One debug node will listen to the events, while the other will listen to published messages.

      Set the Output parameters of these nodes to complete msg object and msg.payload.

      Deploy

      Click on Deploy in the upper right corner. If the setup is correct, connected status will be reported below the mqtt in node.

      Click on debug icon in the upper right corner to see the published event messages and their payloads in JSON format.

      Final flow scheme

      If you do not see any output in the debug window on the right, make sure you activated your debug nodes.

      ← Setup Send Messages →

      On this page

      • Configure MQTT In Node
      • Configure Debug Nodes
      • Deploy

      Sections

      Getting Started

      Concepts

      Cloud

      Enterprise

      Integrations

      API

      Hardware

      Sitemap

      View our Sitemap

      Contributing

      GitHub

      About Us

      The Things Industries

      Privacy Policy

      Cookie settings

      Cookie Settings

      We use cookies to enhance your experience, analyze site traffic and deliver personalized content. Read our Privacy Policy.

      Cookie categories