Electron - Send push notifications to subscribed users using temporary link - node.js

I'm experimenting with push notifications. I want to make a simple electron app that will give to the user the ability to create an ngrok link to send to friends where thy can subscribe to the user who generated the link push notifications. I'm reading about GCM and it seems to be a good solution as a server to send notifications. My question is, if I store the device id of each user that will subscribe into a local database of the app, can I send notifications to the subscribed devices using GMC without authenticate the user into my app?

Related

Push Notification with GetStream Notification feed

We are currently using getStream in our react web application for notification feed. It is working fine.
We are now planning to use it in our react native mobile app as well. We would like to show a notification (in the top tray or drawer) whenever there is a notification received by a user, similar to how we get in whatsapp or telegram
Does anyone know how this can be achieved. Couldn't find anything about this in their docs. I can see that they provide this functionality with Stream Chat
PS: We are able to get the notifications in the app but we would like to show the notification in the top tray as well so that the user knows he/she has received notifications without opening the app.
Regards,
Varun
I believe your question is about offering Push Notifications for your application. Stream Feeds does not currently implement Push Notifications out of the box so you will have to implement them in your application yourself. One common approach is to use notification webhooks where you have the webhook trigger a push notification for the user from your application's back end infrastructure.
I hope that is helpful.
Best,
Grant

How does apps like Instagram, uber, discord shows notification even if the app is closed

I want to shows push notification in my app , of which backend is done in NodeJS and mongodb, with io socket .
Every where I just see is FCM for push notification. what can be an alternative to that.
How does apps like Instagram shows push notification
To deliver push notifications to android phones, you need to use the official google api. This is firebase cloud messaging (FCM). You can send the messages from your backend to the FCM API.
For Apple devices it works similar, you can sent your messages directly to the Apple APNS API without FCM. But it is also possible to use FCM for iOS, but in reality the notifications will be delivered to the iOS devices from a apple server.
Alternative to Google's firebase fcm push notification you can try to reach out to the onesignal notification service.
check out the official docs for more information:
https://documentation.onesignal.com/docs/react-native-sdk-setup

Slack API client for push notification

I'm building a Slack (instant messaging) chat client, I'm looking for a way to trigger a notification to receipent when a new message is sent to him, push notification of course.
What's the endpoint or stream API to be able to trigger a push notification to devices?
I think it should be some backend microservice listening for incoming messages in a channel with a list for users to notify.
If you want to get instant notifications about new messages posted to a channel you can either use the Real Time Messaging API (RTM API) or the Events API.
The main difference:
RTM API uses Websockets and you will receive a constant stream of events about everything that happens on the connected workspace.
Events API uses standard HTTP requests and Slack will only send events to your endpoint that you subscribed too.
There are many factors to consider when choosing the right API for a project. Please also see the official FAQ from Slack on the topic for more details.

How to make your own push notification service for your website

I am working on a website, where I want to make a feature of notifications, when a user visits my website, they are asked for notifications permission and when they allow it, they will get notifications from my website, and whatever product I want them to get notified by.
Like for example when I visit some websites, they ask me for notifications permissions and when I allow the, I get notified through notifications then. That's all I want for now.
How can I achieve this functionality, I have follow this tutorial, but still confused how the users who allowed the notifications get detected and how all of them are notified then ?
Web Push library for node.js is just a sender.
You should obtain a subscription JSON object from the browser using Notification API and Service Worker API and then send it to your server, where put it in the database of your choise.
When you will need broadcast notifications, you can retrieve subscription and use a web-push library (for php is also available :)
Note that is a right flow looks following as:
1) Retrieve subscription from the browser
2) Send and store it on your web-server
3) Create notification prototype (just object)
4) Broadcast notification prototype ID you have created to the users
5) Service Worker receive one and fetch notification prototype from your server by ID
6) Show notification using browser API in service worker
For more see here links
https://developers.google.com/web/fundamentals/codelabs/push-notifications/
https://developers.google.com/web/ilt/pwa/introduction-to-push-notifications/

Create single push notification channel for multiple apps

For sending and receiving push notifications I want to register all my apps to the push channel with:
var channel = await PushNotificationChannelManager.CreatePushNotificationChannelForApplicationAsync();
I can now send and recieve pushes over this channel.
The problem is that this channel is only valid for one app. If I install the same app on another device I only receive the message on the same device as I sent it.
How can I push the notification to all my devices?
The push channel is unique for each app installation. You can only use it to send a push to this one installation. If you want to send push to all the devices running your app, you have to collect the push channel info somewhere (your server, etc.) or you can use a service like https://parse.com/ that offer targeting multiple devices at once.
Are you trying to install the same debug-based app on more than one device?
I believe that the channel is based on some identity of the app, so try to release it and I prefer you to create a store-based hidden app and test it..
The code you're writing is OK with millions of devices :)
According to this article,
Devices can specify one or more tags when registering with a Notification Hub, These tags don’t need to be pre-provisioned or disposed, and provide a very easy way for apps to send targeted notifications to millions of devices with a single API call, without you having to implement your own per-device notification routing infrastructure - https://blogs.windows.com/buildingapps/2013/09/16/delivering-push-notifications-to-millions-of-devices-with-windows-azure-notification-hubs/#mQppyhpwaEAcMehc.97
In your Windows Store app, using the Windows Store device SDK, you can register to your Notification Hub simply calling
await hub.RegisterNativeAsync(channel.Uri, new string[] { "myTag", "myOtherTag" });
And then you can have your .NET backend broadcast a message to all your clients, just by calling
var toast = #"<toast><visual><binding template=""ToastText01""><text id=""1"">Hello everybody!</text></binding></visual></toast>";
await hub.SendWindowsNativeNotificationAsync(toast);

Resources