-2

I cant find any information regarding how to target just the app, I don't have any topics and I don't want to merely target a single user.

The documentation states that a to is optional but I just receive a missingregistration error:

This parameter specifies the recipient of a message.

The value can be a device's registration token, a device group's notification key, or a single topic (prefixed with /topics/). To send to multiple topics, use the condition parameter.

This is my current setup:

1

Removing the to field just gives me an error and the message is merely to.

AL.
  • 36,815
  • 10
  • 142
  • 281

2 Answers2

0

There is currently no way to send to a specific app (or to any user segments) when using the FCM REST API (see here). This option is only available when sending the notifications through the Firebase Notifications Console.

The to parameter is considered optional, but in reality, you need to have either to or registration_ids to specify the target for your message payload. So not having a valid to or registration_ids is returning you a MissingRegistration error as expected.

Community
  • 1
  • 1
AL.
  • 36,815
  • 10
  • 142
  • 281
  • So is there a way of sending data via a notification that will register on the app even if the app is closed? Thats why I'm looking into this solution – James Green Apr 25 '17 at 10:37
  • Hey James. I'm not sure I follow. Your use-case is possible for FCM (sending messages even if the app is closed could be a bit broad -- see my answer [here](http://stackoverflow.com/a/39505298/4625829)). It's just that you need to store the registration tokens first, before being able to send a message to the users. – AL. Apr 25 '17 at 10:42
0

@James you can send notifications to user segments (targeting properties & events like you can on the user console). Through postman you'll have to store FCM/GCM registration ids (push tokens) yourself or use FCM topics to subscribe users

Aditi
  • 389
  • 4
  • 13