Reputation: 43
[Please read carefully before answering.]
I'm struggling to resolve notifications for more than a week and still, it's halfway resolved.
Here is the provider config:
const apn = require('apn'); // version: "apn": "^2.2.0"
const iosOptions = {
token: {
key: path.resolve('./lib/AuthK*********.p8'),
keyId: '*********',
teamId: '*******'
},
production: true
};
const apnProvider = new apn.Provider(iosOptions);
const apnNotification = new apn.Notification();
apnNotification.sound = 'default';
apnNotification.title = 'Hello';
apnNotification.body = 'Hello message';
apnNotification.aps.threadId = 'thread_id';
apnNotification.topic = topic;
apnNotification.payload = payload;
return apnProvider.send(apnNotification, token)
Is there anything wrong with the config?
Error message: reason: 'TopicDisallowed'
Please help if someone knows the solution.
Upvotes: 2
Views: 5065
Reputation: 43
Finally, I've resolved it by removing the package and writing a custom notification sender with Apple's official documentation for https://api.push.apple.com.
Upvotes: 0