DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. A Quick Guide for Sending Push Notifications

A Quick Guide for Sending Push Notifications

Max Katz discusses the ease and flexibility of using targeted Push Notifications with the Appery.io platform.

Max Katz user avatar by
Max Katz
·
Nov. 22, 16 · Opinion
Like (2)
Save
Tweet
Share
3.33K Views

Join the DZone community and get the full member experience.

Join For Free

Being able to send Push Notifications to users is one of the fundamental capability in an enterprise mobile app. Appery.io platform comes with Push Notifications component out-of-the-box and allows you quickly to send targeted messages to iOS and Android devices. In this blog post we will show the four ways to send a Push Notification message to a user:

  1. Push Notifications Console.
  2. Server Code Push Notifications API (server-side).
  3. Push Notification REST API.
  4. Customer Console.

Push Notifications Console

This first option is probably the simplest way to send a Push Notifications once you have installed an app on a device. Select device types, enter the message and send. The Push Notification message should arrive on the registered device instantly. 

PN_console.png

Push Notifications console.

Server Code Push Notifications API (server-side)

With Push Notifications Console, you can quickly test sending a message. With the Server Code option, you can write server-side logic before or after the message is sent. Server Code script allows you to write server-side app logic using JavaScript, including API for sending push messages. For example, let’s say you want to query the database before sending a message. A script can also be scheduled to run periodically, for example, once in 24 hours. Using the previous example, the script can query the database for inventory. If the inventory is low, the script can send a Push Notification message to a manager, notifying him or her that the inventory is low.

The following Server Code scripts send a Push Notification message:

var pushApiKey = "72082f44-4798-4d69-9c35-74981646ec92";
Apperyio.PN.send(pushApiKey, {"message": "Hey there - inventory is low!"});

It takes one line of code to send a Push Notification message.

Push Notification REST API

Another option is to use Push Notifications REST API.

A curl command to send a message:

curl -X POST
-H "X-Appery-Push-API-Key: 72082f44-4798-4d69-9c35-74981646ec92"
-H "Content-Type: application/json"
-d '{
  "payload":{
     "message":"Hey there!"
   },
  "status":"sent"
   }'
https://api.appery.io/rest/push/msg

For example, this API can be used from API Express when using the REST component. In the future, we will be adding native integration for Push Notifications in API Express. This will allow you to drop a component into the service flow to send a message.

Customer Console

The last option is to send a Push Notifications message from the Customer Console. The Customer Console is useful when you are building an app for a customer and want the customer to be able to edit the app data (in the database) and send Push Notification messages. For example, let’s say you build an app for a store owner and she wants to send a Push Notification message with a coupon to all users. She can login into the app’s Customer Console and send a Push Notification.

Summary

With Appery.io built-in Push Notifications component, sending messages to all users (devices) or targeted messages is simple and flexible. Check out our YouTube channel to learn more.

push

Published at DZone with permission of Max Katz, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • How to Submit a Post to DZone
  • How To Check Docker Images for Vulnerabilities
  • The Quest for REST
  • API Design Patterns Review

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: