This is something new i am asking as i haven\'t got it any answers for it on SO.
I am using Amazon SNS Push for sending push to my registered devices, everything is
From a Lambda function (Node.js) the call should be:
exports.handler = function(event, context) {
var params = {
'TargetArn' : $EndpointArn,
'MessageStructure' : 'json',
'Message' : JSON.stringify({
'default' : $title,
'APNS' : JSON.stringify({
'aps' : {
'alert' : $title,
'badge' : '0',
'sound' : 'default'
},
'id' : '123',
's' : 'section',
}),
'APNS_SANDBOX' : JSON.stringify({
'aps' : {
'alert' : $title,
'badge' : '0',
'sound' : 'default'
},
'id' : '123',
's' : 'section',
})
})
};
var sns = new AWS.SNS({apiVersion: '2010-03-31', region: 'us-east-1' });
sns.publish(params, function(err, data) {
if (err) {
// Error
context.fail(err);
}
else {
// Success
context.succeed();
}
});
}
You can simplify by specifying only one protocol: APNS
or APNS_SANDBOX
.