JSPM

  • Created
  • Published
  • Downloads 747
  • Score
    100M100P100Q144930F
  • License MIT

Pushwoosh web push notifications

Package Exports

  • web-push-notifications
  • web-push-notifications/npm.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (web-push-notifications) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Pushwoosh Web Push Notification SDK

GitHub release npm platforms

Download Guide Sample

Integration

  • Download Pushwoosh Web Push SDK and unzip it. You should have the following files: pushwoosh-service-worker.js

  • Place all these files to top-level root of your website directory.

Installation

via npm

npm install web-push-notifications --save

via html

<script type="text/javascript" src="//cdn.pushwoosh.com/webpush/v3/pushwoosh-web-notifications.js" async></script>

Usage

import {Pushwoosh} from 'web-push-notifications';
const pwInstance = new Pushwoosh();
pwInstance.push(['init', {
    logLevel: 'info', // possible values: error, info, debug
    applicationCode: 'XXXXX-XXXXX', // you application code from Pushwoosh Control Panel
    safariWebsitePushID: 'web.com.example.domain', //  unique reverse-domain string, obtained in you Apple Developer Portal. Only needed if you send push notifications to Safari browser
    defaultNotificationTitle: 'Pushwoosh', // sets a default title for push notifications
    defaultNotificationImage: 'https://yoursite.com/img/logo-medium.png', // URL to custom custom notification image
    autoSubscribe: false, // or true. If true, prompts a user to subscribe for pushes upon SDK initialization
    subscribeWidget: {
      enable: true
    },
    userId: 'user_id', // optional, set custom user ID
    tags: {
        'Name': 'John Smith'   	// optional, set custom Tags
    }
}]);

pwInstance.push(function(api) {
  console.log('Pushwoosh ready');
});
Chrome Guide Firefox Guide Safari Guide HTTP integration Guide Subscription Button Guide