Push Notification Service

A push notification is a message that pops up on a mobile devices and websites. For better communication and to increase engagement for your loyalty program participants using mobile app you can integrate Open Loyalty platform with PUSHY.ME

Pushy is push notification gateway, which can be used to send pursh notification to each user that install app version or visits your website and registers for push notifications. A unique device token token is assign to each customer to identify him and send personalized notification.

Warning

Customer, within first website visit, need to accept notification receiving. Then unique device token is assigned.

Token assignement will fail if the user declines the Web Push permission dialog. In that case notification will not be sent.

You need to pass these device tokens to OpenLoyalty via /api/customer/{customer}/pushy-token endpoint.

Push Notification Service

Currently, Open Loyalty supports one notification about new reward campaign available for customer

Text of displaying notification is provided by you during reward campaign creation. More information about reward campaigns you will find here

Note

To integrate Open Loyalty platform with Pushy gateway firstly, you have to create an account in Pushy.

The data from your account will be needed to set up integration (API authentication section)

To set up integration with Pushy:

  1. Tap the Settings icon settings in the upper-right corner and choose Configuration on the menu.
  1. Scroll down to Push Notification Service section
  2. To integrate with Pushy in Pushy API secret key field provide your Pushy ApiSecret string (API authentication section from your Pushy account)
  3. When it is done, tap SAVE

Warning

To display push notification, only API key is not enough

You have to put some code into your app or/and website application codebase. Documentation on how to do this can be found on the official pushy website https://pushy.me/docs/web-push

Below, you will find example code that can be used to test notifications.

<!DOCTYPE html>
<html lang="pl" dir="ltr">
   <head>
      <meta charset="utf-8">
      <title></title>
   </head>
   <body>
      Hello!
      <script src="https://sdk.pushy.me/web/1.0.2/pushy-sdk.js"></script>
      <script>
         // Register device for push notifications
         Pushy.register({ appId: '%APP-ID%' }).then(function (deviceToken) {
            // Print device token to console
            console.log('Pushy device token: ' + deviceToken);

            // Send the token to your backend server via an HTTP GET request
            // $.post('%your-api%/api/customer/{customer}/pushy-token/', { 'customer': { 'pushyToken': deviceToken; }});

            // Succeeded, optionally do something to alert the user
         }).catch(function (err) {
            // Handle registration errors
            console.error(err);
         });
      </script>
    </body>
   </html>

Tip

You can find more information about PUSHY and push notification mechanism on the official pushy website: ``https://pushy.me/docs/web-push``