To add Zaap SDK to your project you can use one of the solutions below.
npm install -S zaap-sdk
# or
yarn add zaap-sdk
<script src="<https://unpkg.com/zaap-sdk@latest/dist/index.js>" type="text/javascript"></script>
Before sending a notification to your user you need to ask his permission.
Zaap.ZaapPlatform.registerForNotifications()
.then(console.log)
.catch(console.error)
registerForNotifications will return if the user allows push notifications. You can allow using the method below to know it.
Zaap.ZaapPlatform.isRegisteredForNotifications()
.then(console.log)
.catch(console.error)
setExternalId will return the installation.
Zaap.ZaapPlatform.setExternalId('[email protected]')
.then(console.log)
.catch(console.error)
Zaap.ZaapPlatform.getInstallation()
.then(console.log)
.catch(console.error)