Published on December 14, 2016 by Chrome

Read the Firebase Cloud Messaging documentation: goo.gl/h3wBld

One of the coolest features to land in Chrome recently is the ability to send a user a push notification. These notifications may trigger in response to a user action or could just be used as a mechanism to notify the user when you launch some new content. Traditionally setting up push notifications has required a fair bit of JavaScript and Service Worker know-how. Thanks to polymerfire’s firebase-messaging element we can greatly simplify the process. Check out today’s episode as we cover the basics of setting up firebase-messaging and dispatching our first notification using CURL.

Sample Code
github.com/polymer/polycasts

Firebase Messaging on beta.webcomponents.org:
beta.webcomponents.org/element/firebase/polymerfire/firebase-messaging

Polycasts playlist: goo.gl/r5fsMq
Polymer Slack: bit.ly/polymerslack
Polymer G+: goo.gl/YC5Bsh

Subscribe to the Chrome Developers channel: goo.gl/OUF4e2

Leave a Reply

36 Comments on "Firebase Messaging — Polycasts #59"

Notify of
avatar

Denis TRUFFAUT
Guest
Denis TRUFFAUT
9 days 17 hours ago

@rob_dodson I'm not able to get the token after clicking yes on the notification approval, in my code or with yours. I use the polymerfire v0.10.3

Suyash Bansal
Guest
Suyash Bansal
24 days 43 minutes ago
I was trying the messaging feature described above. I am having 2 problems, one is that there is no token value saved in the firebase when I allow notifications in the browser & second is that I am not able to do curl. I am running Win10 and it gives this error:curl: (6) Could not resolve host: dgMc9xNHmHccurl: (6) Could not resolve host: notificationcurl: (3) [globbing] unmatched brace in column 1curl: (6) Could not resolve host: Hello World,curl: (6) Could not resolve host: bodycurl: (3) [globbing] unmatched close brace/bracket in column 23JSON_PARSING_ERROR: Unexpected character (') at position 0.What can I… Read more »
GuateDev IO
Guest
GuateDev IO
5 days 4 hours ago

It seems the issue is caused by the single quote. For windows try not to use single quotes, and escape any double quotes within the string. This example work for me: >>>>>> curl –header "Authorization: key=AAAA2aC_hss:APA91bHcFtbc0-1AqA5jSwHiTITx2YD4M00M63YzH91TxxSGtr1r8ph9MxQ61rm5gAk_eo10of1_jLw3pMpCB6qs0aZEguNqlU5yaZ-iuCdiD602M_rCc5VXkWAUmmifDdF7rvpO0Wt_U2tEPhkcMkj6ssdORgYRgw" –header "Content-Type: application/json" -d "{"to": "eD2TN30-pLI:APA91bGaUSNcPmWGDMRy-be5Y6bjRwgUT51dCCdrBfj-63_BtVWdsx61Vce7DR_bb6c2ZImV0kEft35n3pNZ3xCr0x50cLv-2T_aR-VxNprxZ62KBh9EY0lDnNyr4TwfOTHUcf0z_gbn", "notification": {"title": "Hello World", "body": "This is a notification"}}" fcm.googleapis.com/fcm/send

Brad Walters
Guest
Brad Walters
25 days 9 hours ago

:-):-)

Kevin Weekes
Guest
Kevin Weekes
26 days 4 minutes ago

#AskPolymer Will there be significant changes to building production-ready Firebase/Polymer apps when Polymer 2.0 is released?

Tony Trinh
Guest
Tony Trinh
26 days 7 hours ago

11:2611:31 That's me all day 😉

Michael Fons
Guest
Michael Fons
27 days 22 hours ago

amazing! thank you Rob!!!

Eric Diaz (Eric Diaz, MD)
Guest
Eric Diaz (Eric Diaz, MD)
28 days 12 hours ago

Thanks a bunch for another very helpful polymer firebase tutorial!I learned a bunch from this one that I really had no idea about despite fiddling around with polymerfire for a couple months. In particular thank you for touching on the point of when to use query vs document! :)I know that it's a lot of work to make these videos and they have to be focused. In the future, I would love to see a real example of seeing up the message send and also how to do the toast you mentioned.Thanks Rob!

Ario Artins
Guest
Ario Artins
1 month 1 day ago

Am sorry, to take you aback but would like to know if I can do polymer without learning javascript or which parts of javascript that are required. I would like to take on polymer as soon as possible but javascript is prooving to be lengthy to me.Thanx

julie lopez
Guest
julie lopez
18 days 21 hours ago

Ario Artins iklkhjloijhklll

Ario Artins
Guest
Ario Artins
21 days 5 hours ago

Thanx Mr.Rob

Rob Dodson
Guest
Rob Dodson
30 days 10 hours ago

You will need to learn JavaScript to work with Polymer

Alin Nemet
Guest
Alin Nemet
1 month 2 days ago

isnt this outdated!? i don't think we need to gcm sender id anymore, since chrome supports webpush protocol

PushEngage
Guest
PushEngage
1 month 2 days ago

Good one, Rob. If you want to do notifications across browsers using same underlying Firebase messaging, GCM, and Mozilla Cloud Manager, you can try PushEnage API.

1 2 3
wpDiscuz