In this page, you will see how to publish an Alert from your Node-Red application that will be delivered to the alert channel members based on their preference of method of delivery.
Navigate to the Alerts tab. Tap on Alert Channels and create a channel.
Tap on the gear icon next to the alert channel and go to Manage Alert Channel Notifications to set your personal preferences for receiving an alert from this channel (Go to Managing Alert Channel for details). Note that to receive a text message, you should verify your phone number first, which can be done in the Profile Button on the top right side of the screen.
Connect to Node-RED
Ensure your device is connected to the cloud by checking if you see the green light on the device page, Enable the Node-RED connection in the Remote Connections tab, and hit Connect.
From the nodes in the left navigation bar, drag and drop the alert channel out node.
Double-click on the alert channel out node, and then double click on the edit button.
If you have previously configured any nodes with your Device API KEY username and password, your nodes should already be configured.
Next, we will click the refresh button in the Topic and select the Alert Channel that we will like to publish to.
Once everything is complete, 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 alert channel out node, respectively.
Double-tap the function node and write this code:
1
msg.payload =
2
{
3
"severity_level":"MAJOR",
4
"subject":"An alert subject",
5
"description":"Description of the alert",
6
};
7
return msg;
Copied!
Severity levels could be one of the following:
1.
MAJOR
2.
MINOR
3.
INFORMATIVE
Important: Alert severities need to be CAPITALIZED.
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 preferences. You can change your notification preferences by selecting the alert channel and clicking on the gear icon.
Congratulations! You have successfully published an alert to an alert channel and subscribes have received a notification based on their delivery preferences.