Skip to content

A Wrapper for OneSignal Push Notification Delivery for Node.js. Provides the minimal functionality to send notifications for iOS and Android.

License

Notifications You must be signed in to change notification settings

faressoft/onesignal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OneSignal

npm npm

OneSignal Logo

A Wrapper for OneSignal Push Notification Delivery for Node.js. Provides the minimal functionality to send notifications for iOS and Android.

Installation

npm install onesignal --save

Usage

// Create a client object
var oneSignal = require('onesignal')('[apiKey]', '[appId]', true);

OneSignal(apiKey, appId, sandbox)

OneSignal Client

Param Type Description
apiKey String REST API Key
appId String OneSignal App ID
sandbox Boolean use the sandbox certificate for iOS (default: false)

Methods

addDevice(identifier, osType)Promise

Register a new device and its identifier to OneSignal and get OneSignal ID

editDevice(oneSignalId, newIdentifier)Promise

Update the identifier of an existing device

createNotification(message, data, oneSignalIds)Promise

Create and send a notification

addDevice(identifier, osType) ⇒ Promise

Register a new device and its identifier to OneSignal and get OneSignal ID.

Returns: Promise - resolve with OneSignal ID

Param Type Description
identifier String the device token
osType String ios, android

editDevice(oneSignalId, newIdentifier) ⇒ Promise

Update the identifier of an existing device.

Param Type Description
oneSignalId String the onesignal device id
newIdentifier String the new device token

createNotification(message, data, oneSignalIds) ⇒ Promise

Create and send a notification.

Param Type Description
message String the notification message
data Object any custom data
oneSignalIds Array a list of OneSignal devices ids

License

This project is under the MIT license.

About

A Wrapper for OneSignal Push Notification Delivery for Node.js. Provides the minimal functionality to send notifications for iOS and Android.

Resources

License

Stars

Watchers

Forks

Packages

No packages published