Hi,
I try to send a push from the Web using JavaScript.
Push to send using the "sendPushMessageToAll" function gives well-received.
However, using a push "send Push Message To User" function does not arrive.
What's the problem in the source below?
Answers please.
//username PUSH
function Push_Username(){
var apiKey = '3e3a8b7f8c0d........................................';
var secretKey = '5e7b23f261d6.....................................';
var userName = "hj",
message = "username PUSH By JS",
result ;
App42.initialize(apiKey, secretKey);
var pushNotificationService = new App42Push();
pushNotificationService.sendPushMessageToUser(userName, message, {
success: function(object)
{
var pushNotification = JSON.parse(object);
result = pushNotification.app42.response.push;
console.log("UserName is : " + result.userName);
console.log("Message is : " + result.message)
console.log("Expiry is : " + result.expiry)
},
error: function(error) {
}
});
}