jlcvp / fcm-node

A Node.JS simple interface to Google's Firebase Cloud Messaging (FCM) for Android & iOS & Web Notification and data push
MIT License
125 stars 46 forks source link

FCM Failed registration id #32

Closed devesh2605 closed 6 years ago

devesh2605 commented 6 years ago

fcm.send(message, function(err, response) { if (err) { let errorData = JSON.parse(err); let statusData = { 'success' : errorData.success, 'failure' : errorData.failure } updateStatus(pushId, statusData.success, statusData.failure); logger.error = 'Notification Not Sent To Few Users'; res.status(400).json(statusData); } else { let resData = JSON.parse(response); let statusData = { 'success' : resData.success, 'failure' : resData.failure } updateStatus(pushId, statusData.success, statusData.failure); logger.info(response); res.status(200).json(response); } }); Is there any way to find out the list of registration_id's for which the notification is failed!

jlcvp commented 6 years ago

The official FCM Documentation tell us that if there's any failure, the field failed_registration_ids is set with a list of failed ones.

The response message will be like this:

{
  "success":1,
  "failure":2,
  "failed_registration_ids":[
     "regId1",
     "regId2"
  ]
}