In Firebase Console I set up audiences based on various user properties and now am able to send notifications to different user segments via console. Is there a way to do the same by http requests to fcm servers? There should be a trick with "to" field, but I couldn't figure it out.
firebaser here
There is currently no way to send a notification to a user segment programmatically. It can only be done from the Firebase Console as you've found.
We're aware that allowing this through an API would expand the potential for Firebase Notifications a lot. So we're considering adding it to the API. But as usual: no commitment and no timelines, since those tend to change as priorities shift.
This has been a popular request, but unfortunately it is not yet possible. We are looking into this.
Please check Firebase Cloud Messaging announcements for any updates in the future.
You can try with topic subscriptions. It is not perfect solution but the best for me at this time.
{
"to": "/topics/audience1_subscription"
"data" : {
"title" : "Sample title",
"body" : "Sample body"
},
}
Yes. No solid solutions are available as of now but I have a workaround solution for it. Which is not able to handle every scenario but it will get the work done.
For that, you need to figure out the audience within the app and you need to segment them with topics. Then you can send a push notification for that particular topic via API.
Let's take an example.
Send notifications to users who didn't open the app in the last 7 days
Subscribe to a topic name "app-open?date=09-21-2022"
each time user opens the app. Just unsubscribe from the topic of the last app opened and subscribe to a new topic with the current date.
Then you just need to build a topic string based on the current day - 7 to send.
And you can create multiple topics for the same user for different behaviors and use them as topics to send push notifications via API to segmented users.
As there is no limit on topics per user or topics per project. You can create as many as topics you want and use them as your need.
Yes.There is trick with the "to" field as mentioned in below.
web URL is: https://fcm.googleapis.com/fcm/send
Content-Type: application/json
Authorization: key="YOUR_SEVER_KEY"
JSON DATA FORMAT:
{"to": "USER_FIREBASE_TOKEN",
"data": {"message": "This is a Firebase Cloud Messaging Topic Message",}
"notification": {"body": "This is firebase body",}}";
Related
I'm learning backend and API development and trying to understand how to implement some features from scratch without using any paid third party service.
I want to understand this concept from design as well as implementation pov. Please share if you have any resources where I can learn how to code the below service.
How to build in app notification service like one of these from scratch ?
Notification when user likes or comments on a post (Instagram, Twitter)
Notification when someone views your profile (Linkedin)
Notication when a channel you are subscribed to uploads a video (Youtube)
These are different from push notifications like
Notification when someone sends you a message (All chat apps)
Live status via notification of your delivery (Food delivery apps)
Push notifications need not be stored permanently in any database but what happens with in app notifications? How to build such service which is scalable too.
One possible solution I could think of is this, for notification on post like
User A has made a post.
User B likes their post.
From likePost API emit an event which will notify User A that User B liked their post, listen for these real time events on client side. This can be done via sockets.
Do not store any notifications in database, just update the notifications in UI on that event emitted by likePost API or listen to real time changes in likes attribute of a User's Post table (is this possible?) and update UI.
In UI just show all such notifications by fetching from likes and comments table.
But I wonder how scalable is this approach.
I searched but couldn't find any good resources regarding this, so please if anyone could explain this or provide link to any blog or videos it will be helpful.
(P.s. I'm an undergrad student and don't have experience in system design and architectures, just started learning about these so just curious)
Thanks.
apps like Facebook, Instagram and linkedIn provides web hook of notifications. Webhooks allow you to receive real-time HTTP notifications for subscribed events. This functionality is only available for applications with an approved use case for webhooks. Webhhook received as a notification when user comment on your post or like your post, a web hook can be used to retrieve the information of post, comment and commentor etc.
I am attaching a reference of LinkedIn web-hook.
https://learn.microsoft.com/en-us/linkedin/shared/api-guide/webhook-validation
Hi I was wondering if there is a way in which I could use Firestore messaging and flutter to merge notifications such similar to how instagram does it. Where initially it will say a single person liked a post e.t.c then if more like the post it will merge it by saying bob, garry and 42 others liked a post. I have an image below which I hope makes the objective more clear
Those are so-called collapsible messages. From the Firebase documentation:
A collapsible message is a message that may be replaced by a new message if it has yet to be delivered to the device.
A common use cases of collapsible messages are messages used to tell a mobile app to sync data from the server. An example would be a sports app that updates users with the latest score. Only the most recent message is relevant.
So in the example of Instagram messages, when somebody likes the same post, the server sends a new message that replaces the previous message, by specifying the same collapse_key.
I am implementing a custom alexa skill that having a request which is used to post a message (eg: Bring account files) on slack chat.The user who receives the order and responding after skill closed.Is there any way to announce the user's reply (eg: will bring in 10 minutes) through alexa device without any extra intent request.
No. This is however, a much requested feature. So I recommend you vote for it here:
https://alexa.uservoice.com/forums/906892-alexa-skills-developer-voice-and-vote/suggestions/32555959-enable-and-allow-true-push-capabilities
I am trying to setup Push notifications in the mobile app. I have decided to use OneSignal for this. This topic is completely new for me and I would like to know the best practices regarding Push notifications setup in terms of user targeting. From what I got from the Google and OneSignal documentation I can target different user in two ways:
In the mobile app assign some data tags to users, e.g. 'hasItems: true', or 'isInterestedInProduct' and then create segments in OneSignal console with these user tags.
Save OneSignal PlayerId on my backend, match it with the userId and then selectively send messages to the users depending on the backend database data.
What is the preferred way to do this? Or it should be the combination of both depending on my use cases?
Is there any way to make it fully automatized? E.g. based on some analytics events, create messages in OneSignal without any changes from the mobile/backend side (only setup the mobile sdk )?
It all depends on your use case.
For sending messages to users as a group, tags are a great way to support this. For example, you could tag all users interested in a specific product, or who have visited a specific page in your app. Here is OneSignal's guide on tags.
For sending messages to a small list of specific users, storing their OneSignal player_id or using the external_id feature of OneSignal is the way to go. Here is OneSignal's guide on sending these types of notifications.
I am interested in seeing if Sabre's FareNabber is an API that works for an application I am building.
The documentation here https://developer.sabre.com/docs/read/rest_apis/air/search/fare_nabber does not explain where/how the notifications get posted to after a subscription made. All I see is the following:
FareNabber nabs the itinerary options and pushes the results to the customer for a purchase decision.
Is this an email to the customer? Is this an HTTP POST with a JSON payload to a server I provide so I can handle the actual email transmission? Where is this documented?
Re Endpoint you set this up during activation:
Note: This service requires activation, please contact your Sabre Account Representative for assistance.
Actually yes you get a JSON - its specified here: http://files.developer.sabre.com/doc/providerdoc/STPS/fare_nabber/v100/FNB_LowFareNotification.json