SlideShare a Scribd company logo
WEB PUSH
NOTIFICATIONS
DONE RIGHT
Maxim Salnikov
@webmaxru
What is web push
and how to start using it the right way
Maxim Salnikov
• Developer Engagement Lead at Microsoft
• Web Platform tech speaker, writer, trainer
TWITTER: @WEBMAXRU GITHUB: @WEBMAXRU SETTINGS
webmax.ru
Icon Title Body Actions Image
Why Push Notifications?
• Delivered regardless of app/browser state
• High opt-in (79.5%) and direct open (5%) rates*
• Delivery channel is free and reliable
• Rich format capabilities for better engagement
• Easy and fast to set up and start sending
*Data: Airship 2023 Push Notification Benchmarks, median for Android
Milestones
2000
Push Service in
Blackberry –
instant
notification
about a new
email received
2009
Apple Push
Notification
Service on iOS
3.0
Google’s
Android Cloud
To Device
Messaging
2013
Google Cloud
Messaging for
Chrome Apps
and Extensions
APNS for Safari
on OS X 10.9
2015
Web Push API in
Chrome 42
Web Push API in
Firefox 44
Windows
Notification
Service extended
2023
In production on
all major
platforms – after
iOS 16.4 and
Safari on macOS
13 joined.
https://caniuse.com/push-api
80%
of the users
Availability
Web Push prerequisites
• Notifications API and Web Push API are available
• Service Worker is registered and active
• Valid code for the “push” event
• Notifications are allowed for the origin and browser
• On iOS: app is added to the Home Screen
• Device is online
Subscription
User’s device
Backend
2. pushManager.subscribe()
3. pushSubscription {}
"pushSubscription": {
"endpoint": "https://...",
"keys": {
"p256dh": "BKfnjyWE...",
"auth": "iklyQDz..."
}
}
web.push.apple.com
fcm.googleapis.com
push.services.mozilla.com
notify.windows.com
Messaging service
VAPID public key
VAPID private key
Sending notification
User’s device
Backend
Messaging service
2. “push” event to SW + payload
addEventListener('push', (event) => {
showNotification(payload);
});
npm install web-push
'notificationclick'
'notificationclose'
LET’S SUBSCRIBE
Notification permission request -> Subscribing -> Saving subscription
9/3/20XX
Politeness is a must
• Consider alternatives first
• Initiate subscription flow only after explicit user action
• Show pre-request UI with a content and frequency explained
• Confirm by UI that unsubscribing is possible at any time
• Separate notification permission request and subscription
Requesting permission
Notification.requestPermission().then((result) => {
if (result !== 'granted') {
// Plan B on convincing user needed
} else {
// OK to proceed with subscription
}
});
Subscribing
navigator.serviceWorker.getRegistration().then((registration) =>
{
registration.pushManager
.subscribe({
userVisibleOnly: true,
applicationServerKey: VAPID_PUBLIC_KEY,
})
.then((pushSubscription) => {
// Send pushSubscription to the backend. Add context.
});
});
TIME TO PUSH!
Call messaging service -> Process “push” event -> Process actions
9/3/20XX
Notification object
{
"title": "Push.Foo Notification Title",
"actions": [
{
"action": "open_project_repo",
"title": "Show source code"
}
],
"body": "Test notification body",
"image": "https://push.foo/images/social.png",
"icon": "https://push.foo/images/logo.jpg",
"badge": "https://push.foo/images/logo-mask.png",
"requireInteraction": "true",
"tag": "tag"
}
Your best notification
• Transactional, not promotional
• Timely, personal, relevant
• Contains information itself, not just “click to see”
• Contains call-to-action
• Does not repeat itself
• Use emoji🤷
Your OSL->LHR flight✈️
Click here to check-in
fooairline.com
FooAirline ltd.
Online check-in is available
fooairline.com
You can use “push” event to
• Fetch extra data from the backend to use in the notification
• Message a client – for example, to update app UI or icon via
Badging API
• Gather analytics
• Call self.registration.showNotification() – it’s the
only required action
In the service worker
self.addEventListener('push', (event) => {
notification = event.data.json();
const showNotificationPromise = self.registration.showNotification(
notificationData.title,
notificationData
);
const promiseChain = Promise.allSettled([
messageClientPromise,
showNotificationPromise,
]);
event.waitUntil(promiseChain);
});
Use “notificationclick” to
• Open a browser or installed app
• Focus an existing tab with the app
• Use feature detection to check if multiple actions are
available
if ('actions' in window.Notification?.prototype) {}
• Attach analytics code
Summary
• Web Push feature is very
powerful for the businesses and
convenient for the users
• Currently available on all major
platforms
• To keep it relevant, it’s
important to avoid misusing
• Services like OneSignal, Pusher,
Airship etc. can help with a
backend component (and not
only)
IMAGE: PUSH NOTIFICATIONS UI KIT BY ONESIGNAL
Instant Web Push
notification test
- Playground for the Web Push API
- Entire flow from requesting permission to
sending the notification
- Sending to multiple devices
- Specifications, API references, guides + this
deck
HTTPS://PUSH.FOO
LET’S CONNECT
AND CHAT
Maxim Salnikov
salnikov@gmail.com
@webmaxru

