GCM APIs not delivering push notifications - push-notification

We are trying to send some push notifications using the GCM API to Chrome users. Until 3-4
days back, the delivery rate of the notifications to the end users were
about 60-70%. We have a timeout of 1 day, so people who did not come online
for about a day after the notifications went out, should not get it.
We are seeing that this delivery rate has drastically dropped down to about
10%, with no change on our side. We push messages to GCM and the API
returns successfully, but the messages do not get delivered. Also, a few of
our users in the test pool have mentioned that despite being online(on
Chrome), they did not receive any notifications when they were sent.
Strangely, they did get those notifications after a couple of days(even
after there was a timeout set, of 24 hours).
Does the old GCM API have some problems like the delay and drop in delivery
rates? For example, for a test token, the notification was sent on Dec 1, 09:55 GMT, and delivered on Dec 3, 13:14 GMT.
We are using this endpoint : https://android.googleapis.com/gcm/send

So just to keep it short, it would seem that you are using an old endpoint:
https://android.googleapis.com/gcm/send
And as far as GCM implementation goes, there wasn't any behavior reported like this as of the moment (I've been monitoring the GCM tags so.. yeah..), but you can't really guarantee the success of the request unless you are using the suggested endpoint (seen in the docs):
https://gcm-http.googleapis.com/gcm/send
I suggest to use this moving forward. And since we're also on the subject of using the suggested implementation, you should also have a look into using Firebase Cloud Messaging too. Cheers!

Related

When AB testing a push notification the notifications is going to be send every day?

I am testing a push notification that is related to an event that only has 24 hs of duration. So, I wanted to send a notification with a variant to see the impact and diference. But i dont want to that same notification be sended more than once because if it is sended 24 hs later the event is off and we will be sending a wrong notification.
The message will be send everyday in the usual configuration or only the first day (That it is when it is schedule).
I have this doubt specially because when i see the result console y can see this:
We have a positive number for notification opened on days before the starting date. I DONT want users to see notif after 24 hs. I cant find any documentation regarding this.

Best way to utilise push notifications when app goes into background

I am a React Native developer currently working on a vehicle tracking app.
We want to develop a feature that allows users to exit the app, but continually be updated in the form of notifications when the vehicle moves (on average every 60 seconds).
I have been tasked with coming up the best way of integrating this. Our app already has push notifications set up with Firebase and we do use this to push out generic messages to the app.
My thinking is as follows:
When a user begins tracking a vehicle, the app should subscribe to a Firebase topic identified as the vehicle's registration. On the server side, each time an update comes in for a vehicle, send out a Firebase notification to that vehicle registration's topic, and then any users tracking it will be updated. When a user returns to the app and presses 'Stop tracking', the app unsubscribes from the topic.
In theory I think this would work. The reason I'm posting is I'm not sure it's the most efficient way. Our server received updates for over 1,000 vehicles every minute.
Any help/ideas would be gratefully received!

What is rate limit of accessing Telegram bot APIs?

I read in the docs that bot can send:
30 messages/second to different chats
1 message per second to the same chat
20 messages per minute to the same group chat
but this is all about sending messages, what about other endpoints? more specifically getChatMembersCount method?
Thanks
I know it's been a long time, but there's a very good resource now - https://limits.tginfo.me/en. There's a Bots section there. Also if you have time you can send pull request to the github repository - https://github.com/tginfo/Telegram-Limits/

Can service-worker stop push notification sent by GCM api?

In my current architecture, I submit push notifications using the GCM API.
This triggers a 'push' event in the service worker. The service worker then adds some data to the notification.
If the service worker is unable to add the data, due to some error, I am getting a blank notification.
Can service workers avoid showing notifications sent by GCM?
From the Push Notifications guide at Google Developers:
You must pass a {userVisibleOnly: true} argument to the subscribe()
method. This tells the browser that a notification will always be
shown when a push message is received. Currently it’s mandatory to
show a notification.
The upshot is that if you don't show something in response to a push (after promising the browser that you will), the browser (Chrome, at any rate) will just show something for you. However, it seems likely that this will change at some point.
It seems that upon the error condition you hit you are still showing your own notification anyway and since you could not fill it up it shows up blank.
Your best option is to fallback to some generic text. You can risk not showing it but after a few times chrome will start showing its own notification (after all you "promised" you would be showing one by saying {userVisibleOnly: true})
The best sequence of steps I can think of looking at the chrome code is:
1) Try to show the notification you want to show
2) If that fails for whatever reason check if you are in the foreground or if one of your notifications is already showing. If so do nothing
3) Else you need to show a notification, otherwise it's likely that chrome will show it for you and risking it is probably not worth it. Just add some generic text and show it.

How can I test subscription renewal flows in stripe?

I want to test my application's handling of webhook events from stripe when a subscription payment has been made (or failed). Here is what I've tried so far:
Set up a new subscription
Update user's credit card to be the one that can be added to an account, but will fail to actually be charged
Change the trial end date to be in one second
Wait a few seconds expecting the webhook to be sent
However, According to the documentation:
If you have configured webhooks, the invoice will wait until one hour after the last webhook is successfully sent (or the last webhook times out after failing).
One hour is a long time to wait, since I am trying to do this as part of an automated integration test suite.
One suggestion (from IRC) is to fake out the webhook request, so that my integration test sends the event, instead of Stripe sending it. However, since Stripe doesn't include any sort of HMAC in the webhooks, I can't trust the data in the payload. So, my application just takes the event ID from the webhook payload and fetches the event from the Stripe API:
If security is a concern, or if it's important to confirm that Stripe sent the webhook, you should only use the ID sent in your webhook and should request the remaining details from the API directly.
This will obviously not work if I am trying to inject fake events for my test (by design).
What are the best practices for testing this sort of scenario?
It seems there isn't a perfect way to do this. As suggested by #koopajah in a comment, I added a configuration value in my application that will disable fetching the event from Stripe, and instead just trust the event data in the webhook. This allows me to test my flow in almost the same way as it would work on production, since the event data in the webhook and the event fetched from Stripe are identical (assuming it is an authentic webhook request :)
Unless/until Stripe includes an HMAC signature in the webhook request to authenticate that it came from them, I think this is the best way to solve the problem.
One hour is a long time to wait, since I am trying to do this as part of an automated integration test suite.
You can shorten the wait by going to the invoice and selecting the "Charge customer" button, as shown below.

Resources