Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
30
rated 0 times [  35] [ 5]  / answers: 1 / hits: 15430  / 8 Years ago, mon, september 5, 2016, 12:00:00

I am able to send the notification to single device, topics and user segment from Firebase Console.



I want to send the push notification to a user segment. I searched a lot but I'm only getting script to send notification to Single User or Topic not to user segments.



I tried the below code



var client = new RestClient(https://fcm.googleapis.com/fcm/send);
var request = new RestRequest(Method.POST);
request.AddHeader(content-type, application/json);
request.AddHeader(authorization, key=mykey);
request.AddParameter(application/json, nn{to : user-segment-name,nnotification : {n body : test message,n title : Portugal vs. Denmark\n },n priority:high\n}, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Response.Write(response.Content);


And I am getting the response below



{multicast_id:5837227475989925972,success:0,failure:1,canonical_ids:0,results:[{error:InvalidRegistration}]}

More From » ios

 Answers
9

Unfortunately, it seems that sending to user segments programatically still isn't possible. Reference here:



But you won't be able to



  1. send notifications to a Firebase User Identifier (UID) and



  2. send notifications to user segments (targeting properties & events like you can on the user console).





It's only possible via the Firebase Console.


[#60808] Friday, September 2, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dominickmackenziet

Total Points: 583
Total Questions: 101
Total Answers: 117

Location: Saint Lucia
Member since Wed, Feb 8, 2023
1 Year ago
dominickmackenziet questions
Wed, Apr 7, 21, 00:00, 3 Years ago
Fri, Feb 12, 21, 00:00, 3 Years ago
;