Before I’ve been used onesignal-node-sdk in that way to specify targeting users.
It used to work in previous sdk version
<code> const app = await this.oneSignalService.getApp(
process.env["ONESIGNAL_APP_ID"]
);
const notificationOptions = new OneSignal.Notification();
notificationOptions.app_id = app.id!;
notificationOptions.name = NOTIFICATION.NAME;
notificationOptions.is_ios = true;
notificationOptions.is_android = true;
notificationOptions.include_player_ids = players;
notificationOptions.headings = headings;
notificationOptions.contents = contents;
const notification = await this.oneSignalService.createNotification(
notificationOptions
);
```
I'm passing array of users which need to receive notifications in that way using `notificationOptions.include_player_ids = players;`
After onesignal-node-sdk new release 5.0.0 that property `notificationOptions.include_player_ids` seems was removed.
OneSignal official docs on it website and npm is deprecated. The only one current is on github repo. But I didn't found there the way how to manage that case.
How am I able to make it now to targeting users notifications?
</code>
<code> const app = await this.oneSignalService.getApp(
process.env["ONESIGNAL_APP_ID"]
);
const notificationOptions = new OneSignal.Notification();
notificationOptions.app_id = app.id!;
notificationOptions.name = NOTIFICATION.NAME;
notificationOptions.is_ios = true;
notificationOptions.is_android = true;
notificationOptions.include_player_ids = players;
notificationOptions.headings = headings;
notificationOptions.contents = contents;
const notification = await this.oneSignalService.createNotification(
notificationOptions
);
```
I'm passing array of users which need to receive notifications in that way using `notificationOptions.include_player_ids = players;`
After onesignal-node-sdk new release 5.0.0 that property `notificationOptions.include_player_ids` seems was removed.
OneSignal official docs on it website and npm is deprecated. The only one current is on github repo. But I didn't found there the way how to manage that case.
How am I able to make it now to targeting users notifications?
</code>
const app = await this.oneSignalService.getApp(
process.env["ONESIGNAL_APP_ID"]
);
const notificationOptions = new OneSignal.Notification();
notificationOptions.app_id = app.id!;
notificationOptions.name = NOTIFICATION.NAME;
notificationOptions.is_ios = true;
notificationOptions.is_android = true;
notificationOptions.include_player_ids = players;
notificationOptions.headings = headings;
notificationOptions.contents = contents;
const notification = await this.oneSignalService.createNotification(
notificationOptions
);
```
I'm passing array of users which need to receive notifications in that way using `notificationOptions.include_player_ids = players;`
After onesignal-node-sdk new release 5.0.0 that property `notificationOptions.include_player_ids` seems was removed.
OneSignal official docs on it website and npm is deprecated. The only one current is on github repo. But I didn't found there the way how to manage that case.
How am I able to make it now to targeting users notifications?
New contributor
Максим Горобець is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.