Thousands of businesses rely on Hipmob to keep their customers happy. See some here.

Hipmob - Parse Integration


Overview

Hipmob provides hosted live chat for mobile applications. You sign up with us, we give you a code, you download our library, you integrate it into your app, and you can then talk to your users, figure out what they want and what problems they are having, and make them happy. No servers, no extra steps or code to write, wherever the users are, you get to focus on what you do well. This document covers integrating Hipmob into your app that uses the Parse platform-as-a-service.

Why?

Platform-as-a-Service providers such as Parse provide powerful SDKs that let mobile developers rapidly build compelling applications, including user and file management and push notifications. With Hipmob we want to be able to leverage the tools and techniques developers are already using: since Parse is currently in tens of thousands of applications it makes sense to provide a clean integration path.

Support

Hipmob's Parse integration supports using your Parse User object identifiers as Hipmob host application identifiers, and sending push notifications to your apps using Parse's REST API. If you currently are not using Parse and would like to use Parse in your app you can get a free Parse account at Parse.

Enabling Parse Integration

To integrate with Parse you will need to provide your Parse application ID and the associated Parse REST API key. Visit the Apps tab in your Hipmob account.

Figure 1: the Apps tab

Once there, click the Settings button next to the app you'd like to update.

Figure 2: the Settings button

Once there, select the Integration settings pane.

Figure 3: showing the Integration settings pane

You can then select the Parse tab. This will show you options to enter the Parse application ID and REST API key, as well as to enable/disable Parse push notifications. Enter your application ID and REST API key as shown in Figure 4 below.

Figure 4: the Parse integration settings

Once you've entered the appropriate settings hit Update: when the configuration data has been saved a confirmation will be shown as in Figure 5 below.

Figure 5: Parse integration is enabled


Note that for security reasons Hipmob will NOT display the REST API key after it has been saved.

Push Message Details

Parse push messages allow optional data to be included in each message (see the documentation): Hipmob will send push messages with a count data field that is the number of available messages. We also include a custom action for Android devices: com.hipmob.push.NEW_MESSAGE. This can be used with the Parse Intent responder (see the documentation).
The actual message that is sent with the push notification can also be customized from the application settings screen. Select the Settings pane as shown in Figure 6 below.

Figure 6: the application message settings

The push message template (circled in Figure 7 below) can then be changed. Hit Update to save your changes. You can use the template variable {{count}} to include the number of available messages in the push message text.

Figure 7: the push message template

To test that the push notifications are properly setup you can use the Hipmob management interface to send a message to a device. Log into the Hipmob management interface and visit the Devices tab (at https://manage.hipmob.com/#devices).

Figure 8: Devices tab

Find the device you want to send a message to, and then expand the device's menu and select Send Message.

Figure 9: Send Message

Type in the message text, and then click Send.

Figure 10: Message sent

Note because we use the Parse User object ID the push message will be delivered to ALL instances of the application that the user is logged into!

Android

Once Parse push notifications have been configured in your Android app (see the documentation), you can include the Hipmob Android SDK in your app and then use the Parse user ID as your Hipmob host application ID. To start, ensure you have saved the ParseUser (call this on a separate Thread or using an AsyncTask in your application):
ParseInstallation pi = ParseInstallation.getCurrentInstallation();
String id = pi.getString("hipmobId");
if(id == null){
  String uid = ParseUser.getCurrentUser().getObjectId();
  if(uid == null){
    try{
      ParseUser.getCurrentUser().save();
      pi.put("hipmobId", ParseUser.getCurrentUser().getObjectId());
      pi.save();
    }catch(Exception e1){
      android.util.Log.v("App", 
                         "Exception saving installation id ["+e1.getMessage()+"]", e1);
    }
  }
}
		  

Important you MUST use the hipmobId field for the Hipmob integration to work. Also, you MUST use the ParseUser object ID to ensure that push messages are delivered to all instances where the user has logged in.
Then when you open your Hipmob chat window, pass the user ID like this:
// create an intent
Intent i = new Intent(this, com.hipmob.android.HipmobCore.class);
		   
// set the appid to the key you're provided
i.putExtra(HipmobCore.KEY_APPID, HIPMOB_KEY);
		   
// Use the new hipmobId field
i.putExtra(HipmobCore.KEY_DEVICEID, 
             ParseInstallation.getCurrentInstallation().getString("hipmobId"));
		   
// launch the chat window
startActivity(i);

Important the Parse user ID will not be sent to Hipmob until at least one Hipmob chat session occurs.
On the Android device, the push notification will be received and displayed using the configured push message template. Notice the count of available messages has been included in the message.

Figure 11: push notification delivered

iOS

iOS docs are coming soon!