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

[Bug]: createNofitication returning { id: '', errors: {} }

Open Gudaites opened this issue 1 year ago • 2 comments
trafficstars

What happened?

I have some cases of sending push notifications where I cannot identify the errors and the createNotification function does not return any information about the error.

Steps to reproduce?

version 2.0.1-beta2

I create the object with the OneSignalNotification type

and send with await this.oneSignalService.createNotification(notificationsBody);

when sent successfully it returns the right information but there is no error, I am just receiving errors: {}

What did you expect to happen?

I hope that at least I can get back to the error that happened

Relevant log output

No response

Code of Conduct

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

Gudaites avatar Dec 05 '23 17:12 Gudaites

I had the same problem, my example request was as follows

    const not = new OneSignal.Notification();
    not.app_id = this.appId;
    not.name = 'Test notification name ';
    not.headings = {

      'en': 'Test Notification title',
    };
    not.contents = {
      'en': 'Test Notification content',

    };
    not.target_channel = 'push';

    not.include_aliases = {
      'external_id': ['1', '2'],
    }

    const res = await this.client.createNotification(not);

I noticed that the external_id value in the include_aliases value was not included in the sent http request. If the body value you posted is similar, I fixed it and created a pull request

GizemSever avatar Jan 03 '24 16:01 GizemSever

Hi everyone, thank you for reporting and for your patience.

We recently released an alpha version of our latest user model API: Release 5.0.0-alpha-01 that addresses this and other issues.

Please read the release description for how to get started, and we appreciate any early feedback on this release.

nan-li avatar May 09 '24 19:05 nan-li