Node wrapper for the One Signal API
npm install node-onesignal``js
// require the module
const OneSignalClient = require('node-onesignal');
// create a new clinet
const client = new OneSignalClient([YOUR APP ID], [YOUR REST API KEY]);
// send a notification
client.sendNotification('test notification', {
included_segments: 'all'
});
`
OneSignalClient(appId, restApiKey)appId
* _(string, required)_ - your OneSignal App ID
* restApiKey_(string, required)_ - your OneSignal REST API Key
sendNotification(message, options)message
* _(string/object, required)_ - the content of your message. Note: when passing an object, please see the OneSignal documentation for details on the format.
* options`_(object)_ - OneSignal options. Please see the OneSignal documentation.
As you can see, this SDK does not implement all of the methods available through the OneSignal REST API. If there are other methods you require, please open an issue or feel free to create a PR (with tests!).