Skip to content

Instantly share code, notes, and snippets.

@craigp
Forked from brianleroux/wtf-sns-apns.js
Created May 29, 2019 05:03
Show Gist options
  • Save craigp/97c07b12ecd99fb9960310285ca9f92b to your computer and use it in GitHub Desktop.
Save craigp/97c07b12ecd99fb9960310285ca9f92b to your computer and use it in GitHub Desktop.
Send a silent push notification to APNS with AWS SNS.
sns.publish({
TargetArn: device.arn,
MessageStructure: 'json',
Message: JSON.stringify({
default: 'you will never see this muah!',
APNS_SANDBOX: JSON.stringify({
aps: {
'alert': '',
'content-available': 1
},
'event-category': eventname
})
})
},
function __notifiedAPNS(err, data) {
console.log(err, JSON.stringify(data, null, 2))
callback()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment