-1

I make a request to https://fcm.googleapis.com/fcm/send with the following json data:

{
    "to": "/topics/push_topic",

    "data" : {
        "language": "tr,en_us",
        "ticker": "...",
        "tickerEnglish": "...",
        "body": "...",
    }
}

The response I receive is the following (The message is sent successfully):

{
    "message_id": xxxxxxxxxxxxx
}

But according to the documentation, I am supposed to receive a response like the following:

{
    "multicast_id": 216,
    "success": 3,
    "failure": 3,
    "canonical_ids": 1,
    "results": [
        { "message_id": "1:0408" },
        { "error": "Unavailable" },
        { "error": "InvalidRegistration" },
        { "message_id": "1:1516" },
        { "message_id": "1:2342", "registration_id": "32" },
        { "error": "NotRegistered"}
     ]
}    

So, why can't I see success and failure variables in my response? Is that because I send the message to a topic?

Thanks.

yrazlik
  • 10,411
  • 33
  • 99
  • 165

1 Answers1

1

This is the expected response when sending to a topic.

The sample response with multiple results is for when you are using the registration_ids parameter when sending the message payload.

AL.
  • 36,815
  • 10
  • 142
  • 281
  • @bigO Fairly sure the documentation shows what I stated above. Can you point me to the documentation you were referring to? – AL. Mar 27 '17 at 01:27
  • thanks for the answer. So it looks like there is no way to see how many people received the message and how many read it right? I was referring to this part of the documentation: https://firebase.google.com/docs/cloud-messaging/server#response – yrazlik Mar 27 '17 at 05:40
  • 1
    Not when using topics. If you're using the registration tokens (`to` for single token, `registration_ids` for multiple) when sending the message, you can make use of the [Diagnostics and Statistics page](http://stackoverflow.com/a/40341195/4625829) to see if it was successfully sent to the device. For the "*how many read it*" part, I guess you could implement [Delivery Receipts](http://stackoverflow.com/a/40110224/4625829). – AL. Mar 27 '17 at 05:48
  • 1
    Yup. The documentation is referring to use `registration_ids` to get that format of response. – AL. Mar 27 '17 at 05:50