Setting Up Web Push Notifications
Last updated
Last updated
This guide provides step-by-step instructions to configure Web Push Notifications using Firebase Cloud Messaging (FCM) for Organon. By following these steps, users can enable push notifications in their web applications and integrate FCM for seamless message delivery.
Before proceeding, ensure you have:
A web application with HTTPS enabled (FCM requires HTTPS for push notifications).
Access to the Firebase Cloud Messaging credentials.
Go to Project Settings > Cloud Messaging.
Scroll to the Web configuration section.
Click Generate Key Pair under the VAPID Key section.
Copy the generated VAPID Public Key and VAPID Private Key.
Add Firebase SDK to your project.
Initialize Firebase with your configuration:
Create a firebase-messaging-sw.js file in the root directory of your project.
Register the service worker in your index.js file.
Add the following code in your main JavaScript file.
Call requestNotificationPermission() when users enable notifications.
To send notifications from Organon, users must upload their Firebase Web Push credentials.
Open Organon and navigate to Push Notification Settings.
Select the Web tab.
Enter the VAPID Private Key.
Upload the firebase-messaging-sw.js file.
Click Enable Web Push Configuration.
Save the configuration.
Run your web app and call requestNotificationPermission().
Copy the generated FCM token.
Go to Firebase Console > Cloud Messaging.
Click Send your first message.
Enter a notification title and message.
Select Send to a test device.
Paste the copied FCM token.
Click Send Message and check if the notification appears.
Once testing is successful:
Use Organon’s campaign feature to send push notifications.
Monitor delivery rates and engagement using Organon’s analytics dashboard.
Optimize message content for better user interaction.
Ensure the Firebase configuration matches your project settings.
Verify that your service worker is correctly registered.
Check Organon’s notification logs for errors.
Ensure the user has granted permission for notifications.
Following these steps will enable web push notifications via Firebase Cloud Messaging and allow sending notifications directly from Organon.
A Firebase project set up in the.
Open the and select your project.