Bagisto Forum

    Bagisto

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    How to make web push notification

    General Discussion
    2
    2
    1094
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      gauravjain1 last edited by

      How to make web push notification in bagisto?

      Gaurav Jain

      V 1 Reply Last reply Reply Quote 0
      • V
        vaibahv_bagisto @gauravjain1 last edited by

        @gauravjain1
        Bagisto does not provide browser/web push notifications out of the box. The built-in notification system is only for in-app admin notifications (such as the notification bell in the admin panel) and does not send push notifications to browsers.

        To add web push notifications, you have two options:

        1. Use the official Web Push Notification extension available on the Bagisto Marketplace.
        2. Implement your own solution using Firebase Cloud Messaging (FCM).

        Implementing web push notifications with Firebase Cloud Messaging (FCM)

        A typical implementation consists of the following steps:

        1. Set up Firebase

          • Create a Firebase project.
          • Register a Web App.
          • Generate a Web Push (VAPID) key.
          • Download the Firebase service account credentials for server-side authentication.
        2. Store browser tokens

          • Register a Service Worker (firebase-messaging-sw.js).
          • Request notification permission from the user.
          • Retrieve the FCM registration token and store it in your Bagisto application.
        3. Send notifications

          • Use an FCM package such as kreait/laravel-firebase or laravel-notification-channels/fcm to send notifications through the FCM HTTP v1 API.
        4. Trigger notifications

          • Listen to Bagisto events (for example, order placement or order status updates) and send push notifications to the stored FCM tokens.

        Important notes

        • Web push notifications require HTTPS (except on localhost during development).
        • The Service Worker must be served from the application's root so it can control the entire site.
        • Use the FCM HTTP v1 API, as the legacy FCM API is deprecated.
        • Add your frontend JavaScript through a theme override or a view_render_event listener instead of modifying Bagisto core files.

        This approach allows you to send push notifications for events such as new orders, order status updates, promotions, or any other custom events in your Bagisto application.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post