We will not be able to allow embedded links in the BODY of activites for launch, but we will allow you to customize the more >> link that follows each activity BODY. To do this we added support for the OpenSocial activity URL field. This field also supports view-params to direct users to particular pages within your app. Here's an example that will link to the viewer's canvas page for your app with an additional parameter:
function createActivity(title) {
var opts = {};
opts[opensocial.Activity.Field.TITLE] = title;
opts[opensocial.Activity.Field.BODY] = "Start sending gifts too!";
var viewParams = gadgets.json.stringify({"test":"w00t!"});
opts[opensocial.Activity.Field.URL] = "/apps/displayAppCanvas.do?appId=[APP_ID]&userId=" + viewer.getField(opensocial.Person.Field.ID) + "&view-params=" + encodeURIComponent(viewParams);
var activity = opensocial.newActivity(opts);
// Request the activity creation
opensocial.requestCreateActivity(activity, opensocial.CreateActivityPriority.HIGH);
}
If no URL is set, the more >> link will continue to default to the VIEWER's (the user generating the update) canvas page.
This feature will be available on sandbox tomorrow.
Leave a comment