Publishing Alert from Node-Red Manual

Configure MQTT in Node-RED:

From the nodes in the left navigation bar, drag and drop the output mqtt node.
Double click on mqtt node, click on the pencil/edit button and set these parameters to configure the connection:
    Connection Tab Parameters:
Parameter
Value
Server
mqtts.connect.iotflows.com
Port
443
Enable secure (SSL/TLS) connection
Checked
Client ID
Your-Device-Client-ID
Keep alive time (s)
60
Use clean session
Checked
Use legacy MQTT 3.1 support
Checked
    Security Tab Parameters:
Parameter
Value
Username
Your-Device-Client-ID
Password
Your-Device-Client-Password
Node-Red Security Parameter
Node-Red Security Parameters from IoTFlows
After the configuration is done, press the ADD
Once it has been added, click DONE.
Publish an Alert from Node-RED:
    Drag and drop an inject node.
    Drag and drop a function node.
    Connect the inject to function to mqtt node, respectively.
    Double-tap the function node and write this code:
1
msg.topic = "YOUR-ALERT-CHANNEL-MQTT-TOPIC";
2
msg.payload =
3
{
4
"severity_level": "MAJOR",
5
"subject": "An alert subject",
6
"description": "Description of the alert",
7
"client_id": "YOUR-DEVICE-CLIENT-ID"
8
};
9
return msg;
Copied!
Severity levels could be the following
    1.
    MAJOR
    2.
    MINOR
    3.
    INFORMATIVE
Important: Alert severities need to be CAPITALIZED when publishing. Failure to do so will result in you not receiving alert notifications, as well as not being able to filter results properly.
MQTT Alert Topic from Alert Channel
    From the top right corner of Node-RED, tap Deploy.
    Tap the button of the inject node and you should receive an alert based on your alert channel notification preference!
Last modified 1yr ago
Copy link