Mikkel Heisterberg presented on a deeper dive into Connections Activity Stream. The Activity Stream in social represents a tool with high potential to make interaction easier and to get into what is most important to you. This session focused on what it is and how to interact with it. It was a pretty technical session but eye opening in terms of what you can do in the stream and how you can get external events into your social network.
What is the activity stream in Connections / SmartCloud for Social
- a River of news that flows by you
- Notifications about stuff happening in other systems. Otherwise known as entries
- Entries may be saved for future reference and may be actionable
- Typically you decide what goes into your stream
- A replacement for email notifications………although you don’t have to
- Standards based – meaning IBM took the standard and added IBM Connections to it. (OpenSocial for example)
What is isn’t
- a new inbox. It’s not email
- The master of the data. It’s just a feed
Interaction With It
The Activity Stream is available via a RESTful API. It’s your typical sets a request via a method like GET, POST, PUT, DELET and get a response via return code like 200/ok, 301/moved, and 404/not found.
You will mainly use the POST and PUT methods to send JSON data. It’s not meant to be consumed in a web browser even though it’s really an http request.
Best Practice: Don’t consider it as one single stream. Think of it as each user having their own stream. That extends to communities and even public streams. There can be a lot of streams with which you can interact. This makes it nice if you want to post to a stream on a prod server. By sending to one stream, you haven’t made a huge mistake.
URL Component: URL looks like:
https://<host?/connections/opensocial/<auth>/rest/activitystreams/<userid>/<application id>/<activity ID>
- auth is authorization
- user id is obvious
- group id is the group of entried you are addressing
- application id is the app in connections (blog, update, activity, community, etc.)
- activity id is where you want to put it. It could be all for the public stream or a specific one for a specific user.
- query – give me all the events that are actionable
- query – give me all the latest blog event
- Result: “The current user posted a note to IBM Connections and you should act on it’
- current user is the actor. It could be @me
- action: here it’s posted. It’s a verb
- What happened: the object. it could be a note, tweet, meeting, sales order from external system, etc.
- Where: it was posted to IBM connections. Could be posted somewhere else
- other attributes like actionable.
The presenter used the CocoaRestClient to create that query rather than handcode it. Here’s what that looks like:
How do you delete from a stream.
Answer: you can’t! It’s forbidden. However, “We are howevrer, adding propogateDelete at the moment which deletes all events related to a given object on receipt of a given event. This will be protected by a Trusted Role”
Cool stuff: You can make something actionable which goes into one of the facets of your stream filter. This isn’t a POST but a PUT. Context is exactly the same. Mark and unmark items as actionable.
Saved: You can save an item for later. UI save is easy. Simple PUT lets you update saved to false
Rolling it up: You can post to the same “thing” or part of the conversation. (like a reply to someone’s comments or a comment on a file.) You would specific rollup id for this. It’s a POST because it’s a new comment for example. But then you specify a rollup id.
Rollup id vs object id: similar but it’s not the same. Rollup tells the stream of different posts with different object ids. The rollup just tells the system about the relationship. So every comment on a file has an object id but is related to the parent object via the rollup id.
Templates: You can create multiple templates. For example you might have multiple versions of a business card. It’s useful for multiple language and support. Context: when identifying title, don’t hardcode but instead point to template.
Embedded experiences lets you send along an event and identify the gadget in the activity stream to use when acting on in within the stream. It’s also useful to render something nicely. (file preview gadget for example)
Posting to other users streams: Yeah, that’s spam. You aren’t allowed to do it unless you have a trusted role. Use the id of the poster to post it. The application will post on someone elses behalf.
Generator: want to add a pretty icon for all external posts then user generator tag and give it an image for example. Generators should be registered. If it’s registered then you can filter the stream by the “generator” For example, all workflow items from the CRM system.
Cool use: Mikkel created a cool script that queried twitter for any references to himself, grabbed it and then posted it to his stream with the API’s he walked us through.