Core Boxx – Push Notifications Module

INTRODUCTION

This is a simple web push module for Core Boxx. Use the force to send push notifications.

 

LICENSE & DOWNLOAD

Core Boxx is released under the MIT License. You are free to use it for personal and commercial projects, and modify it as you see fit. On the condition that the software is provided “as-is”. There are no warranties provided and “no strings attached”. Code Boxx and the authors are not liable for any claims, damages, or liabilities.

Download Core Boxx Push Notification Module | GitHubSource Forge

 

INSTALLATION

  • Import lib/SQL-WebPush.sql into your database.
  • Enable the push notifications section in lib/CORE-Config.php.
  • Access http://site.com/push/1 and copy the private/public keys into lib/CORE-Config.php.
  • Access http://site.com/push/2 and allow notifications to show.
  • Access http://site.com/push/3 and send a test notification.

 

 

FILES LIST

  • lib/webpush.php PHP Web Push By Minishlink.
  • lib/LIB-Push.php Web Push library.
  • lib/API-Push.php Web Push API.
  • pages/PAGE-push-1.php Step 1 – Generate VAPID keys.
  • pages/PAGE-push-2.php Step 2 – Register service worker and get permission.
  • pages/PAGE-push-3.php Step 3- Send test push notification.
  • CB-push-worker.js Web push service worker.

 

LIBRARY REFERENCE

WEB PUSH SUBSCRIBERS TABLE

Field Description
endpoint Primary key.
data JSON encoded subscriber object.

 

WEB PUSH LIBRARY FUNCTIONS

save($endpoint, $sub)

Save a subscriber.

  • $endpoint String, endpoint URL.
  • $sub String, JSON encoded subscriber object.
del($id)

Delete subscriber.

  • $endpoint String, endpoint URL.
send($title, $body, $icon, $image)

Send a push notification to all subscribers.

  • $title String, title of message.
  • $body String, text.
  • $icon String, URL of icon.
  • $image String, URL of background image.

 

WEB PUSH API FUNCTIONS

Accessible at http://yoursite.com/api/push/REQUEST/. These are pretty much a replica of the above library functions, except in REST API format.

api/push/save/

Save subscriber.

  • $_POST["endpoint"] String, endpoint URL.
  • $_POST["sub"] String, JSON encoded subscriber object.
api/push/del/

Delete a subscriber.

  • $_POST["endpoint"] String, endpoint URL.
api/push/send/

Send a push notification.

  • $_POST["title"] String, title of message.
  • $_POST["body"] String, text.
  • $_POST["icon"] String, URL of icon.
  • $_POST["image"] String, URL of background image.

 

Leave a Comment

Your email address will not be published.