https://github.com/scoutforpets/node-onesignal
Node.js wrapper for the One Signal API
https://github.com/scoutforpets/node-onesignal
nodejs onesignal push-notifications
Last synced: 9 months ago
JSON representation
Node.js wrapper for the One Signal API
- Host: GitHub
- URL: https://github.com/scoutforpets/node-onesignal
- Owner: scoutforpets
- License: mit
- Created: 2016-07-09T22:06:42.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-01-28T17:27:44.000Z (almost 8 years ago)
- Last Synced: 2025-03-24T20:11:14.527Z (10 months ago)
- Topics: nodejs, onesignal, push-notifications
- Language: JavaScript
- Size: 12.7 KB
- Stars: 34
- Watchers: 2
- Forks: 11
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OneSignal SDK for Node.js [](https://travis-ci.org/scoutforpets/node-onesignal)
This is an unofficial Node.js SDK for the [OneSignal Push Notification Service](https://onesignal.com/), which wraps their [REST API](https://documentation.onesignal.com/docs/server-api-overview).
## Basic Usage
```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'
});
```
## 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](https://documentation.onesignal.com/docs/notifications-create-notification) for details on the format.
* `options`_(object)_ - OneSignal options. Please see the [OneSignal documentation](https://documentation.onesignal.com/docs/notifications-create-notification).
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!