node-onesignal

0.3.1 • Public • Published

OneSignal SDK for Node.js Build Status

This is an unofficial Node.js SDK for the OneSignal Push Notification Service, which wraps their REST API.

Basic Usage

// 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'
});

API

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!).

Contributing

Just open a PR and include tests. Any help is greatly appreciated!

Package Sidebar

Install

npm i node-onesignal

Weekly Downloads

31

Version

0.3.1

License

MIT

Last publish

Collaborators

  • jamesdixon