Webhook for Firebase (FCM) Message expiry? - firebase-cloud-messaging

Is there any webhook (event) for message expiry
Ex:
A message is sent to firebase
It will be expired 28 days later (default TTL is 28 days)
Now I want the firebase to call my endpoint. Is this possible in Firebase?

There is nothing built into FCM to call back to your code when a message expires.

Related

Meaning of 200 response/no errors from dry_run request

dry_run can be set so that pushes aren't sent, but that tokens can be validated by FCM.
If the response to a dry_run is 200 and there are no errors, does that guarantee that if dry_run was not set that there is a an app installation on a device that FCM could target with that message.
The only scenario I can think of is if there is a delay:
dry run enabled in request
user uninstalls the app (or some other event which invalidates the token)
FCM returns 200/no error
FCM receives data relayed from the device that the app was uninstalled and token is invalid
Are there other scenarios?
You can validate the FCM token by calling the
(GET) https://iid.googleapis.com/iid/info/YOUR_APP_TOKEN_HERE
[Header] => 'Authorization: key=YOUR_KEY'
Simple and easy.
If token is valid then it will return 200 status code with some more details in JSON format or if it's invalid then status code will be 400 with error detail in JSON format.
Implement this code server side. get token from database (if you are saving token in database) and passin the above URL and it will send you token status whether if it expired or not.

Latency in google web push GCM responses after january 2019

We use the https://github.com/web-push-libs/web-push package. We divide all tokens into groups of 1000 and send web push by sending a post request to GCM for each token with foreach loop. The system is working smoothly for about two years. But the response timeles have been prolonged on the GCM side for about 1 month. As a result of the detailed debuging, the encryption (AuthToken and p256PH) and sending GCM request processes are completed in 3 seconds for all 1000 tokens. But their responces are coming late from GCM side. Therefore, the pushing time has increased and we are experiencing timeout problems.
Is there any kind of problem that you encountered and solved?

stop gcm to send notification on old registration id

Suppose that case when the client app has re-registered with the gcm itself but the server is unaware of this and now the server is sending notification to that particular client what I want is the notification should not be sent with the old registration id. How can this be done?
If your server sends a message to an invalid Registration token, it will probably receive a NotRegistered error response. You should handle this error accordingly by removing the corresponding token. As per the documentaion I linked above:
For all these cases, remove this registration token from the app server and stop using it to send messages.

The behaviour of receiving request with expired api_key in Moqui

What is the system behavior of receiving a request to A restful API with a expired api_key in Moqui? Does the system send back the SC_UNAUTHORIZED error or something else?
The response is status with 500 internal server error.

How to tell if GCM token is valid, without sending a notification?

Is there a way to tell when a GCM token is no longer valid, without actually attempting to send a notification and receive an error?
Thanks.
You can do this by using the dry run feature provided by the google.
When sending request for a notification from your web server to GCM servers you can add dry_run key to be true
This parameter allows developers to test a request without actually sending a message. The default value is false, and it must be a JSON boolean.
If the Notification key is invalid it would give the corresponding http response of the request