More Related Content

What's hot

Artificial intelligence in practice- part-1
Artificial intelligence in practice- part-1Artificial intelligence in practice- part-1
Artificial intelligence in practice- part-1
GMR Group
 
Simplifying AI and Machine Learning with Watson Studio
Simplifying AI and Machine Learning with Watson StudioSimplifying AI and Machine Learning with Watson Studio
Simplifying AI and Machine Learning with Watson Studio
DataWorks Summit
 
Web 4.0
Web 4.0Web 4.0
Web 4.0
Ross Tweedie
 
Unemployment due to AI
Unemployment due to AI Unemployment due to AI
Unemployment due to AI
AditiAgrawal588151
 
RSP4J: An API for RDF Stream Processing
RSP4J: An API for RDF Stream ProcessingRSP4J: An API for RDF Stream Processing
RSP4J: An API for RDF Stream Processing
Riccardo Tommasini
 
OEB 2023 Co-learning To Speed Up AI Implementation in Courses.pptx
OEB 2023 Co-learning To Speed Up AI Implementation in Courses.pptxOEB 2023 Co-learning To Speed Up AI Implementation in Courses.pptx
OEB 2023 Co-learning To Speed Up AI Implementation in Courses.pptx
Inge de Waard
 
Generative AI
Generative AIGenerative AI
Generative AI
Carlos J. Costa
 
Testing of artificial intelligence; AI quality engineering skils - an introdu...
Testing of artificial intelligence; AI quality engineering skils - an introdu...Testing of artificial intelligence; AI quality engineering skils - an introdu...
Testing of artificial intelligence; AI quality engineering skils - an introdu...
Rik Marselis
 
AI Agent and Chatbot Trends For Enterprises
AI Agent and Chatbot Trends For EnterprisesAI Agent and Chatbot Trends For Enterprises
AI Agent and Chatbot Trends For Enterprises
Teewee Ang
 
Artificial Intelligence | Introduction to AI | What is ai?
Artificial Intelligence | Introduction to AI |  What is ai?Artificial Intelligence | Introduction to AI |  What is ai?
Artificial Intelligence | Introduction to AI | What is ai?
SumitKumarShukla2
 
Implementing Ethics in AI
Implementing Ethics in AIImplementing Ethics in AI
Implementing Ethics in AI
Pekka Abrahamsson / Tampere University
 
Digital Governance & Artificial Intelligence
Digital Governance & Artificial IntelligenceDigital Governance & Artificial Intelligence
Digital Governance & Artificial Intelligence
Yannis Charalabidis
 
