title: FCM - Programmatically Send Push Notification To User Segments
body: <p>I am able to send the notification to single device, topics and user segment from Firebase Console.</p>
  
  <p>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.</p>
  
  <p>I tried the below code</p>
  
  <pre><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", "\n\n{\"to\" : \"user-segment-name\",\n\"notification\" : {\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); 
  </code></pre>
  
  <p>And I am getting the response below</p>
  
  <pre><code>{"multicast_id":5837227475989925972,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}]}
  </code></pre>