Displaying items by tag: notifications

Monday, 07 November 2016 23:47

jBackend Community

jBackend Community is the lite version of jBackend available for free, no subscription required. It provides all the basic features to integrate Joomla content with mobile apps, syndication networks, affiliate networks and any external system, and it is mainly intended to give a chance to test jBackend capabilities, to develop and test new modules, and to provide some basic REST API integration features to a Joomla site.

When the upgrade to the full jBackend version is required, it is possible to install the full jBackend package over the Community version. The two versions share the same data tables and settings, and the upgrade process will preserve the configuration and all existing data.

The Community version is completely free, but doesn't provide the full functionalities available for jBackend. Here's a comparison matrix between jBackend Community and jBackend:

 

Features jBackend Community jBackend
Extensible through plugins to increase API and support any Joomla extension Yes
(2 plugins in the package)
Yes
(3 plugins in the package, 7+ included
with the subscription)
Support for publishing of multiple endpoints, each with its specific settings Yes Yes
Three endpoint access type (free access, user authenticated only, API Key required) No
(free only)
Yes
Tracing requests in the database for each endpoint Yes Yes
Selection of jBackend plugins to enable for each endpoint Yes Yes
API Key management interface No
(not used)
Yes
Request log management interface Yes Yes
Each API Key can have a max daily requests limit and an expiration date No
(not used)
Yes
Each API Key can be targeted on separate endpoints No
(not used)
Yes
Access control is compliant with integrated ACL No
(not used)
Yes
Support for REST compliant requests Yes Yes
JSON format for responses Yes Yes
Support for session ID No
(only cookies)
Yes
Get the list of articles by tag id (content module) No Yes
Support for push notifications on iOS (APNs) and Android (GCM) No Yes
Custom payload for push notifications No Yes
Scheduled sending of push notifications No Yes
Push notifications can be create and scheduled via API call No Yes
Push notifications can be targeted on selected users, groups or devices No Yes
License GPL 2.0 GPL 2.0
Price Free 14 € (one year subscription)
  Download jBackend Community Buy Subscription to jBackend

The basic extension package includes the jBackend component, that provides the general infrastructure for endpoints, and plugins support system. Also the following plugins are already included in the basic package:

  • User Module: provides support for Joomla users (e.g. login, logout, registration);
  • Content Module: provides support for standard Joomla content (e.g. categories and articles);

Additional plugins are available only with a valid jBackend Subscription and can be downloaded from here and installed separately. More info about jBackend can be found here

jBackend Community is released under GPL 2.0 license.

Published in Products

Since version 3, jBackend  introduced support for push notifications for Android and iOS, providing all needed functions to manage multiple mobile apps, to register devices and to send scheduled push notifications. The following video shows how to use jBackend to create a new application, to call the push register service to register a device, and the schedule and trigger a push notification.

Published in Newsblog
Wednesday, 11 November 2015 20:06

Notifications

To access to configured notifications go to menu Components > jBackend > Notifications. A list of notifications will be shown:

jBackend Notifications

Each notification has the following information:

Field: Description:
Title Notification title (used only on Android)
Message Notification message
Payload Payload of push notification for app (JSON format)
App App code
Platform OS platform
Target Target registered devices for the push notification (All, Selected users, Selected groups, Selected devices)
Target Users Users whose registered devices are target for the push notification
Target Groups Groups whose registered devices are target for the push notification
Target Devices Registerd devices target of the push notification
Context Application specific notification context. Not used yet (it will be used to filter recipients for push notifications)
Scheduled time Time scheduled to start sending out this notification on devices
Status Current sending status for this notification
Last run Last time this notification queue has been executed
Last device ID Device ID of the last notification sent in the last run

The Status of a notification can be:

Status: Description:
aborted (-2) The notification is "logically" deleted (in this state the notification is always skipped)
paused (-1) The notification is suspended (in this state the notification is always skipped)
scheduled (0) The notification is ready to be sent (sending will start at the scheduled time)
running (1) The notification is currently being processed
completed (2) The notification has been sent to all devices (job completed)

Using the buttons on the toolbar it is possible to change the status of selected notifications. It is also possible to "unlock" locked notifications. It could be useful, as example, when a notification is locked for too long, which could mean there was a problem on the scheduler and the resource was not released properly (see How notification sending works)

Since jBackend 3.3.0 each notification sent is logged into a database table. A management interface to access these logs will be provided in the next future.

How notification sending works

To start processing the pending notifications (with status scheduled and running) it is necessary to call a "trigger" function. The Push Module has a scheduler function that must be called on a regular basis (e.g. from a crontab) to trigger the sending of scheduled push notifications.

Scheduler logic

Each time the scheduler function is called, it select all pending notifications ordered by the scheduler time ascending (first the notification scheduled before). To be "pending" a notification must have a scheduled time less then current time, must be in status scheduled or running, and must be no locked (locked means the notification is currently in charge of another scheduler). If the pending list is not empty, the scheduler starts to process notifications once a time, until the total number of push notifications sent to devices reach the Batch size (max configured for the scheduler).

For the notification currently being processed, the scheduler first locks it, then start to send the notifications to all matching devices (sorted by device ID, so all devices will be checked only once, including new devices added while the notification is running) until the Batch size is reached or the devices are finished. In the first case the notification is unlocked and the scheduler ends. In the second case the notification state is set to completed, it is unlocked and the scheduler starts to process the next notification (if one) with the same rules.

With this processing logic it is possible to schedule and execute concurrent schedulers to increase volume of push notifications sent.

Push notification payload

It is possible to send a custom payload with each push notification. The payload must be a valid JSON, example:

{
  "alert": {
    "alertId": "1404999843555",
    "alertStatus": false
  }
}

Or:

{
  "id": "25"
}

How to get the JSON payload in the mobile app depends on the framework used. The following is an example using Ionic Framework with this Cordova Push notification plugin:

https://github.com/phonegap-build/PushPlugin

Android GCM

In the jBackend push plugin the payload hasthe following structure:

    $payload = array(
      'title'      => $notification['title'],
      'message'    => $notification['message'],
      'icon'       => 'icon',
      'data'       => $notification['payload']
    );

On the mobile app the push callback has the following code:

    window.onNotificationGCM = function(e) {
        switch (e.event) {
            case 'registered':
                if (e.regid.length > 0) {
                    $rootScope.$emit('push.registered', { 'token': e.regid });
                }
                break;
            case 'message':
                // Notification in foreground
                if (e.foreground) {
                    $log.debug('push notification in foreground');
                } else {
                    $log.debug('push notification in background');
                }
                $log.debug('push message payload ' + JSON.stringify(e.payload));
                $rootScope.$emit('push.received', { 'payload': e.payload.data });
                // e.payload.data is { "id": "25" }
                break;
            case 'error':
                $log.debug('push GCM error ' + e.msg);
                break;
            default:
                $log.debug('push GCM unknown event');
                break;
        }
    };

Apple APNs

In the jBackend push plugin the payload hasthe following structure:

    $body = array(
      'aps' => array(
          'alert' => array(
              'title' => $notification['title'],
              'body' => $notification['message']
          ),
          'sound' => 'default'
      ),
      'data' => $notification['payload']
    );

On the mobile app the push callback has the following code:

    window.onNotificationAPN = function(e) {
        if (e.alert) {
            $log.debug('push APN alert ' + e.alert);
        }
        if (e.sound) {
            $log.debug('push APN sound');
        }
        if (e.badge) {
            $log.debug('push APN badge ' + e.badge);
            pushNotification.setApplicationIconBadgeNumber(successBadgeHandler, errorBadgeHandler, e.badge);
        }
        $log.debug('push APN full event ' + JSON.stringify(e));
        $rootScope.$emit('push.received', JSON.parse(e.data));
        // e.data is { "id": "25" }
    };
Monday, 09 November 2015 23:57

Push Module API

The Push Module is implemented with the plg_jbackend_push plugin. It provides functions related to mobile push notifications for iOS and Android. Here is the list of supported methods.

Register

The register function must be called by mobile apps each time they get a notification token from the push service (e.g. APNs or FCM) to register the device on jBackend. Registration is needed to send push notifications to the app on the registered device.

Request parameters

action=put
module=push
resource=register
token=<token>
appcode=<appcode>
platform=<platform>
user_id=<user_id> (optional)
user_email=<user_email> (optional)
ios_alert=<true or 1> (optional)
ios_badge=<true or 1> (optional)
ios_sound=<true or 1> (optional)

Example

<end-point>?action=put&module=push&resource=register&token=<token>&appcode=<appcode>&platform=ios

Example (REST format)

<end-point>/put/push/register?token=<token>&appcode=<appcode>&platform=android

Response

{
    "status": "ok",
    "token": "<token>",
    "appcode": "<appcode>",
    "platform": "<generic|android|ios>",
    "platform_code": <platform_code>,
    "app_id": "<app_id>",
    "device_id": <device_id>,
    "ios_alert": <0|1>,
    "ios_badge": <0|1>,
    "ios_sound": <0|1>
}

Notes

Supported platform codes are 0=Generic, 1=Android, 2=iOS.

It is possible to associate an existing Joomla user to the device with the user_id param. If the plugin option Require user email is enabled, it is also needed to include the user_email field, and the email must match with the registered email address for the user with the specified user_id.

On iOS platform the app can also send (optionally) its notification settings for alert (ios_alert), badge (ios_badge), and sound (ios_sound). These values can be used to filter target devices when sending push notifications from jBackend.

 