Uses of AI text bot.pdf
Uses of AI text bot.pdfUses of AI text bot.pdf
Uses of AI text bot.pdf
SreeNivas983124
 
AI and Accountability
AI and AccountabilityAI and Accountability
AI and Accountability
Hiroshi Nakagawa
 
Design Ethics for Artificial Intelligence
Design Ethics for Artificial IntelligenceDesign Ethics for Artificial Intelligence
Design Ethics for Artificial Intelligence
Charbel Zeaiter
 
An Introduction to Generative AI
An Introduction  to Generative AIAn Introduction  to Generative AI
An Introduction to Generative AI
Cori Faklaris
 
ng-owasp: OWASP Top 10 for AngularJS Applications
ng-owasp: OWASP Top 10 for AngularJS Applicationsng-owasp: OWASP Top 10 for AngularJS Applications
ng-owasp: OWASP Top 10 for AngularJS Applications
Kevin Hakanson
 
Building and using ontologies
Building and using ontologies Building and using ontologies
Building and using ontologies
Elena Simperl
 
CHATGPT VS BARD AI
CHATGPT VS BARD AICHATGPT VS BARD AI
CHATGPT VS BARD AI
RajaSubramanianV
 

What's hot (20)

Artificial intelligence in practice- part-1
Artificial intelligence in practice- part-1Artificial intelligence in practice- part-1
Artificial intelligence in practice- part-1
 
Simplifying AI and Machine Learning with Watson Studio
Simplifying AI and Machine Learning with Watson StudioSimplifying AI and Machine Learning with Watson Studio
Simplifying AI and Machine Learning with Watson Studio
 
Web 4.0
Web 4.0Web 4.0
Web 4.0
 
Unemployment due to AI
Unemployment due to AI Unemployment due to AI
Unemployment due to AI
 
RSP4J: An API for RDF Stream Processing
RSP4J: An API for RDF Stream ProcessingRSP4J: An API for RDF Stream Processing
RSP4J: An API for RDF Stream Processing
 
OEB 2023 Co-learning To Speed Up AI Implementation in Courses.pptx
OEB 2023 Co-learning To Speed Up AI Implementation in Courses.pptxOEB 2023 Co-learning To Speed Up AI Implementation in Courses.pptx
OEB 2023 Co-learning To Speed Up AI Implementation in Courses.pptx
 
Generative AI
Generative AIGenerative AI
Generative AI
 
Testing of artificial intelligence; AI quality engineering skils - an introdu...
Testing of artificial intelligence; AI quality engineering skils - an introdu...Testing of artificial intelligence; AI quality engineering skils - an introdu...
Testing of artificial intelligence; AI quality engineering skils - an introdu...
 
AI Agent and Chatbot Trends For Enterprises
AI Agent and Chatbot Trends For EnterprisesAI Agent and Chatbot Trends For Enterprises
AI Agent and Chatbot Trends For Enterprises
 
Artificial Intelligence | Introduction to AI | What is ai?
Artificial Intelligence | Introduction to AI |  What is ai?Artificial Intelligence | Introduction to AI |  What is ai?
Artificial Intelligence | Introduction to AI | What is ai?
 
Implementing Ethics in AI
Implementing Ethics in AIImplementing Ethics in AI
Implementing Ethics in AI
 
Digital Governance & Artificial Intelligence
Digital Governance & Artificial IntelligenceDigital Governance & Artificial Intelligence
Digital Governance & Artificial Intelligence
 
Uses of AI text bot.pdf
Uses of AI text bot.pdfUses of AI text bot.pdf
Uses of AI text bot.pdf
 
Search Engine
Search EngineSearch Engine
Search Engine
 
AI and Accountability
AI and AccountabilityAI and Accountability
AI and Accountability
 
Design Ethics for Artificial Intelligence
Design Ethics for Artificial IntelligenceDesign Ethics for Artificial Intelligence
Design Ethics for Artificial Intelligence
 
An Introduction to Generative AI
An Introduction  to Generative AIAn Introduction  to Generative AI
An Introduction to Generative AI
 
ng-owasp: OWASP Top 10 for AngularJS Applications
ng-owasp: OWASP Top 10 for AngularJS Applicationsng-owasp: OWASP Top 10 for AngularJS Applications
ng-owasp: OWASP Top 10 for AngularJS Applications
 
Building and using ontologies
Building and using ontologies Building and using ontologies
Building and using ontologies
 
CHATGPT VS BARD AI
CHATGPT VS BARD AICHATGPT VS BARD AI
CHATGPT VS BARD AI
 

Similar to Web Push Notifications done right

Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha
 
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
DataLeader.io
 
Building an Appier Web - London Web Standards - Nov 2016
Building an Appier Web -  London Web Standards - Nov 2016Building an Appier Web -  London Web Standards - Nov 2016
Building an Appier Web - London Web Standards - Nov 2016
Andy Davies
 
Building an Appier Web - Velocity Amsterdam 2016
Building an Appier Web - Velocity Amsterdam 2016Building an Appier Web - Velocity Amsterdam 2016
Building an Appier Web - Velocity Amsterdam 2016
Andy Davies
 
Windows Phone 7 Unleashed Session 2
Windows Phone 7 Unleashed Session 2Windows Phone 7 Unleashed Session 2
Windows Phone 7 Unleashed Session 2
Wes Yanaga
 
Progressive Web Apps
Progressive Web AppsProgressive Web Apps
Progressive Web Apps
Software Infrastructure
 
Research Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and ScienceResearch Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and Science
researchinventy
 
SharePoint Fest DC - Everything your need to know about the Microsoft Graph a...
SharePoint Fest DC - Everything your need to know about the Microsoft Graph a...SharePoint Fest DC - Everything your need to know about the Microsoft Graph a...
SharePoint Fest DC - Everything your need to know about the Microsoft Graph a...
Sébastien Levert
 
SharePoint Fest Seattle 2017 - Everything your need to know about the Microso...
SharePoint Fest Seattle 2017 - Everything your need to know about the Microso...SharePoint Fest Seattle 2017 - Everything your need to know about the Microso...
SharePoint Fest Seattle 2017 - Everything your need to know about the Microso...
Sébastien Levert
 
Windows Azure: Connecting the Dots for a Mobile Workforce
Windows Azure: Connecting the Dots for a Mobile WorkforceWindows Azure: Connecting the Dots for a Mobile Workforce
Windows Azure: Connecting the Dots for a Mobile Workforce
TechWell
 
Azure Mobile Service - Techdays 2014
Azure Mobile Service - Techdays 2014Azure Mobile Service - Techdays 2014
Azure Mobile Service - Techdays 2014
Puja Pramudya
 
Building Messenger Bots
Building Messenger BotsBuilding Messenger Bots
Building Messenger Bots
BlitzMetrics
 
Google external login setup in ASP (1).pdf
Google external login setup in ASP  (1).pdfGoogle external login setup in ASP  (1).pdf
Google external login setup in ASP (1).pdf
findandsolve .com
 
Bootstrapping an App for Launch
Bootstrapping an App for LaunchBootstrapping an App for Launch
Bootstrapping an App for Launch
Craig Phares
 
SPS Utah - Everything your need to know about the Microsoft Graph as a ShareP...
SPS Utah - Everything your need to know about the Microsoft Graph as a ShareP...SPS Utah - Everything your need to know about the Microsoft Graph as a ShareP...
SPS Utah - Everything your need to know about the Microsoft Graph as a ShareP...
Sébastien Levert
 
Building Offline Ready and Installable Web App
Building Offline Ready and Installable Web AppBuilding Offline Ready and Installable Web App
Building Offline Ready and Installable Web App
Muhammad Samu
 
Mobile March Windows Azure Notification Hubs
Mobile March Windows Azure Notification HubsMobile March Windows Azure Notification Hubs
Mobile March Windows Azure Notification Hubs
Adam Grocholski
 
Progressive Web Apps 101
Progressive Web Apps 101Progressive Web Apps 101
Progressive Web Apps 101
Muhammad Samu
 
Progressive Web Apps with LitHTML (BucharestJS Meetup)
Progressive Web Apps with LitHTML (BucharestJS Meetup)Progressive Web Apps with LitHTML (BucharestJS Meetup)
Progressive Web Apps with LitHTML (BucharestJS Meetup)
Razvan Rosu
 
App engine devfest_mexico_10
App engine devfest_mexico_10App engine devfest_mexico_10
App engine devfest_mexico_10Chris Schalk
 

Similar to Web Push Notifications done right (20)

Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
Sencha Roadshow 2017: Build Progressive Web Apps with Ext JS and Cmd
 
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
 
Building an Appier Web - London Web Standards - Nov 2016
Building an Appier Web -  London Web Standards - Nov 2016Building an Appier Web -  London Web Standards - Nov 2016
Building an Appier Web - London Web Standards - Nov 2016
 
Building an Appier Web - Velocity Amsterdam 2016
Building an Appier Web - Velocity Amsterdam 2016Building an Appier Web - Velocity Amsterdam 2016
Building an Appier Web - Velocity Amsterdam 2016
 
Windows Phone 7 Unleashed Session 2
Windows Phone 7 Unleashed Session 2Windows Phone 7 Unleashed Session 2
Windows Phone 7 Unleashed Session 2
 
Progressive Web Apps
Progressive Web AppsProgressive Web Apps
Progressive Web Apps
 
Research Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and ScienceResearch Inventy : International Journal of Engineering and Science
Research Inventy : International Journal of Engineering and Science
 
SharePoint Fest DC - Everything your need to know about the Microsoft Graph a...
SharePoint Fest DC - Everything your need to know about the Microsoft Graph a...SharePoint Fest DC - Everything your need to know about the Microsoft Graph a...
SharePoint Fest DC - Everything your need to know about the Microsoft Graph a...
 
SharePoint Fest Seattle 2017 - Everything your need to know about the Microso...
SharePoint Fest Seattle 2017 - Everything your need to know about the Microso...SharePoint Fest Seattle 2017 - Everything your need to know about the Microso...
SharePoint Fest Seattle 2017 - Everything your need to know about the Microso...
 
Windows Azure: Connecting the Dots for a Mobile Workforce
Windows Azure: Connecting the Dots for a Mobile WorkforceWindows Azure: Connecting the Dots for a Mobile Workforce
Windows Azure: Connecting the Dots for a Mobile Workforce
 
Azure Mobile Service - Techdays 2014
Azure Mobile Service - Techdays 2014Azure Mobile Service - Techdays 2014
Azure Mobile Service - Techdays 2014
 
Building Messenger Bots
Building Messenger BotsBuilding Messenger Bots
Building Messenger Bots
 
Google external login setup in ASP (1).pdf
Google external login setup in ASP  (1).pdfGoogle external login setup in ASP  (1).pdf
Google external login setup in ASP (1).pdf
 
Bootstrapping an App for Launch
Bootstrapping an App for LaunchBootstrapping an App for Launch
Bootstrapping an App for Launch
 
SPS Utah - Everything your need to know about the Microsoft Graph as a ShareP...
SPS Utah - Everything your need to know about the Microsoft Graph as a ShareP...SPS Utah - Everything your need to know about the Microsoft Graph as a ShareP...
SPS Utah - Everything your need to know about the Microsoft Graph as a ShareP...
 
Building Offline Ready and Installable Web App
Building Offline Ready and Installable Web AppBuilding Offline Ready and Installable Web App
Building Offline Ready and Installable Web App
 
Mobile March Windows Azure Notification Hubs
Mobile March Windows Azure Notification HubsMobile March Windows Azure Notification Hubs
Mobile March Windows Azure Notification Hubs
 
Progressive Web Apps 101
Progressive Web Apps 101Progressive Web Apps 101
Progressive Web Apps 101
 
Progressive Web Apps with LitHTML (BucharestJS Meetup)
Progressive Web Apps with LitHTML (BucharestJS Meetup)Progressive Web Apps with LitHTML (BucharestJS Meetup)
Progressive Web Apps with LitHTML (BucharestJS Meetup)
 
App engine devfest_mexico_10
App engine devfest_mexico_10App engine devfest_mexico_10
App engine devfest_mexico_10
 

More from Maxim Salnikov

Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?
Maxim Salnikov
 
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
Maxim Salnikov
 
Building Generative AI-infused apps: what's possible and how to start
Building Generative AI-infused apps: what's possible and how to startBuilding Generative AI-infused apps: what's possible and how to start
Building Generative AI-infused apps: what's possible and how to start
Maxim Salnikov
 
ChatGPT and not only: how can you use the power of Generative AI at scale
ChatGPT and not only: how can you use the power of Generative AI at scaleChatGPT and not only: how can you use the power of Generative AI at scale
ChatGPT and not only: how can you use the power of Generative AI at scale
Maxim Salnikov
 
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
Maxim Salnikov
 
ChatGPT and not only: How to use the power of GPT-X models at scale
ChatGPT and not only: How to use the power of GPT-X models at scaleChatGPT and not only: How to use the power of GPT-X models at scale
ChatGPT and not only: How to use the power of GPT-X models at scale
Maxim Salnikov
 
Using the power of Generative AI at scale
Using the power of Generative AI at scaleUsing the power of Generative AI at scale
Using the power of Generative AI at scale
Maxim Salnikov
 
The Status of Angular v13
The Status of Angular v13The Status of Angular v13
The Status of Angular v13
Maxim Salnikov
 
Azure cloud for the web frontend developers
Azure cloud for the web frontend developersAzure cloud for the web frontend developers
Azure cloud for the web frontend developers
Maxim Salnikov
 
[Russian] Сервис-воркеры: используем накопленные знания для светлого будущего...
[Russian] Сервис-воркеры: используем накопленные знания для светлого будущего...[Russian] Сервис-воркеры: используем накопленные знания для светлого будущего...
[Russian] Сервис-воркеры: используем накопленные знания для светлого будущего...
Maxim Salnikov
 
[Russian] Прогрессивные веб-приложения: по-настоящему кросс-платформенный опыт
[Russian] Прогрессивные веб-приложения: по-настоящему кросс-платформенный опыт[Russian] Прогрессивные веб-приложения: по-настоящему кросс-платформенный опыт
[Russian] Прогрессивные веб-приложения: по-настоящему кросс-платформенный опыт
Maxim Salnikov
 
Securing Connected Cars Requires Digital Identity
Securing Connected Cars Requires Digital IdentitySecuring Connected Cars Requires Digital Identity
Securing Connected Cars Requires Digital Identity
Maxim Salnikov
 
How to Make Your IoT Devices Secure, Act Autonomously & Trusted Subjects
How to Make Your IoT Devices Secure, Act Autonomously & Trusted SubjectsHow to Make Your IoT Devices Secure, Act Autonomously & Trusted Subjects
How to Make Your IoT Devices Secure, Act Autonomously & Trusted Subjects
Maxim Salnikov
 

More from Maxim Salnikov (13)

Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?
 
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
 
Building Generative AI-infused apps: what's possible and how to start
Building Generative AI-infused apps: what's possible and how to startBuilding Generative AI-infused apps: what's possible and how to start
Building Generative AI-infused apps: what's possible and how to start
 
ChatGPT and not only: how can you use the power of Generative AI at scale
ChatGPT and not only: how can you use the power of Generative AI at scaleChatGPT and not only: how can you use the power of Generative AI at scale
ChatGPT and not only: how can you use the power of Generative AI at scale
 
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
If your code could speak, what would it tell you? Let GitHub Copilot Chat hel...
 
ChatGPT and not only: How to use the power of GPT-X models at scale
ChatGPT and not only: How to use the power of GPT-X models at scaleChatGPT and not only: How to use the power of GPT-X models at scale
ChatGPT and not only: How to use the power of GPT-X models at scale
 
Using the power of Generative AI at scale
Using the power of Generative AI at scaleUsing the power of Generative AI at scale
Using the power of Generative AI at scale
 
The Status of Angular v13
The Status of Angular v13The Status of Angular v13
The Status of Angular v13
 
Azure cloud for the web frontend developers
Azure cloud for the web frontend developersAzure cloud for the web frontend developers
Azure cloud for the web frontend developers
 
[Russian] Сервис-воркеры: используем накопленные знания для светлого будущего...
[Russian] Сервис-воркеры: используем накопленные знания для светлого будущего...[Russian] Сервис-воркеры: используем накопленные знания для светлого будущего...
[Russian] Сервис-воркеры: используем накопленные знания для светлого будущего...
 
[Russian] Прогрессивные веб-приложения: по-настоящему кросс-платформенный опыт
[Russian] Прогрессивные веб-приложения: по-настоящему кросс-платформенный опыт[Russian] Прогрессивные веб-приложения: по-настоящему кросс-платформенный опыт
[Russian] Прогрессивные веб-приложения: по-настоящему кросс-платформенный опыт
 
Securing Connected Cars Requires Digital Identity
Securing Connected Cars Requires Digital IdentitySecuring Connected Cars Requires Digital Identity
Securing Connected Cars Requires Digital Identity
 
How to Make Your IoT Devices Secure, Act Autonomously & Trusted Subjects
How to Make Your IoT Devices Secure, Act Autonomously & Trusted SubjectsHow to Make Your IoT Devices Secure, Act Autonomously & Trusted Subjects
How to Make Your IoT Devices Secure, Act Autonomously & Trusted Subjects
 

Recently uploaded

In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
MayankTawar1
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
Jelle | Nordend
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
Peter Caitens
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
XfilesPro
 
Why React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdfWhy React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdf
ayushiqss
 

Recently uploaded (20)

In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Software Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdfSoftware Testing Exam imp Ques Notes.pdf
Software Testing Exam imp Ques Notes.pdf
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
How Does XfilesPro Ensure Security While Sharing Documents in Salesforce?
 
Why React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdfWhy React Native as a Strategic Advantage for Startup Innovation.pdf
Why React Native as a Strategic Advantage for Startup Innovation.pdf
 

Web Push Notifications done right

  • 2. What is web push and how to start using it the right way
  • 3. Maxim Salnikov • Developer Engagement Lead at Microsoft • Web Platform tech speaker, writer, trainer TWITTER: @WEBMAXRU GITHUB: @WEBMAXRU SETTINGS webmax.ru Icon Title Body Actions Image
  • 4. Why Push Notifications? • Delivered regardless of app/browser state • High opt-in (79.5%) and direct open (5%) rates* • Delivery channel is free and reliable • Rich format capabilities for better engagement • Easy and fast to set up and start sending *Data: Airship 2023 Push Notification Benchmarks, median for Android
  • 5. Milestones 2000 Push Service in Blackberry – instant notification about a new email received 2009 Apple Push Notification Service on iOS 3.0 Google’s Android Cloud To Device Messaging 2013 Google Cloud Messaging for Chrome Apps and Extensions APNS for Safari on OS X 10.9 2015 Web Push API in Chrome 42 Web Push API in Firefox 44 Windows Notification Service extended 2023 In production on all major platforms – after iOS 16.4 and Safari on macOS 13 joined.
  • 7. Web Push prerequisites • Notifications API and Web Push API are available • Service Worker is registered and active • Valid code for the “push” event • Notifications are allowed for the origin and browser • On iOS: app is added to the Home Screen • Device is online
  • 8. Subscription User’s device Backend 2. pushManager.subscribe() 3. pushSubscription {} "pushSubscription": { "endpoint": "https://...", "keys": { "p256dh": "BKfnjyWE...", "auth": "iklyQDz..." } } web.push.apple.com fcm.googleapis.com push.services.mozilla.com notify.windows.com Messaging service VAPID public key VAPID private key
  • 9. Sending notification User’s device Backend Messaging service 2. “push” event to SW + payload addEventListener('push', (event) => { showNotification(payload); }); npm install web-push 'notificationclick' 'notificationclose'
  • 10. LET’S SUBSCRIBE Notification permission request -> Subscribing -> Saving subscription 9/3/20XX
  • 11. Politeness is a must • Consider alternatives first • Initiate subscription flow only after explicit user action • Show pre-request UI with a content and frequency explained • Confirm by UI that unsubscribing is possible at any time • Separate notification permission request and subscription
  • 12. Requesting permission Notification.requestPermission().then((result) => { if (result !== 'granted') { // Plan B on convincing user needed } else { // OK to proceed with subscription } });
  • 13. Subscribing navigator.serviceWorker.getRegistration().then((registration) => { registration.pushManager .subscribe({ userVisibleOnly: true, applicationServerKey: VAPID_PUBLIC_KEY, }) .then((pushSubscription) => { // Send pushSubscription to the backend. Add context. }); });
  • 14. TIME TO PUSH! Call messaging service -> Process “push” event -> Process actions 9/3/20XX
  • 15. Notification object { "title": "Push.Foo Notification Title", "actions": [ { "action": "open_project_repo", "title": "Show source code" } ], "body": "Test notification body", "image": "https://push.foo/images/social.png", "icon": "https://push.foo/images/logo.jpg", "badge": "https://push.foo/images/logo-mask.png", "requireInteraction": "true", "tag": "tag" }
  • 16. Your best notification • Transactional, not promotional • Timely, personal, relevant • Contains information itself, not just “click to see” • Contains call-to-action • Does not repeat itself • Use emoji🤷 Your OSL->LHR flight✈️ Click here to check-in fooairline.com FooAirline ltd. Online check-in is available fooairline.com
  • 17. You can use “push” event to • Fetch extra data from the backend to use in the notification • Message a client – for example, to update app UI or icon via Badging API • Gather analytics • Call self.registration.showNotification() – it’s the only required action
  • 18. In the service worker self.addEventListener('push', (event) => { notification = event.data.json(); const showNotificationPromise = self.registration.showNotification( notificationData.title, notificationData ); const promiseChain = Promise.allSettled([ messageClientPromise, showNotificationPromise, ]); event.waitUntil(promiseChain); });
  • 19. Use “notificationclick” to • Open a browser or installed app • Focus an existing tab with the app • Use feature detection to check if multiple actions are available if ('actions' in window.Notification?.prototype) {} • Attach analytics code
  • 20. Summary • Web Push feature is very powerful for the businesses and convenient for the users • Currently available on all major platforms • To keep it relevant, it’s important to avoid misusing • Services like OneSignal, Pusher, Airship etc. can help with a backend component (and not only) IMAGE: PUSH NOTIFICATIONS UI KIT BY ONESIGNAL
  • 21. Instant Web Push notification test - Playground for the Web Push API - Entire flow from requesting permission to sending the notification - Sending to multiple devices - Specifications, API references, guides + this deck HTTPS://PUSH.FOO
  • 22. LET’S CONNECT AND CHAT Maxim Salnikov salnikov@gmail.com @webmaxru