Let's say there is a SINGLE mobile application which receives various types of notifications (like WhatsApp notifications, Facebook Messenger notifications ,etc). What would be a better REST API structure for this?
/users/test#abc.com/notifications //Gives all the notifications
There is a confusion between the below two formats on how .
/users/test#abc.com/notifications?category=whatsapp,facebook //Gives all the notifications
vs
/users/test#abc.com/notifications/whatsapp //Gives only whatsapp notification
/users/test#abc.com/notifications/facebook //Gives only facebook notification
To access an individual notification resource
/users/test#abc.com/notifications/facebook/{notification-id}
vs
/users/test#abc.com/notifications/{notification-id}
If a resource has a unique ID then it should be directly accessible from that, so in my opinion
/notifications/{id}
Would make most sense. In terms of filtering, this is probably more about preference than anything. Here's what I think would be the most idiomatic approach
/notifications // fetch all notifications
/notifications/facebook // fetch all Facebook messages
/notifications/whatsapp // fetch all WhatsApp messages
/users/{id}/notifications // fetch user notifications
/users/{id}/notifications/facebook // fetch user Facebook notifications
/users/{id}/notifications/whatsapp // fetch user WhatsApp messages
It really depends on how you define a notification resource and the relation with its category type (whatsapp, facebook...).
Non category dependent
If the structure of a notification is not dependent on its category, then you want to access it without any category context:
/users/test#abc.com/notifications/{notification-id}
And you can use the category as a filter to a collection of notifications:
/users/test#abc.com/notifications?category=whatsapp,facebook
category dependent
Otherwise, if a notification is structurally dependent on its category (e.g., if you want to define different actions when you deal with whatsapp notifications than when you deal with facebook notifications), then you might want to distinguish a notification according to its category:
/users/test#abc.com/notifications/whatsapp/{whatsapp-notification-id}
/users/test#abc.com/notifications/facebook/{facebook-notification-id}
In this case, you could have:
/users/test#abc.com/notifications/whatsapp/1
/users/test#abc.com/notifications/facebook/1
That define 2 different notifications (although it uses the same identifier).
Now requesting a collection of this kind of notifications is a bit different than the previous "non category dependent" case.
If you only want to have whatsapp notifications then simply call the category resource does the job:
/users/test#abc.com/notifications/whatsapp
But if you want to search on different categories, then you cannot apply your request to a specific category resource. Indeed, it makes no sense to ask for facebook notifications when you deal with whatsapp ones:
/users/test#abc.com/notifications/whatsapp?category=facebook # weird
One solution would be to make as many requests as there are categories requested:
/users/test#abc.com/notifications/whatsapp
/users/test#abc.com/notifications/facebook
But you will have to merge your results later.
Another solution would be to apply your query directly from
/users/test#abc.com/notifications?category=whatsapp,facebook
But the result will be different than the "non category dependent" case. Indeed, you won't be able to directly have your list of notifications, but a list of categories to access to your list of notifications.
Related
I'm making a social media app using flutter and firebase.
I'm making push notifications to alert users on certain actions like somebody is following or send a comment or press like button. Also, there will be a push notification settings page.
I want to let users to choose to turn on and off push notifications on certain actions. For example, a user only wants to get push notification when someone is following on him. Then, the user can just turn off all the other push notifications except following push notification.
What I did was make every fields of every push notifications on certain actions.
For example, I made 4 data fields in user's firebase document for each certain push notifications.
I have a different idea which is making one field of Map type data that contains multiple push notifications like this.
Which way would be the better idea to minimize the size of Firestore data and reduce the cost?
Thank you so much for reading this and if you have other ideas, please let me know :)
Better have different fields - anyway you will receive one dataset, and you don't need to make another "dataset" in this (in same situation you will receive more long response because of additional string markup for inner json)
Also, if you have different fields you can more efficient query it if you need, with less data exchange between client and server
I'have search inside Microsoft documentation Graph API some method to get any kind of unread notifications from Teams product but I didn't see anything relevant that could I use through a REST API.
IS really possible to get the unreaded notifications?
This badges numbers is what I want
Thanks in advance
IS really possible to get the unreaded notifications?
Of course, the answer is yes. Currently, there are not existing Team API for this, you need to do it by yourself, meanwhile submit an feature request in the UserVoice. A workaround for you: get the message/activity list first, and store the lastModifiedDateTime in your app cache, then use corresponding API to regular interaction with the server to see if any update is available.
The feed aggregates important content from the following:
Teams/channels
Chats
Apps such as Files, Planner, and your Teams apps
https://learn.microsoft.com/en-us/microsoftteams/platform/concepts/activity-feed
This is on the roadmap but we don't have and dates to share publicly.
SWIFT 3 / Firebase
app like instagram/Facebook
Notifications
I am working on letting users know when another user e.g. liked their post, made a friend request etc.
I set up everything for cloud messaging with firebase and can send bulk messages at all my devices.
Now I want to introduce notifications which contain the current user, the user who did the action and what happened.
Unfortunately I did not find anything about this despite the general implementing of firebase cloud messaging.
My questions are:
1: Do i have to structure a database (e.g. .child("notifications").child(userId).... ?
2: How do I get the token from the stranger user I address with the notification?
3: How can I make the input variable?
I am happy about all kinds of help!
I have a doubt about real-time Instagram subscription in the API. Can i subscribe to whatever user i want? or there is some restrictions about the users that i want to subscribe?
I arises this doubt because in the Instagram of real time subscriptions page says: Note that this subscription is for all of the client's authenticated users, not just a specific user.
Its means that i can only subscribe the users that have authorithed my app in Instagram??
I have to make an app that consumes the instagram subscriptions and when there is a new photo it automatly saves it in the DB.
Thanks
A few things, first if you use the "user" type, then you are correct it will ping your endpoint any time any user who has authorized your app posts, there is no IG side filter (yet), but you can easily filter on your end once you get the notification. Oddly, I did notice it now sends the media_id of the post (although the docs say it doesn't!?). If users do not authorize your app, then the only way to get notifications is via the other endpoints such as by tag.
I have found some issues though when dealing with "private" users, and some strange filter behavior to watch out for.
A final point, you said you want to save to your db - that could be in violation of their use policy, so be sure to clearly understand what IG's rules are and that you don't break them.
Hope this helps,
P
Im about to develop notifications for my app.
In whatsapp you can receive group messages or single messages, and you are able to block one or the other type of notifications with in the settings of the app, not in the general settings of the phone, where you can disable any notifications.
My app will receive different types of notifications, the user should also be able to block notifications of one type and enable others.
What I don't understand is how my app or whatsapp is able to distinguish the different types of notifications, from what I know the notifications are handled by the iOS, so could you explain me how this can be done?
thanks
I assume you're talking about push notifications, so:
They'll be being "blocked" on the server. i.e. the server will only be sending out notifications for the types that you've chosen. You can't do it in the app.
add a type field in the dictionary.
then have a bool key for each field in userpreferences for example
then once you have recived the push pull the type field and check the bool in settings
if YES or setting for that key is missing process the notification in the app.
if user opted out of that subtype of notification then don't do much, maybe
just update badges (if any). but don't pester user with any other disruptive
in app navigation, etc
obviously you have to build a table view controller to allow user select which subtypes
of app-specific notification she should be bothered with (probably opt in by default
for most of them)