Scheduler

The scheduler function must be called on a regular basis (e.g. from a crontab) to trigger the sending of scheduled push notifications.

Request parameters

action=get
module=push
resource=scheduler

Example

<end-point>?action=get&module=push&resource=scheduler

Example (REST format)

<end-point>/get/push/scheduler

Response

{
    "status": "ok",
    "batch_size": <N>,
    "sent": <T>,
    "success": <S>,
    "failure": <F>
}

Notes

Sent is the total number of processed notifications.

 

Notifications

This function allows to create a push notification programmatically (i.e. add a notification to the queue).

Request parameters

action=post
module=push
resource=notifications
title=<title>
message=<message>
app_code=<app_code>
platform=<platform>
target=<target>
target_users=<target_users>
target_groups=<target_groups>
target_devices=<target_devices>
scheduled_time=<scheduled_time>
payload=<payload> (optional)
context=<context> (optional)
auth_token=<auth_token> (optional)

Example

<end-point>?action=post&module=push&resource=notifications&title=<title>&message=<message>&app_code=<code>&platform=1&target=0&scheduled_time=2016-11-13%2000:15:31

Example (REST format)

<end-point>/post/push/notifications?title=<title>&message=<message>&app_code=<code>&platform=1&target=0&scheduled_time=2016-11-13%2000:15:31

Response

{
    "status": "ok"
}

Notes

Supported platform codes are 0=Generic, 1=Android, 2=iOS.

Supported target codes are 0=All, 1=Selected users, 2=Selected groups, 3=Selected devices.

Params target_users, target_groups and target_devices are comma separated list of id.

Scheduled time format is YYYY-MM-DD HH:MM:SS (e.g. 2016-07-23 00:19:11).

Params payload and context can be a string or a json.

 

Plugin Settings

jBackend Push Plugin Settings jBackend Push Plugin Settings Android jBackend Push Plugin Settings iOS

The following options are available for push plugin:

Option Description
Auto app registration Allow automatic creation of new applications by code.
Require user email Require the user email to add the user id when register a device (as a security measure).
JSON Register Enable JSON payload on register action.
JSON Notifications Enable JSON payload on add notification action.
Protect Notifications Enable token protection on add notification action.
Authorization Token The token that enables the add notification action.
Batch size Number of push messages to send out each batch job.
Log notifications Enable logging of all notifications in a dedicated database table (useful for analytics purposes).
FCM URL URL of Firebase Cloud Messaging server.
API key Google API key.
Use FCM Use FCM to send push messages on iOS too.
APNs URL URL of Apple APNs server.
Timeout APNs connection timeout.
Tuesday, 15 April 2014 00:00

jBackend

jBackend is a Joomla extension that gives you all the power of Joomla CMS through an extensible and pluggable set of REST API. With these API you can access to all site's contents and features, and use Joomla as a backend system for smartphone and mobile apps, syndication networks, external websites, and provide web services for any external system.

Furthermore jBackend provides a full push notifications platform for iOS and Android mobile apps. It allows to define multiple apps, to register devices for each app, and to schedule push notifications sending on registered devices, filtered by app and platform type.

Features

  • Extensible through plugins to increase API and support any Joomla extension;
  • Support for publishing of multiple endpoints, each with its specific settings;
  • Three endpoint access type (free access, user authenticated only, API Key required);
  • Tracing requests in the database for each endpoint;
  • Selection of jBackend plugins to enable for each endpoint;
  • API Key management interface;
  • Request log management interface;
  • Each API Key can have a max daily requests limit and an expiration date;
  • Each API Key can be targeted on separate endpoints;
  • Access control is compliant with integrated ACL;
  • Support for REST compliant requests;
  • JSON format for responses;
  • Support for push notifications on iOS (APNs) and Android (GCM);
  • Custom payload for push notifications;
  • Scheduled sending of push notifications;
  • Push notifications can be create and scheduled via API call;
  • Push notifications can be targeted on selected users or groups.

 

jBackend Dashboard

 

The basic extension package includes the jBackend component, that provides the general infrastructure for endpoints, notifications, and plugins support system. Also the following plugins are already included in the basic package:

  • User Module: provides support for Joomla users (e.g. login, logout, registration);
  • Content Module: provides support for standard Joomla content (e.g. categories and articles);
  • Push Module: provides support for push notifications (e.g. register device, send scheduled push);

Additional plugins can be downloaded from here and installed separately. Before to buy a subscription check here if what you need is already available, or submit a support request.

It is also possible to give it a try downloading and installing jBackend Community for free, a lite version created to give a chance to test jBackend capabilities, to develop and test new modules, and to provide some basic REST API integration features to a Joomla site.

jBackend is released under GPL 2.0 license.

Buy Subscription to jBackend

Published in Products