Welcome!

APIs for the Internet of Things

Max Katz

Subscribe to Max Katz: eMailAlertsEmail Alerts
Get Max Katz via: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn


Blog Feed Post

How to Send a Push Notification from Server Code Script in One Line of Code

Appery.io Server Code allows to quickly write any custom app logic using JavaScript and expose is via a REST API. Here is an example invoking Uber API, and example accessing the cloud database and scheduling the script to run periodically.

Screen Shot 2015-10-28 at 9.33.31 PM

Sending push message

The Server Code script JavaScript API also enables you to send a push notification in just one line of code (well, 3 lines of code). After you configure push notifications, this is how to send a message to all users who installed the app:

PN.send("07a6350d-d563-3902-9aba-589ca6ab7876", {
    "message": "Hi, there!")
  });

Once you configure push, you will have a Push API key which you set above and then just the push message. This code will send a message to all the users who installed the app. There is also an option to send a targeted push message, only to some users.

Any script is automatically exposed via a REST API so you can quickly invoke it from an app. If you need to customize your app and build custom APIs – Server Code script is what you need.


Read the original blog entry...

More Stories By Max Katz

Max Katz heads Developer Relations for Appery.io, a cloud-based mobile app platform. He loves trying out new and cool REST APIs in mobile apps. Max is the author of two books “Practical RichFaces” (Apress 2008, 2011), DZone MVB (Most Valuable Blogger), and is a frequent speaker at developer conferences. You can find out what Max is up to on his blog: http://maxkatz.org and Twitter: @maxkatz.