Friday 19 May 2017

FCM send push to device group returns 'messaging/invalid-recipient'

Hi I am trying to use Firebase Cloud Functions to send push notifications via FCM to a device group like this:

// Send a message to the device group corresponding to the provided
// notification key.
admin.messaging().sendToDeviceGroup(notification_key, payload)
.then(function(response) {
// See the MessagingDeviceGroupResponse reference documentation for
// the contents of response.
    console.log("Successfully sent message:", response);
})
.catch(function(error) {
   console.log("Error sending message:", error);
   });
}

The console returns me :

{ code: 'messaging/invalid-recipient',
 message: 'Notification key provided to sendToDeviceGroup() is invalid.' } }

The notification_key I use is : const notificationKey = "APA91bG09Lqs...rb48dE5hs"; and is the notification_key that gets returned in the response when I create a device group



via John

No comments:

Post a Comment