0.1.2 • Published 9 years ago

onesignal v0.1.2

Weekly downloads
157
License
MIT
Repository
github
Last release
9 years ago

One Signal

npm npm

Installation

npm install onesignal --save

Usage

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

OneSignal(apiKey, appId, sandbox)

One Signal Client

ParamTypeDescription
apiKeyStringREST API Key
appIdStringOneSignal App ID
sandboxBooleanuse 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.

Returns: Promise - resolve with OneSignal ID

ParamTypeDescription
identifierStringthe device token
osTypeStringios, android

editDevice(oneSignalId, newIdentifier) ⇒ Promise

Update the identifier of an existing device.

ParamTypeDescription
oneSignalIdStringthe one signal device id
newIdentifierStringthe new device token

createNotification(message, data, oneSignalIds) ⇒ Promise

Create and send a notification.

ParamTypeDescription
messageStringthe notification message
dataObjectany custom data
oneSignalIdsArraya list of OneSignal devices ids

License

This project is under the MIT license.