Firebase push notification for web using JavaScript and PHP | Firebase Cloud Messaging

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 เม.ย. 2023
  • Hi, this video is all about using Firebase push notifications for websites with JavaScript and PHP. If you know nothing about Firebase or web push notifications then you don't need to worry because here you will learn everything from start to end. Here, we will create a Firebase project and then create an app for the notifications in the Firebase project in completely free. We will enable cloud messaging API and will get our server key. We will also create a web push notification certificate that will use on the client side to generate device tokens. Everything is done step by step so don't miss any step to learn everything about Firebase push notifications. I hope this video will definitely help you in this regard. Still, if you have issues with this topic then comment below or contact us on FB.
    Note: Read the blog to learn about Web Push Notification using the latest method. The method in the video will depreciate soon. The source code and live demo are also available in the blog.
    www.slidesmaker.me/blog/fireb...
    Firebase in javascript on web
    • Firebase JavaScript
    Chapters:
    1:12 Demo
    0:53 Creating Firebase Project
    2:27 Start Coding JS
    5:40 Sending Notification using Firebase Console
    11:39 Creating Custom Backend in PHP for sending Notifications
    16:39 Test on multiple devices with Live Server
    ------------------------------
    Lights by Sappheiros / sappheirosmusic
    Creative Commons - Attribution 3.0 Unported - CC BY 3.0
    Free Download / Stream: bit.ly/LightsSappheiros
    Music promoted by Audio Library • Lights - Sappheiros (N...
    ------------------------------
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 96

  • @hacodes
    @hacodes  11 หลายเดือนก่อน +10

    Note: Read the blog to learn about Web Push Notification using the latest method. The method in the video will depreciate soon. The source code and live demo are also available in the blog.
    www.slidesmaker.me/blog/firebase-web-push-notification-javascript-php

    • @alfredolima7241
      @alfredolima7241 11 หลายเดือนก่อน

      Excellent thank you very much! Can you make a video explaining the new method?

    • @hacodes
      @hacodes  11 หลายเดือนก่อน +1

      Will make soon.

    • @thetruehooha_
      @thetruehooha_ 4 หลายเดือนก่อน

      @@hacodes The "get_access_token.php" is missing in the repo..

  • @user-gf6le3yw1c
    @user-gf6le3yw1c 11 หลายเดือนก่อน +2

    Excelente, me ayudo muchísimo tu video, te agradezco, espero sigas haciendo videos como estos.

  • @rubenrios6172
    @rubenrios6172 10 หลายเดือนก่อน +1

    Excellent! Just what i need it, thanks

  • @Pritam-saha
    @Pritam-saha 10 หลายเดือนก่อน

    Awesome video and and very good website clean and direct download the code, thnq

  • @umeshgadad7965
    @umeshgadad7965 6 หลายเดือนก่อน

    Nice 🎉

  • @pasindudilshan2543
    @pasindudilshan2543 3 หลายเดือนก่อน

    tnx bro....superb

  • @omarabdelfattah
    @omarabdelfattah 5 หลายเดือนก่อน

    Thank you

  • @WINTORABC
    @WINTORABC ปีที่แล้ว +2

    Tiene un límite de suscriptores en notificaciones push?

    • @hacodes
      @hacodes  ปีที่แล้ว

      No limits

  • @facundoterrens87
    @facundoterrens87 8 หลายเดือนก่อน

    Hello! I cant send notifications for IOS devices, but I can't send them, I never show the "allow notifications" message

  • @remomuthu2265
    @remomuthu2265 7 หลายเดือนก่อน

    I have added the image is not displayed on ubundu chrome ?

  • @Happy67986
    @Happy67986 2 หลายเดือนก่อน

    Can i used for web push notifications for blogger platform?

  • @user-nu1ki6hz9y
    @user-nu1ki6hz9y 4 หลายเดือนก่อน

    what's about fcm v1 api? How can i receive notification on browser?

  • @VARUN-fj7yz
    @VARUN-fj7yz 2 หลายเดือนก่อน +1

    background music 😊?

  • @Jay_domain_hub
    @Jay_domain_hub 4 หลายเดือนก่อน

    Is it possible to send message to multiple recipients phone number?

  • @Bauroziq
    @Bauroziq 11 หลายเดือนก่อน +2

    notificationclick doesn't lead anywhere in workers, what's the problem?

    • @hacodes
      @hacodes  11 หลายเดือนก่อน +1

      Have you added worker in root folder?

  • @wz6733
    @wz6733 7 หลายเดือนก่อน

    Hi I want to ask, now the notification will get when browser is open right? If we close the browser it's same emthod? because I try my side no receive any notification when close the browser.

    • @hacodes
      @hacodes  7 หลายเดือนก่อน

      You will not receive any notification if browser is closed. Because there is a service worker js file that run in background when browser Open. This file is responsible for showing notifications.

    • @wz6733
      @wz6733 7 หลายเดือนก่อน

      OK understood. But I have 1 problem now. When I click the notification not direct go to the website. So, to add link on notification for click and will redirect go to website? @@hacodes

  • @johannbogota5857
    @johannbogota5857 ปีที่แล้ว

    Hello, I've been doing some test with firebase push notification, and I've found some problems with google chrome, could you validate if you only have the same problem with this browser? because I did the test with edge and mozible and the notification works, but I'm not sure why in chrome not works

    • @hacodes
      @hacodes  ปีที่แล้ว

      My be you have blocked push notification in chrome, plz allow notification on clicking lock icon then try. It's working for me on chrome.

    • @johannbogota5857
      @johannbogota5857 ปีที่แล้ว

      @@hacodes thank you for your reply, doing some research about that and tests, I found that apparently there is a problem with my Google chrome notifications in my PC, in other computers were working, so the firebase notificación push is working fine
      Thank you!

    • @alexnikolas4937
      @alexnikolas4937 2 หลายเดือนก่อน

      I had the same problem on chrome. I updated chrome and it worked

  • @Ravi_Mayank
    @Ravi_Mayank 4 หลายเดือนก่อน +1

    Can we send notification some selected user by using firebase??

    • @hacodes
      @hacodes  4 หลายเดือนก่อน

      Yes, we are using users browser data to send notifications. You can filter them out and can send notifications to only selected users.

    • @Ravi_Mayank
      @Ravi_Mayank 4 หลายเดือนก่อน

      @@hacodes any tutorial?

  • @hamuzamugabo9369
    @hamuzamugabo9369 6 หลายเดือนก่อน +1

    Helped me

  • @user-zo6te7wc5i
    @user-zo6te7wc5i ปีที่แล้ว

    Sir, If online can not be used. Btw im using byethost (free hosting)

    • @hacodes
      @hacodes  ปีที่แล้ว

      I didn't understand you.

  • @divtech8486
    @divtech8486 5 หลายเดือนก่อน

    Can i modify the code depending in my database to notify the user if there is a new data

    • @hacodes
      @hacodes  5 หลายเดือนก่อน

      Yes, the whole process will remain the same, just DB queries can be different.

  • @rainydaytuness
    @rainydaytuness ปีที่แล้ว

    does it can make notification like facebook or youtube inside web, not notification of browser

    • @hacodes
      @hacodes  ปีที่แล้ว

      No, this method cannot do that, You need to do real-time fetching from database and show data as notification within website.

    • @rainydaytuness
      @rainydaytuness ปีที่แล้ว

      @@hacodes can i choose user before send noti

    • @hacodes
      @hacodes  ปีที่แล้ว

      Yes, you need to provide device token to send notification with is unique for each device

  • @USTechnology007
    @USTechnology007 10 หลายเดือนก่อน

    how can i schedule the notification at some time it will automatically send

    • @hacodes
      @hacodes  10 หลายเดือนก่อน

      You can use Firebase notification dashboard to send notifications, and there you can schedule notifications

  • @CopyCatMaster01
    @CopyCatMaster01 ปีที่แล้ว

    this method is not working anymore. Do u know how to do it with the new method?

    • @hacodes
      @hacodes  ปีที่แล้ว

      What error you are getting?

    • @CopyCatMaster01
      @CopyCatMaster01 ปีที่แล้ว

      @@hacodes No error. Its just not working anymore because its deprecated

    • @hacodes
      @hacodes  ปีที่แล้ว

      Ok I'll check and reply you later.

    • @hacodes
      @hacodes  10 หลายเดือนก่อน

      Index page just run once and return a token that will further use for sending notifications from server.

  • @rjone3824
    @rjone3824 7 หลายเดือนก่อน

    how many push notification we can send per day using firebase free account ?

    • @hacodes
      @hacodes  7 หลายเดือนก่อน

      Unlimited free of costs, for both methods.

    • @rjone3824
      @rjone3824 7 หลายเดือนก่อน

      @@hacodes thank you sir

  • @utpalendukhatua
    @utpalendukhatua หลายเดือนก่อน

    Not Work 😥😥

  • @gumnam4253
    @gumnam4253 6 หลายเดือนก่อน

    i am not able to get the device token please help me

    • @hacodes
      @hacodes  6 หลายเดือนก่อน

      Any error you are getting?

  • @sudgupta
    @sudgupta 9 หลายเดือนก่อน

    manual thodi koi token dale ga code me

    • @hacodes
      @hacodes  9 หลายเดือนก่อน

      You can add, but you need to enable proper security for firebase app. Then nobody can use your public token.

  • @Pritam-saha
    @Pritam-saha 10 หลายเดือนก่อน

    WHat is YOUR_SERVER_ENDPOINT? please explain

    • @hacodes
      @hacodes  10 หลายเดือนก่อน

      I need to check that but it may be the api endpoint that will get the token and store in database so that it will further use for send notifications.

  • @alessandromoreira1850
    @alessandromoreira1850 ปีที่แล้ว

    Hello, does this firebase push notifications for websites with JavaScript and PHP also work with android and ios?

    • @hacodes
      @hacodes  ปีที่แล้ว

      Yes, you can use push notification using react native or other JS framework for Android/IOS, if you want to use JavaScript. But there is other documentation for that.

    • @alessandromoreira1850
      @alessandromoreira1850 ปีที่แล้ว

      @@hacodes but this example of yours does not work with Android/Ios?

    • @hacodes
      @hacodes  ปีที่แล้ว

      This will not work natively but work in browser of Android and iOS. For native, you need to use documentation for the language you use for app development.

    • @alessandromoreira1850
      @alessandromoreira1850 ปีที่แล้ว

      @@hacodes it is not generating the device token when we access it through the IOS browser.
      the token only created when accessed by android
      do you have any solution?

  • @JaskaranSingh-ms1ts
    @JaskaranSingh-ms1ts ปีที่แล้ว

    can we crate createcustomtoken

    • @hacodes
      @hacodes  ปีที่แล้ว

      For which purpose?

    • @JaskaranSingh-ms1ts
      @JaskaranSingh-ms1ts ปีที่แล้ว

      @@hacodes we have to create token from userid

  • @keremardicli4013
    @keremardicli4013 6 หลายเดือนก่อน

    This is obsolete. You need V1 now.

  • @Armwrsling
    @Armwrsling ปีที่แล้ว

    can i get The code plz?

    • @hacodes
      @hacodes  ปีที่แล้ว +2

      Yes, Get it from description

    • @Armwrsling
      @Armwrsling ปีที่แล้ว

      @@hacodes thx

  • @jondycz
    @jondycz ปีที่แล้ว +4

    Literally using deprecated API that is being removed within a year.

    • @hacodes
      @hacodes  ปีที่แล้ว

      I have checked, no API is deprecated, But if, something will deprecate in future, firebase will give a new and more simple way to use this service.

    • @jondycz
      @jondycz ปีที่แล้ว +2

      @@hacodes deprecated != Removed. It is going to be removed in Q1 next year. You even enabled the service in the video. And you can clearly see it says it is "legacy" and to be removed.

    • @jondycz
      @jondycz ปีที่แล้ว +1

      @@hacodes No, the new API requires oAuth2 and token refreshing. That's not simpler.

    • @CopyCatMaster01
      @CopyCatMaster01 ปีที่แล้ว

      ​@@jondyczthis method is not working anymore. Do u know how to do it with the new method?

    • @mikhailsimon9027
      @mikhailsimon9027 11 หลายเดือนก่อน

      for python (sending messages) you might need to have to refresh token each time or you can have the sdk...

  • @thisarachathuranga2229
    @thisarachathuranga2229 ปีที่แล้ว

    Is that free?

  • @rushipatil2414
    @rushipatil2414 ปีที่แล้ว

    the code isn't working , it's just wasted my 2 hours

    • @hacodes
      @hacodes  ปีที่แล้ว

      Can you you tell me what error you got?

    • @rushipatil2414
      @rushipatil2414 ปีที่แล้ว

      @@hacodes in service workers it didn't show me Active

    • @rushipatil2414
      @rushipatil2414 ปีที่แล้ว

      @@hacodes send me your email i will send the code to it

  • @akeaditing3896
    @akeaditing3896 ปีที่แล้ว

    Bro voice over

  • @aarthis969
    @aarthis969 ปีที่แล้ว +1

    i have a error
    Loaded new content
    (index):42 An error occurred while retrieving token. FirebaseError: Messaging: We are unable to register the default service worker. Failed to register a ServiceWorker for scope ('localhost/firebase-cloud-messaging-push-scope') with script ('localhost/firebase-messaging-sw.js'): ServiceWorker script evaluation failed (messaging/failed-service-worker-registration).
    at Ze (registerDefaultSw.ts:43:25)
    at async updateSwReg.ts:27:37
    at async Xe (updateVapidKey.ts:28:26)
    DevTools failed to load source map: Could not load content for chrome-extension://clldacgmdnnanihiibdgemajcfkmfhia/contentScript.js.map: System error: net::ERR_BLOCKED_BY_CLIENT
    DevTools failed to load source map: Could not load content for chrome-extension://fheoggkfdfchfphceeifdbepaooicaho/sourceMap/chrome/scripts/_form_check.js.map: System error: net::ERR_BLOCKED_BY_CLIENT

    • @hacodes
      @hacodes  ปีที่แล้ว

      There is a JS file named firebase-cloud-messging-sw.js, move the file in root directory, so that the file is available on the path localhost/firebase-cloud-messging-sw.js. this will register a service worker

  • @Test-ey4db
    @Test-ey4db 11 หลายเดือนก่อน

    i cant recive payload in console.log

    • @hacodes
      @hacodes  11 หลายเดือนก่อน

      It will show only if your page is active, if you are trying to send notification on same device, your page becomes inactive, if there is issue in console or during sending, then reply me with error, I'll try to solve.

    • @Test-ey4db
      @Test-ey4db 11 หลายเดือนก่อน

      @@hacodes thank you, but they denied permission

    • @hacodes
      @hacodes  11 หลายเดือนก่อน

      Where permission denied?