Advanced Apps
December 12, 2022

Sending Programmatic Push Notifications

By 
Eamonn Gogan
Updated 
December 12, 2022
Advanced Apps
December 12, 2022

Sending Programmatic Push Notifications

By 
Eamonn Gogan
Updated 
December 12, 2022
Sending Programmatic Push Notifications

GoNative provides an end-to-end solution that enables you to deploy web-based applications as native iOS and Android apps. Learn more

Advanced Apps
  —  
December 12, 2022
Updated on 
December 12, 2022

Sending Programmatic Push Notifications

By 
Eamonn Gogan
Updated 
December 12, 2022
Sending Programmatic Push Notifications
Updated on 
December 12, 2022
Advanced Apps
  —  
August 31, 2022
August 31, 2022

Sending Programmatic Push Notifications

By 
Eamonn Gogan
Updated 

GoNative provides an end-to-end solution that enables you to deploy web-based applications as native iOS and Android apps. Learn more

Eamonn Gogan
Eamonn Gogan
Customer Success @ GoNative
Connect

Sending programmatic push notifications can help businesses and organizations provide timely, personalized messages to individual users. Sending these types of messages improve user engagement and customer satisfaction. These types of notifications include re-engagement notifications based on a user's prior app activity, promotion notifications based on a user's product preferences, and alerts for when an event occurs such as payment receipt or package delivery.

Example use cases for programmatic notifications include:

  • A favorite product that is back in stock
  • An order that has been shipped or ready for pickup
  • A property that meets your search requirements has been listed
  • A payment that has been received
  • A job shift that is available to accept
  • An article from a subscribed journalist that has been posted

Programmatic notifications can be sent to individuals or groups of users based on the corresponding trigger conditions on your web platform.

First Step: Identify your users

Option 1 - Map device to user

Associate the user’s device with their account on your platform using the OneSignal User ID.

In this option you are managing the relationship between mobile devices subscribed within OneSignal and users on your platform. You will then send programmatic notifications to a specific device.

Option 2 - Map user to device

Associate the user’s account on your platform with their device on the OneSignal platform using OneSignal’s External User ID function. Account numbers or email addresses are examples of External IDs that can be added to the device record within the OneSignal platform.

In this option you let the OneSignal platform manage the relationship between users and devices. You will then send programmatic notifications to a specific user.

Send notifications via API

Call the OneSignal REST API to send a notification. Depending on how you are identifying users as discussed above you specify either “include_player_ids” (OneSignal User IDs) or “include_external_user_ids” (External User IDs from your platform).

POST /api/v1/notifications {
   "app id": "b2f7966-2222-11e4-bed1-df8f05be55ba",
   "include_player_ids": ["1dd608f2-c6a1-11e3-851d-000c2940e62c"],
   "headings": {"en": "The Item in still in your cart"},
   "contents": {"en": "Payment for Item has not been processed"},
}

POST /api/v1/notifications {
   "app id": "b2f7966-2222-11e4-bed1-df8f05be55ba",
   "include_external_user_ids": ["[email protected]"],
   "headings": {"en": "Your package has arrived"},
   "contents": {"en": "Order #4467 has been delivered!"},
}

POST /api/v1/notifications {
   "app id": "b2f7966-2222-11e4-bed1-df8f05be55ba",
   "include_external_user_ids": ["[email protected]"],
   "headings": {"en": "Up to 40% off running sneakers"},
   "contents": {"en": "Don’t miss out on 40% off on any purchase of your favorite running sneakers!"},
}

Engagement

POST /api/v1/notifications {
   "app id": "b2f7966-2222-11e4-bed1-df8f05be55ba",
   "include_player_ids": ["1dd608f2-c6a1-11e3-851d-000c2940e62c"],
   "headings": {"en": "The Item in still in your cart"},
   "contents": {"en": "Payment for Item has not been processed"},
}

Alerts

POST /api/v1/notifications {
   "app id": "b2f7966-2222-11e4-bed1-df8f05be55ba",
   "include_external_user_ids": ["[email protected]"],
   "headings": {"en": "Your package has arrived"},
   "contents": {"en": "Order #4467 has been delivered!"},
}

Promotions

POST /api/v1/notifications {
   "app id": "b2f7966-2222-11e4-bed1-df8f05be55ba",
   "include_external_user_ids": ["[email protected]"],
   "headings": {"en": "Up to 40% off running sneakers"},
   "contents": {"en": "Don’t miss out on 40% off on any purchase of your favorite running sneakers!"},
}

Segments as an additional tool to target users

Data Filters

Data Filters are pre-set and do not require customization. OneSignal provides many filters that track the events or attributes of a user's device. For example, some popular filters include: First Session, Session Count, Amount Spent, Purchased Item, and Subscriptions. You can also combine filters to form advanced, highly precise user targeting. 

Custom Segments

Custom Segments are groups of users based on customizable data analytics and function as the most precise way to target large groups of devices. With OneSignal, you can use Custom Tags to specify segments you want to target as well as which segments you don't want to receive the notification. Once a user creates a custom segment, OneSignal automatically adds new users who fulfill the segment's parameters.

Documentation References

Personalized Push
Programmatic Notifications
Send to Specific Devices

Learn more using OneSignal and GoNative here.

Convert your website into a native app

Guaranteed Acceptance by Apple App Store and Google Play Store. Enter any website URL to build a native iOS and Android mobile app.

Try it out
Convert your website into a native app

*DISCLAIMER: This content is provided solely for informational purposes. It is not exhaustive and may not be relevant for your requirements. While we have obtained and compiled this information from sources we believe to be reliable, we cannot and do not guarantee its accuracy. This content is not to be considered professional advice and does not form a professional relationship of any kind between you and GoNative.io LLC or its affiliates. GoNative.io is the industry-leading end-to-end solution for developing, publishing, and maintaining native mobile apps for iOS and Android powered by web content. When considering any technology vendor we recommend  that you conduct detailed research and “read the fine print”  before using their services.*

Want to learn more about OneSignal? Book a demo here.