In the previous section, you posted events in the activity streams that were generated by WCM workflow events. Within the context of the event posted, we created a reference to an OpenSocial gadget that we are now going to enable and implement.
The following JSON snippet references the OpenSocial gadget that we are going to implement. It defines the URL to the gadget and context information. We reference an internal gadget here, rather than a third party one hosted on another server for simplicity. Authentication will be achieved via Basic Auth rather than OAuth2 which would be used for externally hosted gadgets.
// Embedded experience reference to gadget context. Add fields in here for the embedded gadget to reference.
// Get the Content Item UUID from the newly created content
String contentItemuuid = wcmItem.getId().getId();
// This userid can be dynamically retrieved based on the content approver role. Here we have chosen "Heather Reeds" as Content Approver.
String userId = "hreeds";
JSONObject context = new JSONObject();
context.put("summary", "A web content item requires your approval");
// Retrieve the Content Description. This key is later used in OpenSocial gadgets data model XML file.
// Do the gadget embed
JSONObject embed = new JSONObject();
JSONObject social = new JSONObject();
//End of gadget embed