Question
Asked August 2 2013

Community Question

As discussed in the Twitter topic, I have successfully integrated Notify My Android's (NMA) API in to EZ-Builder through EZ-Script. This will allow push notifications from EZ-Builder to your Android devices for instant remote warnings and information.

To set it up first you must have a Notify My Android account, there are free accounts or for a flat $4.99 fee you can upgrade. Free are fine if you send less than 5 notifications per day but for $5 it's worth upgrading so you don't miss out on anything important.

To do this visit www.NotifyMyAndroid.com
Click on Register
Enter your desired username, password, email address and captcha.

To use the API you will need an API code. Once you have your NMA account and have logged in click on My Account
Next click on Generate Key
You should be given a long key on the page.
User-inserted image

Next, you will need the NMA app on your device(s). It's free from Google Play Store. Click here to get it.

Open up the app and log in with your details - this is straight forward enough and self explanatory.
User-inserted image

User-inserted image

User-inserted image

Now, open up EZ-Builder and load up your project.
Add a new script with the following (you will need to add in your API key)

Code:


$apikey = ""
$event = "Notification"
$description = "Test message sent from within EZ-Builder via EZ-Script commands"
$priority = "0"
$url = "http://www.ez-robot.com";

# Notify My Android call
HTTPGet("https://www.notifymyandroid.com/publicapi/notify?apikey="; + $apikey + "&application=EZ-Builder&event=" + $event + "&description=" + $description + "&priority=" + $priority + "&url=" + $url)


Once you have your API key added to the above code, test the script out by running it. You should receive a notification on your Android devices.

Now you have confirmed it is working edit the script.
Remove lines 2, 3, 4 and 5

Code:


$event = "Notification"
$description = "Test message sent from within EZ-Builder via EZ-Script commands"
$priority = "0"
$url = "http://www.ez-robot.com";


This is now your basic command for sending notifications. To use it, in any script where a notification is needed simply add the following code (fill in the event, description and priority variables to suit the notification). Note: Priority is -2, -1, 0, 1 or 2 with -2 being lowest and 2 being highest.

Code:


# NMA
# Set event and description for the notification
$event = ""
$description = ""
$priority = "0"
$url = ""
# Call the command
ControlCommand("Notify", ScriptStart)


The script should then start the notification script (mine is called Notify), pass the new Event and Description information to the url in the HTTPGet and your Android device(s) should receive the messages.

Use this code in any scripts and, provided you set the $event, $description, $priority and $url variables before running the ControlCommand the message will be tailored to suit the specific trigger or event.

Please ask any questions or ask for anything that is not clear to be clarified where necessary. If it will help I can add images to this to show everything however it shouldn't be necessary.

User-inserted image

User-inserted image

User-inserted image
August 2 2013
Reserved for Q&A/FAQ Etc.
February 3 2015
It's the NMA API and you don't "get it", it's web based. You send the requests to it.
February 3 2015
Oh wait I got it. I went to My Accounts page and clicked on Generate New Key. Is that the one?
February 3 2015
Yes, you will need your API key.

As described, it needs to be entered in to this script;

Code:

$apikey = ""

# Notify My Android call
HTTPGet("https://www.notifymyandroid.com/publicapi/notify?apikey="; + $apikey + "&application=EZ-Builder&event=" + $event + "&description=" + $description + "&priority=" + $priority + "&url=" + $url)


It goes on the first line between the quotes.

Save that script as "Notify" or something as meaningful. Set the other variables as required and call the notify script.

It's advised you follow closely what I wrote in post #1, it is all explained and will avoid receiving any errors.
February 3 2015
I did as followed but the error I get is unable to http get www.notifymyandroid.com
February 3 2015
I'm not sure if it was the forum which added in a semi-colon or if it needed it but they look out of place. I'm not home right now so can't check but try without the semi-colons and see if that helps.

NMA's website is up as is the API, it should be working (it was at 7:40am this morning as my external PIR notified me that I was walking out of my house).