scoutforpets / node-onesignal

Node.js wrapper for the One Signal API
MIT License
34 stars 11 forks source link

No notification being received. #8

Open AdamCollins opened 7 years ago

AdamCollins commented 7 years ago

I am able to push notifications to my machine from OneSignal.com, however I do not receive them when I call the sendNotification function.

console.log('sending');
const OneSignalClient = require('node-onesignal').default;
const client = new OneSignalClient('1111111', '222222');
client.sendNotification('test notification', {
    included_segments: 'all'
});

The 'sending' string is logged but I do not receive any notifications, errors, or send requests on onesignal.com

My node version is 6.110

ghost commented 7 years ago

Try:

client.sendNotification('test notification', {
    included_segments: 'all'
}).catch(console.log)

You should see the error.

ghost commented 6 years ago

Having the same issue here... And it's not printing anything to the console when i add the catch

EDIT: I just found the solution! The "included_segments" attribute is case sensitive, which means you simply have to change included_segments: 'all' to included_segments: 'All'