onesignal-node-api icon indicating copy to clipboard operation
onesignal-node-api copied to clipboard

[Bug]: Adding target_channel to the Notification class

Open ricardoribas opened this issue 2 weeks ago • 2 comments
trafficstars

What happened?

It seems there is an issue with the @onesignal/[email protected] in which, if I create a notification class object:

const notification = new Notification();

notification.target_channel = 'email';

client.createNotification(notification);

The target_channel is undefined. I started to have this issue when I was integrating the email target channel.

HOWEVER, if I create the notification with:

client.createNotification({
    ...notification,
    target_channel: 'email
});

It does work. I tried also with the alpha version and the problem is the same.

Steps to reproduce?

1. Install @onesignal/[email protected]
2. Add the following snippet:


const notification = new Notification();

...include subscription_ids or aliases

notification.target_channel = 'email';

client.createNotification(notification);

What did you expect to happen?

Expect to send emails and not push notifications

Relevant log output


Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

ricardoribas avatar Nov 05 '25 13:11 ricardoribas