Skip to content

Instantly share code, notes, and snippets.

@indatawetrust
Created January 9, 2019 09:36
Show Gist options
  • Select an option

  • Save indatawetrust/760031438696643b1e64e741b8bd7ae2 to your computer and use it in GitHub Desktop.

Select an option

Save indatawetrust/760031438696643b1e64e741b8bd7ae2 to your computer and use it in GitHub Desktop.
web-push with nodejs
const OneSignal = require('onesignal-node');
const client = new OneSignal.Client({
app: {
appAuthKey: '*',
appId: '*',
},
});
const notification = new OneSignal.Notification({
contents: {
tr: '',
en: '',
},
filters: [],
});
notification.postBody['included_segments'] = ['Active Users'];
notification.postBody['web_url'] = '#';
notification.postBody['big_picture'] = '#'
notification.postBody["headings"] = {"en": '', "tr": ''};
client.sendNotification(notification, function(
err,
httpResponse,
data,
) {
if (err) {
} else {
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment