This is an unofficial wrapper/client for the OneSignal notification API that runs on Node.JS. A list of selected wrappers for different languages and environments is available at the Developer site's Libraries page.
$ npm install @palmabit/onesignal-notification
const OnesignalNotificationApi = require('@palmabit/onesignal-notification')
const oneSignal = new OnesignalNotificationApi('MY-REST-KEY', 'APP-ID')
const message = {
it: 'Some message',
en: 'Some message'
}
oneSignal.sendToAll(message, null, null, (err, res) => {
console.log(err)
console.log(res)
})
const OnesignalNotificationApi = require('@palmabit/onesignal-notification')
const oneSignal = new OnesignalNotificationApi('MY-REST-KEY', 'APP-ID')
oneSignal.sendToAll(message, options, action, (err, res) => {
console.log(err)
console.log(res)
})
const OnesignalNotificationApi = require('@palmabit/onesignal-notification')
const oneSignal = new OnesignalNotificationApi('MY-REST-KEY', 'APP-ID')
oneSignal.sendToSegments(message, ['segment1', 'segment2], (err, res) => {
console.log(err)
console.log(res)
})
//Coming Soon
npm test
npm run coverage
See something you think can be improved? Open an issue or clone the project and send a pull request with your changes.