Package Exports
- @jonathangomz/onesignal-client
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@jonathangomz/onesignal-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
OneSignal Client for Nodejs
A OneSignal client that implement some of the endpoints from the OneSignal API
Docs
constructor({ authKey, restApiKey, appId })
Creates a new OneSignal client.
const client = new OneSignal({
authKey: process.env.AUTH_KEY,
restApiKey: process.env.REST_API_KEY,
appId: process.env.APP_ID,
});
getApp()
View the details of a single OneSignal app.
client.getApp()
sendNotification(message options?)
Sends notifications to your users.
const opt = {
headings: {
en: 'Example',
es: 'Ejemplo',
},
included_segments: [
'Test',
]
};
const message = {
en: 'This is an example',
es: 'Este es un ejemplo',
}
client.sendNotification(message, opt);
cancelNotification(notification_id)
Stop a scheduled or currently outgoing notification.
client.cancelNotification('fd1723c6-bfaf-4f53-b4f4-0408ff43e18a');
viewNotifications(options?)
View the details of multiple notifications.
client.viewNotifications({ limit: 5 });
viewNotification(notification_id)
View the details of a single notification and outcomes associated with it.
client.viewNotification('fd1723c6-bfaf-4f53-b4f4-0408ff43e18a');