JBoss.orgCommunity Documentation

Publish an activity into a space

This functionality is not available in the standard OpenSocial APIs.

Instead of publishing your activities to the group @self as usual, you will publish them to the group "space:spaceId" or "space:spacePrettyName".

After using the OpenSocial Java library and Groovy, your code will look like this:



      def client = getOpenSocialClient()
      //create your new activity
      Activity activity = new Activity()
      activity.body = "xx purchased the book xxx"
      activity.title = "BookFlow Purchased"
      //prepare the request that will create the activity
      Request request = ActivitiesService.createActivity(activity);
      //specify that the creation of this new activity is for the space bookflow
      request.groupId = "space:bookflow";
      client.send(request);

In the example above, the groupId is set to "space:bookflow" and bookflow is the name of the space.