Search code examples
reactjsweb-applicationspush-notification

Is it possible to define push notifications for create-react-app (no back-end) triggered by the app's logic?


I have built a react application for notes with reminders.

You can see the code here:

https://github.com/YanivAf/NotesApp

Live version here:

https://corkboardnotes.netlify.app/

I want to make it more usable, by allowing push notifications that let users know there is a note's reminder, even if the user is not focused on the browser (and even better- when the browser is closed).

Searching on the web for a solution, I encountered OneSignal, but it seems that the notifications cannot be triggered from the code logic for webapps.

Is there a tool that can help me achieve my goal?


Solution

  • Do you have a native app, or is your react frontend hosted on a website?

    I don't know rightaway if you needed to have a website-url, but for native apps (when using Firebase Cloud Messaging) you can send a post-request to https://fcm.googleapis.com/fcm/send More information.

    If you're actually talking about a website, then you will need to add PWA capabilities to your react application. PWA's do support push-notifications, also on ios.