I recently implemented FCM messaging as a means to perform push notifications to a Cordova based application. My system sends 100-1000 push notifications a day to individual users.
I'm contacting the FCM Messaging service using the FcmSharp library. https://github.com/bytefish/FcmSharp which as far as i can tell is using the FCM HTTP v1 API.
$"https://fcm.googleapis.com/v1/projects/{settings.Project}/messages:send"
So far it seem to be running ok. Yet i am continuously getting errors logged from the service that sends the messages to FCM indicating that there was a failure.
"error": {
"code": 503,
"message": "The service is currently unavailable.",
"errors": [
{
"message": "The service is currently unavailable.",
"domain": "global",
"reason": "backendError"
}
],
"status": "UNAVAILABLE"
}
The message i am sending (to FCMSharp) also appears to be formatted correctly:
message: {
"validate_only":false,
"message":{
"data":null,
"notification":{
"title":"[MyTitle]",
"body":"[MyBody]"
},
"android":{
"collapse_key":null,
"priority":"HIGH",
"ttl":"0s",
"restricted_package_name":null,
"data":null,
"notification":{
"title":null,
"body":null,
"icon":null,
"color":null,
"sound":"default",
"tag":null,
"click_action":null,
"body_loc_key":null,
"body_loc_args":null,
"title_loc_key":null,
"title_loc_args":null
}
},
"webpush":null,
"apns":{
"headers":null,
"payload":{
"aps":{
"alert":null,
"badge":0,
"sound":"default",
"content-available":0,
"mutable-content":0,
"category":null,
"thread-id":null
}
}
},
"token":"MyValidToken",
"topic":null,
"condition":null
}
As far as i can tell the service is not using the 'staging' environment mentioned in the post below.
I am getting hundreds of these UNAVAILABLE
answers a day, sometimes for hours on end. Messages are still getting through so i'm not sure i'm getting blacklisted. I don't see anything in their documentation to state if i'm using the wrong URL or hitting some sort of throttling limit.
This was because the FcmSharp service didn't implement the undocumented exponential back-off feature that is required by some Google Apis.
See the GitHub thread for more info.