Push.IO

Skip to end of metadata
Go to start of metadata

Overview

Push.IO is a platform that supports segmentation of users into audiences and pushing notifications to those segments in a controlled manner. Combined with Gigya's user management tools, Push.IO becomes a very powerful tool for reaching predefined audiences with tailored notifications.

The Push.IO platform supports both Android and iOS integration. 

Push.IO supports 'registering' users to categories on demand. When pushing a notification to a segment, every user who is registered to that segment will receive a notification. Notifications can be sent based on platform (e.g Android), segments (e.g Lakers fans), or directly to users.

Combining the Push.IO platform with Gigya's user management capabilities enables your app to reach custom audiences with precise messaging, and create a more personal connection between your app and its users.

 

This guide will take you through the basics of setting up Push.IO and integrating it with Gigya. Instruction and code examples are given for Android, but are available in the Push.IO documentation for iOS and Windows phone as well.

Requirements

Assuming that Gigya's functionality is already integrated into your system, all you need in order to use Push.IO with Gigya is an active Push.IO account. To open a Push.IO account, sign up with Push.IO directly. 

Follow the implementation instructions below in order to set up a basic integration.

Configuring Push.IO

Before we can start to code our custom push notifications mechanism, there are a few step required in order to configure Push.IO to comply with your app.

First, Push.IO provides you with a Web  Dashboard to concentrate all of your push activity. The Web Dashboard allows you to perform actions such as sending easily without using API. The Dashboard is also a simple way to configure the integration between your app and push. Download the Dashboard from Push.IO once you have registered and opened an account.

Once your Dashboard is up and running, follow these basic steps to create a push platform for your application:

  • Add an Android Platform to your Application
  • Obtain Credentials for GCM (Google Cloud Messaging)
  • Enter your GCM Credentials (Google Project Number and Google API Key) for your Android Platform on the  Web Dashboard .
  • Download the pushio_config.json file generated from your GCM Credentials and include it in your project's assets folder.
  • Download the  Android SDK (Push IO Manager)  and include it in your project's lib folder.
  • Add necessary code to instantiate the Push IO Manager in your application.

Detailed step-by-step instructions for Android that will take you through the configuration process can be found on the Push.IO website. 

Note that though these step refer to configuring push for an Android  platform, similar steps are required for iOSWindows phone and other platforms.

Registering Categories

Once you have set up your platform and registered the Push IO Manager, you can start coding the logic behind your push server. The Push IO Manager handles user segmentation and pushes your notifications to the right audience. The following example illustrates a basic way of using Gigya's user info to segment a user, and then pushing a message to that segment using Push.IO's API.

Segmenting Users Using The User Object

The response of calling the getUserInfo method contains a user object, which can be used to gain insights on who your user is. In this simplified example, we take a look at the users age and gender to determine if the user is a young male. If so, we will register the user to the 'Young-Male' category, to be targeted with custom notifications later on.

//An instance of the Push.IO Manager to use later on
PushIOManager pushIOManager = PushIOManager.getInstance(this);
GSResponseListener resListener = new GSResponseListener() {
    @Override
    public void onGSResponse(String method, GSResponse response, Object context) {
    try {
        if (response.getErrorCode()==0) { 
            // SUCCESS! response status = OK
            String category = "";
            int age = response.getString("age", "");
            String gender = response.getString("gender", "");
            if (age < 40) {
                category += 'Young';
                if (gender == 'm'){
                    category += '-Male';
                }
            }
            if (category.length == 10){
                //This part uses Push.IO's Manager to register the user to a category
                pushIOManager.registerCategory( category );
            }
        }
        else {  
            // Error
            System.out.println("Got error on setStatus: " + response.getLog());
        }
    } catch (Exception ex) {  
        ex.printStackTrace();  }
    }
};
// Sending the request to get the user info from the server
GSAPI.getInstance().sendRequest(socialize.getUserInfo, "", resListener, null);

Pushing To a Selected Group

Now that we have our users precisely segmented, we can target notifications to selected groups. The following example sends a push notification to all users registered to the 'Young Male' group, effectively reaching all male users under 40 using your app, alerting them that the new X-box is now available.

The example uses Push.IO's Python SDK, although support is available in other languages such as Ruby and PHP. You can also create push notifications using Push.IO's native cURL API.
notification = pushio.Notification(message="The new X-box, now available in stores!")     
categories = "Young-Male"     
pushioAPI.sendCategoryPushNotification(notification, categories)

Pushing To Specific Users

Aside from segmenting, Push.IO also enables you to target specific users by registering their devices with the app. The following example illustrates how to register a user with Push.IO, an then how to use Gigya's user data to push a personalized notification to that user (or a list of users).

Registering a User

The following command registers the user's device with the username given as a parameter. After registering, the device can be targeted with push notifications using the username registered to it.Note that Push.IO does not save PII (Personally Identifiable Information), so if the username consist of such information (e.g Email address), a hashed version of the identifier should be stored.

Android: pushIOManager.registerUserId("aZbqNtbp");

iOS: [[PushIOManager sharedInstance] registerUserID:@"aZbqNtbp"];

Where 'aZbqNtbp' is a hashed version of the user's email or other PII identifier.

Pushing To a Specific User

Once the user is registered, you can send push directly to the device that was registered. The following code sends a push directly to a device:

curl "https://manage.push.io/api/v1/notify_devices/<APP_ID>/<SENDER_SECRET>" -d 'payload={"message":"Happy Birthday from us!"}&recipient_ids={"api_key_1":["device_id1"]}

Where and are your apps credentials taken from your Web Dashboard, 'api_key_1' is your apps API key and 'device_id1' is the registered ID of the user (in our case: 'aZbqNtbp').This format can be used to notify multiple recipients in a targeted manner. Read more on pushing to individual users.

Advanced Push Notification

This guide provides a very basic use of Push.IO's capabilities.The Push.IO platform enables much more complex operations, all detailed in Push.IO's documentation. For example, you can find some example cURL commands to send to Push.IO, some tools to create Advanced Segmentation, or a guide to setup scheduled push notifications, and much more.Combining Gigya's insights on users' data and Push.IO's on-demand reach creates a powerful and efficient marketing tool.