I have a small issue. I am trying to test my push notification feature but I can't figure it out. I set up a webRTC page that I'm using to send the notification (I don't own 2 IOS devices). All the certificates/keys were generated using fastlane actions (match and pem). I am aware I'm using a production feature for the apnOptions and I generated the correct certificates. When I write some gibberish on the key or teamID, I get errors so that means my certificate should be alright. The bundle identifier is exactly the one that appears on the developer Apple page.enter code here
Here are my token and my notification:
var apnProvider = new apn.Provider({
token: {
key: "cert/key.p8",
keyId: "#",
teamId: "#"
},
production: true
});
if (deviceToken) {
if (platform === 'ios') {
let note = new apn.Notification()
note.alert = 'Hello World'
note = Object.assign(note, {
// Expires 1 hour from now.
expiry: Math.floor(Date.now() / 1000) + 3600,
badge: 3,
payload: payloadBody,
topic: "org.#.#"
})
apnProvider.send(note, deviceToken).then((result) => {
console.log('APNPROVIDER RESULT', `PLATFORM: ${platform}, RESULT:${JSON.stringify(result)}`)
})
Thank you very much for your help!
I found out in the end. It turned out that if I use a voip bundle I need to add at the end of the bundle .voip. So, a bundle would look something like org.test.Test.voip. I'm done..