Knowledge Base

IoT Hub Message Handler with Approval Gate

Duration: ~30 min · Level: Advanced · Template: #16 Azure IoT Hub Message Handler · Deployment: Runtime agent (Dangerous C2D send)

Prerequisites: Approvals on Runtime Agent. Azure IoT Hub connection string and device ID.

Build an IoT Hub alert handler from template #16 with a safety gate before sending a cloud-to-device (C2D) command — ideal for export to a runtime agent where operators approve on the local dashboard.

What this template does

  1. Receive D2C Message — device-to-cloud from IoT Hub.
  2. Is Alert Message? — condition on alert status.
  3. Alert Detected — warning notification.
  4. Send C2D Acknowledgement — marked Dangerous — requires operator approval at runtime.

Step 1 — Load the template

  1. Studio → Templates → search Azure IoT Hub Message Handler.
  2. Load template #16.

Step 2 — IoT Hub settings

  1. Configure connection string and deviceId on receive and send nodes.
  2. Set C2D payload in Send C2D Acknowledgement.
  3. Add Cron or Webhook trigger upstream if needed.

Step 3 — Export to runtime

  1. Activate and Export Runtime.
  2. Enable Operator approval support — required for Dangerous iothub.send.
  3. Install on gateway with outbound access to Azure IoT Hub.

Step 4 — Safety approval on agent

  1. Simulate or receive a D2C alert message.
  2. Run suspends at Send C2D Acknowledgement.
  3. Operator opens http://localhost:9090 (or LAN URL with token).
  4. Approve with operator name — C2D message sends only after confirmation.
  5. If denied or timeout, no C2D command is sent.

Why safety gate here?

C2D commands can change device behavior in the field. The Dangerous classification forces a human checkpoint — separate from business approvals in /approvals.

Related tutorials

Nodlyn Assistant
Ask me anything about Nodlyn
Hi! 👋 I'm the Nodlyn assistant. Ask me about the product, workflow components, connectors, agent runtime, agent capabilities, deployment, and more. If I don't know an answer, I'll point you to our contact form.