zeyneloz / onesignal-node

A Node.js Library for OneSignal push notification service
MIT License
207 stars 48 forks source link

One invalid player id cancels whole operation #35

Closed HaroldBeyer closed 4 years ago

HaroldBeyer commented 4 years ago

Hello, i am trying to send an notification with an array of include_player_id and if a single one of the array is invalid, it cancels my whole notification. I.E: my data gets to be

data: {"id":"","recipients":0,"errors":{"invalid_player_ids":["XXXXXXX-XXXXX-XXX-XXXX-XXXXXX"]}}

and it doesn't sends to the other valid player ids.

Here's my code to the creation of the notification

const notification = new OneSignal.Notification({
    contents: {
      en: message,
    },
    data: data,
    'include_player_ids': playersId && playersId.length > 0 ? playersId.filter((v, i, a) => a.indexOf(v) === i) : playersId,
  });
HaroldBeyer commented 4 years ago

Closing issue. Reason: i have found that i have not set my appId correctly thus denying sending data to any player, subscribed or not.

dancherb commented 3 years ago

I'm currently experiencing this issue - the worst part is that the error doesn't return which player id's are invalid, it just returns all of them - and all of them look valid or were valid at some point.

Incorrect player_id format in include_player_ids (not a valid UUID): ["b767d517-40cd-4ff3-98bb-5d4e1f7109c5", "d269832b-cac6-4d2d-bdfb-e01279f5079a", "c29a973a-cc3b-478b-8e82-ad71c19ef6d3"]