Can't pass aps parameter in body request of payload FCM?

Viewed 1165

click here to check postman request

While migrating GCM to FCM I was using aps parameter in request body of GCM request body but when trying same for FCM its showing InvalidParameters.

Url: https://fcm.googleapis.com/fcm/send

Request:

{
 "notification": {
  "title": "notification title",
  "body": "message body changed  11"
 },
 "data": {
  "mt": "re",
  "offerid": "10562",
  "aps":{"badge":0,"alert":"gauravtest,$20 OFF COUPON","sound":"null.caf"},
  "clpnid": "xxx",
  "custid": "xxx",
  "eoid": "0",
  "pc": "171-2802-8180",
  "ed": "11/08/2017",
  "ag": "",
  "url": "",
  "previewimage": ""


 },
 "to": "xxxx"
}

Response:

{
    "multicast_id": 6282546760147817634,
    "success": 0,
    "failure": 1,
    "canonical_ids": 0,
    "results": [
        {
            "error": "InvalidParameters"
        }
    ]
}
2 Answers

//Simple its very easy use this and you have receive push and can use the extra parameters

"notification": {
  "title": "notification title",
  "body": "message body changed  11"
  "content_available": true,
  "extraParameter_1": "any kind of data ",
  "extraParameter_2": "any kind of data 2"
}
Related