Adding Activity Streams to SugarCRM with eXo

As I promised in my previous post about the eXo Platform Widget, here is a real-life example of using the plugin to add social features to a popular enterprise application. Today we introduced the eXo Plugin for SugarCRM, for adding activity stream and collaboration capabilities to an instance of SugarCRM. The plugin is a cool prototype that shows the potential for our eXo Platform widget technology, and can be found (for free of course) on the SugarForge.

We have several new additions to the eXo Resource Center dedicated to the new SugarCRM plugin:

  • Video Demo showing the plugin integrated in SugarCRM
  • A Tutorial that provides more technical detail and step-by-step instructions for installing and using the plugin
  • Getting Started Guide – a video to show you how to install the plugin on your own

in action, we in this video demo, or start using it for themselves with the tutorial and getting started guide.

How Does It Work?

In this use case, we start with a SugarCRM user who has access to a case (1). If they click on the eXo icon, a popup window is displayed, and the content is loaded from the eXo server (3). Because the request is sent directly to the eXo server, it can return personalized content. This integration is possible with the eXo Platform widget.

Next, a user creates a task associated to a case (1). The eXo plugin prepares an activity and sends it to the eXo collaboration space that corresponds to the case (2).

To go into more technical detail about the implementation, we can look at the two main parts of the integration:

  • UI integration in the UI
  • Push mechanism for activities

The UI Integration

To integrate some of eXo Platform’s social and collaboration features into SugarCRM, we used the Sugar Cloud Connector. This allowed us to simply add the eXo Platform Widget.

We integrated our code snippet into the template:


spaces.createSpaceBox(document.getElementById("spaces_div"), "Sugar {$module} {$fields.{{$mapping_name}}.value}", "{$fields.name.value}");

Push Mechanism for Activities

Because eXo Platform implements OpenSocial, we can use it to publish the activities taking place in SugarCRM. As we used for the Grails integration in a previous demo, there is also a client library for OpenSocial in PHP.

To be notified of new tasks and other things created and modified, we used Logic Hooks. Events are filtered so only the ones the user is interested in are presented (i.e. only the events associated with a specific case). When a related event is found, eXo creates a new message. Finally, this message is submitted to the eXo Platform server using the following code:


$provider = new osapiProvider("", "", "", "", $spaces_config["os_rpc_url"], "eXo Social", true, null);

$auth = new osapiOAuth2Legged($spaces_config["os_oauth_key_name"], $spaces_config["os_oauth_key_secret"], $spaces_config["os_user"]);

$osapi = new osapi($provider, $auth);

//We create the activity
$osactivity = new osapiActivity();

$osactivity->setTitle($activity);
$osactivity->setBody($activity);

//Configuring the message
$params = array(
'userId' => '@me',
'groupId' => "space:".$spaceName,
'activity' => $osactivity,
);

// Start a batch
$batch = $osapi->newBatch();
$batch->add($osapi->activities->create($params));

//Sending the activity
$result = $batch->execute();

In the code, you may recognize that we use oAuth to authenticate the request. To learn how to configure oAuth for your eXo implementation, check out the OpenSocial documentation.

Be part of the discussion, share your comments

comments