Advanced Apps
September 29, 2022

Sending Programmatic Push Notifications

By 
Eamonn Gogan
Updated 
September 29, 2022
Advanced Apps
September 29, 2022

Sending Programmatic Push Notifications

By 
Eamonn Gogan
Updated 
September 29, 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
  —  
September 29, 2022
Updated on 
September 29, 2022

Sending Programmatic Push Notifications

By 
Eamonn Gogan
Updated 
September 29, 2022
Sending Programmatic Push Notifications
Updated on 
September 29, 2022
Advanced Apps
  —  
August 31, 2022
April 6, 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

Programmatic push notifications provide timely, personalized messages that improve user engagement and customer satisfaction.

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 about 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
Eamonn Gogan
Eamonn Gogan
Customer Success @ GoNative
Connect