Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

Send Alarm Notification to Mobile Phone


  • The standard event handler action to send an Alarm to the outside world is an Email. We run many processes unattended overnight and needed something more "Urgent" to get staff attention. Perhaps there is a better way, but what works for us is that a Notification gets send to one or a group mobile phones. On the phone the Notification pops up with a sound (even on a locked phone) and action can be taken.

    You can run your own server or use something like OneSignal. All use API.

    Enter HTTP Builder. Very powerful.

    In Mango a global script has been created with all the authorization, etc variables and gets called in other scripts.

    Global Script:

    function OneSignalNotice(notice){
    
    var url = "https://onesignal.com/api/v1/notifications";
    
    var headers = {
        "Content-Type": "application/json",
        "Authorization": "Basic ZWY5NmUxZjctYjAyNC00MTg0LWxxxxxxxxx",
    };
    
    
    var parameters = {
      "app_id" : "9b42d346-dd6f-4462-85a5-xxxxxxx",
      "contents" : {"en": notice},
      "included_segments" : "All"
    };
    
    
    HttpBuilder.post(url, headers, parameters).err(function(status, headers, parameters) {
      throw "Script failed with HTTP status : " + status;
    }).resp(function(status, headers, parameters) {
      "Hallo" 
    }).execute();
    
    }
    

    I don't think Event Handler / Set Point / Set to scripted value is meant to be used this way, but it works:

    // Send OneSignal Alarm Notice
    OneSignalNotice("ALARM Harvest 1 Temperature is too HIGH at: " + JSON.stringify(p226.value));
    
    

    .

    0_1514177188394_Image mango 1.jpg

    I hope it will help someone.


  • Nice! Thanks for sharing Balistar!

    I don't think Event Handler / Set Point / Set to scripted value is meant to be used this way, but it works:

    It may not have been the original vision, but with the addition of the HttpBuilder and JsonEmport objects, we also added 'UNCHANGED' as a return value for set point scripts realizing that giving more functions to scripts will result in set point handlers and meta points that don't produce values, they only interact. So, if you return UNCHANGED; you will not set a value to the target point.


  • This is awesome, Thank you for sharing. Will definitely incorporate it. Wish i saw this before a recent project with SMS's Although I would like to try do the same with the slack API. Where can I read more on the HTTP builder?

    Thank you



  • This is great but I also think a Slack integration would be really slick.


  • Slack integration turned out to be quite easy. especially if you just sending messages with attachments. using webhooks only takes a few minutes to get set up. There is so much more you can do with the other 100 API methods. But if you just sending simple status messages, useing the webhook url is the way to go.
    0_1520667177830_Screen Shot 2018-03-10 at 09.26.37.png
    1.open a workspace on slack
    2. turn webhooks on your channel.
    3. copy the URL and insert into global script
    4. get you channel ID and insert into parameters
    5. call the script the same way Balistar explained.


  • Thanks for sharing CraigWeb!