User specific push notification in MFP

0 votes
Hi All,

I am trying to send a user specific push notification in IBM MFP build and getting below response

{
   "isSuccessful": true,
   "result": "No subscription found for user :: UX_G_A"
}

I am able to get broadcast messages in device, but not able to get user specific messages. Can anyone help on this?

Thanks
, 222 views Last updated : Dec 13, 2017

1 Answer

0 votes

notifications can be either polled from the back-end system, or pushed by one. In this example, a submitNotifications() adapter function is invoked by a back-end system as an external API to send notifications.

function submitNotification(userId, notificationText) {
	var userSubscription = WL.Server.getUserNotificationSubscription('PushAdapter.PushEventSource', userId);
	if (userSubscription === null) {
		return { result: "No subscription found for user :: " + userId };
	}
	var badgeDigit = 1;
	var notification = WL.Server.createDefaultNotification(notificationText, badgeDigit, {custom:"data"});
        WL.Server.notifyAllDevices(userSubscription, notification);
return {
		result: "Notification sent to user :: " + userId
	};
}
For more go to the following link
https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/6.3/notifications/push-notifications-hybrid-applications/
answered Apr 23 by muneshs16

Related questions