git-point
git-point copied to clipboard
Add push notifications for watched repos
It would be awesome to get push notifications for my watched repos. This is something that all other GitHub apps either don't have or are a paid feature.
I could definitely work on at least the iOS push notifications, though Android doesn't seem to be much different.
This might help: https://medium.com/differential/how-to-setup-push-notifications-in-react-native-ios-android-30ea0131355e
I think this is an outstanding idea, please feel free to go ahead trying it with iOS. I can (or anybody else with Android) will be happy to help with Android if they happen to be different.
So push notifications for watched repos is a great start. Definitely worth exploring push notifications for other things (such as a user has followed you for example) and then eventually allowing the user to change which notifications they get. Of course this is just cherries on top, definitely worth getting watched repo notifications up and running first.
Best way to go about this IMO is to poll each user's notifications feed every ~2 minutes and send any new notifications to OneSignal. Tell me if anyone has any better ideas tho!
Just contacted GitHub about the possibility of adding webhooks for users as that would make this all a lot easier.
Edit: wow they got back to me quickly, here's their reply:
Hi Andrew,
Thanks for getting in touch! We've passed your request to the team working on webhooks internally for consideration, though we can't make any promises. Let us know if you have any other ideas!
They also pointed me towards using Conditional Requests if we do go down the polling avenue: https://developer.github.com/v3/#conditional-requests
Something else I'm looking into is setting up Firebase Cloud Function on a 2-5 minute cron job. We get 125,000 calls/month for free, which would be 2.89 calls/minute. We also have only 540 seconds to complete the call before it gets forcefully terminated.
Here's my thinking for the flow of how this would work:
- User enables push notifications in settings.
- Username and FCM token are saved to Firebase.
- In addition, one of the following is stored (still need to decide on which one makes more sense):
- The user's private RSS feed (https://github.com/andrewda.private.atom?token=abc123).
- The user's access token for use with the notification feed API.
- Cron job polls ever 2 minutes for new notifications.
- If need be, we can create several cron jobs that split up the work. First job takes users 1-10, second job takes users 11-20, third job takes 21-30.
- Cron job sends push notification (using the FCM token saved above) whenever it finds a new notification.
I think this is the best we can do until GitHub adds user event webhooks.
That sounds amazing @andrewda 🙌 I'm always impressed with how much Firebase provides for free. Even though costs can get steep with priced plans, they always have awesome free starting points. Appreciate you looking into this.
Couple of things I'm curious about:
-
- What's an FCM token? (forgive me if this is a foolish question :P)
- Yep definitely something we need to decide. If the user's private RSS feed will work that might definitely be a more secure route - storing the user's access token can definitely bring up some security concerns (and it's something we'll need to declare ino ur privacy policy). We'll definitely chat about this.
- For 2 & 3 I like the sound of that 👍
- FCM token = Firebase Cloud Messaging token - it identifies the user so we can send that specific user notifications in the future.
- Totally agree about the RSS feed. The only problem with it is that we would have to parse the RSS and decide what notifications to send to the user ourselves, as opposed to just going off of what the user already gets notifications about in their notification feed.
Hmm you're right it very well might be easier to leverage the user's access token in that case - let's decide at that point if storing the user token in a secure server is a viable option
It's also completely up to the user whether their token would be stored, and we would make it clear that the token would be immediately when the user disables push notifications.
Is there a way that we can get a separate token with only the notification reading scope? I think it would be fine if that only required another sign in from the user.
I think that's a great idea. We may be able to leverage Basic Auth specifically creating a scope for notification and then clearing it when they disable again. If this happens to require an additional sign in, I'm okay with that as long as we briefly explain to the user why it's necessary (for improved security and so forth)
This feature would be golden! 🥇
Any update on this feature? Would love it implemented within the app
Hallo @housseindjirdeh and @andrewda , I am using GitPoint for a few weeks now and it's a pleasure to work with this app! Is there any update on this push notification feature? Have to agree with @henrikra: it would be golden! =:-)
Me too! Initially, I thought I had missed out on some setting but only later realized that push notifications are not a feature of the app yet. Any updates? It would be awesome!
Unfortunately I've been busy lately and have been away from the project for a while, but I'm looking to get back into GitPoint soon and will continue looking into a way to make notifications work!
Same here, I've been a bit occupied this past while unfortunately and most of the maintainers have :(
But I'm also looking to get back into the swing of things in the coming weeks. If this is a priority, I can work on this first as well :)
I just read this article, and I wonder if we could do something similar to send push notifications?
https://towardsdatascience.com/using-gitlabs-ci-for-periodic-data-mining-b3cc314ecd85