An Introduction to Working With the Activity Stream

5,898 views

Published on

Presentation about working with the Activity Stream in IBM Connections 4+ meaning what the concepts behind the Activity Stream are, who to work with it and how to perform many of the tasks you would need to do such as marking/unmarking as actionable etc.

Published in: Technology
0 Comments
6 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
5,898
On SlideShare
0
From Embeds
0
Number of Embeds
955
Actions
Shares
0
Downloads
92
Comments
0
Likes
6
Embeds 0
No embeds

No notes for slide

An Introduction to Working With the Activity Stream

  1. 1. This presentation by Mikkel Flindt Heisterberg (mh@intravision.dk, http://lekkimworld.com),OnTime® by IntraVision, is licensed under a Creative Commons Attribution-ShareAlike 2.5 Denmark LicenseAn Introduction toWorking With theActivity StreamMikkel Flindt HeisterbergSenior Solution Architect / PartnerOnTime® by IntraVision
  2. 2. @me• Developer for IBMNotes, Domino, Sametime, Java, DB2, Websphere Application Server, Web• Lover of plugins – plugins are cool! –but slowly becoming the widget guy• IBM Champion• Blog: lekkimworld.com• @lekkim
  3. 3. OnTime® Group Calendar• Probably the best, most versatile, group calendarproduct in the World• In active development since 1997, sold throughpartners throughout the World• Various user interfaces to suit just about any needfrom IBM Notes Standard, to web browsers, mobiledevices, IBM Connections and IBM Notes Basic• Oh and there’s an API as well...
  4. 4. NOTES INTERFACE
  5. 5. WEB INTERFACE
  6. 6. Team-At-A-Glace (TAAG) SIDEBAR INTERFACE
  7. 7. MOBILE INTERFACES
  8. 8. DISCOVERY INTERFACE
  9. 9. API EXPLORER
  10. 10. Questions? Talk to Lars......and then head tohttp://www.ontimesuite.comfor a fully functional 30 daytrial license. It takes under 30minutes to set up.Want online demos? Head tohttp://demo.ontimesuite.com
  11. 11. What is this session about?“The future of business is social and the activitystream is the way events and messages arecommunicated in the social business. In this sessionyoull learn all there is to know about the activitystream including exactly what it is and how tointeract with it using your favorite developmentenvironment whether that beJavaScript, XPages, Java or even the plain vanillaHTTP based REST API. This session is for you if youwant to start working the Activity Stream.”
  12. 12. The activity stream conceptActivity stream was added in IBM Connections v. 4.0.“An activity stream is a list of recent activities performedby an individual, typically on a single website. Forexample, Facebooks News Feed is an activity stream.Since the introduction of the News Feed on September6, 2006 other major websites have introduced similarimplementations for their own users. Since theproliferation of activity streams on websites, there havebeen calls to standardize the format so that websitescould interact with a stream provided by anotherwebsite.”
  13. 13. What is the Activity Stream• River of news – it’s like water flowing by you• Notifications about ”stuff” happening in (other) systems – werefer to these notifications as entries• Entries may be saved for future reference and entries may beactionable i.e. indicated that it must be acted upon• Typically you decide what goes into your stream• A replacement for email notifications (although youcan have those too...)• Standards based – like – meaning – IBM took thestandard and added IBM Connections specificstuff to it
  14. 14. What is the Activity Stream NOT• A new inbox – doesn’t replace email• A perpeptual data store – entries are deletedbased on a server defined purge interval(default is 30 days) unless saved or actionable• Meant as a content repository• Something that implies that you must read itall – it’s notifications – treat it as such...
  15. 15. Demo• Let’s look at the activity stream in IBMConnections• See options for filtering (saved/actionable)
  16. 16. Demo safety slide
  17. 17. No content stored in the stream
  18. 18. • HTTP is much more than what a web browser reveals• The request– has a method (GET, POST, PUT, DELETE)– may have headers that describe the request such as aContent-Type (text/html), cookies and authenticationinformation.– may have a body data• The response– has a return code (200 = OK, 301 = Moved, 404 = Not found)– may carry body data– may have headers that describe the response (e.g. Content-Type, charset and new location)REST API’s 101 (1)
  19. 19. • You will mainly use the POST and PUT methods to send JSON data(Content-Type: application/json) to the API• JSON is super simple key/value data format. It has simple datatypes(strings, numbers, booleans), objects and arrays{”email”: ”mh@intravision.dk”,”niceGuy”: true,”age”: 36,”name”: {”first”: ”Mikkel Flindt”,”last”: ” Heisterberg”},”Lotuspheres”: [2006, 2007, 2008, 2009, 2010, 2011, 2012],”IBMConnects”: [2013]}REST API’s 101 (2)
  20. 20. • HTTP is pure text and easily done usingtelnet but there are cool tools to make iteasier:– RESTClient in Firefox– Advanced REST Client in Chrome– cURL if you’re a command line guy/gal• Recommend RESTClient in Firefox as theChrome equivalent sends an Origin headerthat doesn’t agree with IBM Connections• Charles WebProxy, http://www.charlesproxy.comREST API’s 101 (3)
  21. 21. How many streams are there?• In my opinion it makes most sense to notconsider the activity stream as one singlestream• Instead think that– Each user has his/her own (@me)– There is a public stream (@public)– A community may have a stream if the widget hasbeen added by a community owner – if there’s nostream for a community posting to it will return a”403 Forbidden”
  22. 22. Stream URL componentshttps://<host>/connections/opensocial/<auth>/rest/activitystreams/<user ID>/<group ID>/<application ID>/<activity ID>Component Meaning<auth> (optional) If using form based authentication leave this componentout. Otherwise options are anonymos, basic, oauth (last option notcovered in this presentation).<user ID> The user whose stream you’re addressing – use @me for currentusers stream, @public for public stream or a community ID for thestream in a community.<group ID> The group of entries you’re addressing – use @all for all posts oroptions for special meaning such as @saved, @actions etc. Refer forInfoCenter and resources slide for more.<application ID> When retrieving entries this refers to the application (or ”generator”)that created the entry. All the IBM Connections app names can beused (profiles, blogs, wikis etc.) plus custom ones (e.g. ontimegc).@all used for all applications.<activity ID> Used to reference a specific event e.g. for updating saved status.
  23. 23. 1. /activitystreams/@me/@allList my (current users) entries2. /activitystreams/@public/@allList public stream entries3. /activitystreams/@me/@actionsList my actionable events4. /activitystreams/@me/@saved/blogsList my saved events from blogs5. /@me/@all/@all/bdb562fb-b145-43dc...Work with entry from my stream based on IDStream URL Examples* All URLs above start with https://<host>/connections/opensocial/<auth>/restAlso usedwhen creatingnew entries(e.g. POSTing)
  24. 24. Anatomy of a stream entry• A stream entry reads like ”the current userposted a note to IBM Connections and youshould act on it”
  25. 25. Anatomy of a stream entry• A stream entry reads like ”the current userposted a note to IBM Connections and youshould act on it”The person doing the postingis called the actor and can bea specific user ID but usuallythe current user (@me)
  26. 26. Anatomy of a stream entry• A stream entry reads like ”the current userposted a note to IBM Connections and youshould act on it”What the person does is calledthe verb and there’s a long list ofpredefined ones such as post,update, create...
  27. 27. Anatomy of a stream entry• A stream entry reads like ”the current userposted a note to IBM Connections and youshould act on it” The object in question is calledthe object and can be anythingthat represents the target ”thing”i.e. file, note, meeting...
  28. 28. Anatomy of a stream entry• A stream entry reads like ”the current userposted a note to IBM Connections and youshould act on it”The system the user workedon is called the target andcan be any system you needto refer to
  29. 29. Anatomy of a stream entry• A stream entry reads like ”the current userposted a note to IBM Connections and youshould act on it”IBM Connections supports somespecial properties for entriessuch as actionable and saved toallow users to work with entries
  30. 30. Anatomy of a stream entry• A stream entry reads like ”the current userposted a file to IBM Connections and youshould act on it”{"actor": {"id": "@me"},"verb": "post","title": "Some entry title","updated": "2013-05-17T12:00:00.000Z","object": {"title": "Some object title","objectType": "note","id": "1234567890-1234567890-1234567890"}}
  31. 31. Anatomy of a stream entry• A stream entry reads like ”the current userposted a file to IBM Connections and youshould act on it”{"actor": {"id": "@me"},"verb": ”create","title": ”Sales proposal for Rockets Inc.","updated": "2013-05-17T12:00:00.000Z","object": {"title": "Sales proposal for Rockets Inc.","objectType": ”proposal","id": "1234567890-1234567890-1234567890"},”target”: {”displayName”: ”Acme Corp. CRM”,”url”: ”https://crm.example.com”}}IBM Connections is the implieddefault target but you canspecify your own target in theentry
  32. 32. POST /connections/opensocial/basic/rest/activitystreams/@me/@allHost: social.example.comContent-Type: application/jsonContent-Length: xyzAuthorization: Basic xyz123{"actor": {"id": "@me"},"verb": "post","title": "Some entry title","updated": "2013-05-17T12:00:00.000Z","object": {"title": "Some object title","objectType": "note","id": "1234567890-1234567890-1234567890"}}* Smallest entry you can/should post to the streamPosting an entry* to the stream
  33. 33. Demo• RESTClient in Firefox• Easily work with feeds, add authentication,headers etc.• Use PrivateBrowsingmode
  34. 34. Demo safety slide
  35. 35. Deleting from the stream• In short you can’t – up to IBM Connections v. 4.5you cannot delete from the activity stream –you’ll just get an 403 Forbidden back• There is some light at the end of the tunnel though –this directly from the developersat IBM: “We are however addingpropagateDelete at themoment, which deletes all eventsrelated to a given object onreceipt of a delete event (if sospecified). This will be protected bya trusted role.”
  36. 36. Action required!
  37. 37. GET /connections/opensocial/basic/rest/activitystreams/@me/@actionsHost: social.example.comAuthorization: Basic xyz123PUT /connections/.../activitystreams/@me/@all/@all/de325123-e269-4a33-b62aHost: social.example.comContent-Type: application/jsonContent-Length: xyzAuthorization: Basic xyz123{"actor": {"id": "@me"},"id": "de325123-e269-4a33-b62a","connections": {"actionable": false}}Mark/unmark as actionableResponse{"entry": {"connections": {"actionable": "false"},"id": "unmark actionable:"}}
  38. 38. Save for later
  39. 39. GET /connections/opensocial/basic/rest/activitystreams/@me/@savedHost: social.example.comAuthorization: Basic xyz123PUT /connections/.../activitystreams/@me/@all/@all/de325123-e269-4a33-b62aHost: social.example.comContent-Type: application/jsonContent-Length: xyzAuthorization: Basic xyz123{"actor": {"id": "@me"},"id": "de325123-e269-4a33-b62a","connections": {”saved": false}}Mark/unmark savedResponse{"entry": {"connections": {“saved": "false"},"id": "unmark saved:“}}
  40. 40. Rolling it up• Rollup is telling the stream that anpost/update relates to the same ”thing”• Used to avoid cluttering up the userinterface
  41. 41. POST /connections/opensocial/basic/rest/activitystreams/@me/@allHost: social.example.comContent-Type: application/jsonContent-Length: xyzAuthorization: Basic xyz123{"actor": {"id": "@me"},"verb": "post","title": "Some entry title","updated": "2013-05-17T12:00:00.000Z","object": {"title": "Some object title”, "objectType": "note","id": "1234567890-1234567890-1234567890"},”connections”: {”rollupid”: ”1234567890-1234567890-1234567890”}}Rolling it up
  42. 42. Templates• Two main reasons for looking at templates– Internationalization (i18n) / translation– Getting a standard representation in the UI• Two types of templates– Object Substitution replaces a reference with nicemarkup – an example is replacing the actor with aHTML reference using the business card– Title Template Substitution – uses objectsubstitutions it makes standard titles
  43. 43. Templates• Object Substitution– ${Actor} - this is converted into appropriately marked up HTML whichdisplays the Actors name and links to a Business Card– ${Object} - if this is a person we display as with the Actorabove, otherwise the displayName with a link to the url– ${Target} - if this is a person we display as with the Actorabove, otherwise the displayName with a link to the url• Title Template Substitution– ${created} = ${Actor} created ${Object}– ${create.target} = ${Actor} created ${Object} in ${Target}
  44. 44. POST /connections/opensocial/basic/rest/activitystreams/@me/@allHost: social.example.comContent-Type: application/jsonAuthorization: Basic xyz123{"generator": {"id": "ontimegc”},"actor": {"id": ”@me"},"verb": "create","title": "${create}","updated": "2013-05-21T12:00:00.000Z","object": {"summary": "Project Z Review Meeting","objectType": "meeting","id": "123456789012345678901234567890OP”}}Using templates
  45. 45. Embedded Experiences• EE works a litte different in e-mailand in the activity stream• E-mail– Traditional (SMTP) e-mail is usingMultipurpose Internet Mail Extension(MIME)– EE’s adds an additional ”MIME part” –clients in the know will show contentbased on this data if possible andallowed by policy• Activity stream– Activity stream delivery model is a bit different than in e-mail as we alreadyhave a structured payload– Application sending the entry adds an openSocial.embed object to the entrywith link to the gadget required for rendering the EE and context info
  46. 46. {”actor”: {”id”: ”@me”},......"openSocial": {"embed": {"gadget": "http://ee.example.com/mygadget.xml","context": {"id":"12345"}}}}Embedded Experiences
  47. 47. • By default you may only post entries to your ownactivity stream• Sending to others can be considered as spam• As with standards there are multiple ways of doing itusing either– OpenSocial (openSocial: {deliverTo: []})– Activitystrea.ms (to: [])– Just use the second one...• To send to another users streamyou need to either be him/heror be a trusted application (moreinformation later...)Posting to other users stream
  48. 48. {"generator": {"id": "ontimegc”},"actor": {"id": "@me"},"to": [{"objectType": "person", "id": "A7E718F4-3040-2A00-C125"}],"verb": "create","title": "${create}","updated": "2013-05-21T12:00:00.000Z","object": {"summary": "Project X Review Meeting","objectType": "meeting","id": "123456789012345678901234567890MN”},"connections": {"rollupid": "123456789012345678901234567890MN",}}Posting to other user
  49. 49. {"generator": {"id": "ontimegc”},"actor": {"id": "A7E718F4-3040-2A00-C125"},"to": [{"objectType": "person", "id": "A7E718F4-3040-2A00-C125"}],"verb": "create","title": "${create}","updated": "2013-05-21T12:00:00.000Z","object": {"summary": "Project Y Review Meeting","objectType": "meeting","id": "123456789012345678901234567890OP”},"connections": {"rollupid": "123456789012345678901234567890OP”}}Posting as other user
  50. 50. {"generator": {"id": "ontimegc”},"actor": {"id": "1E7F44DD-9C20-842A-C125"},"to": [{"objectType": "person", "id": "A7E718F4-3040-2A00-C125"}],"verb": "create","title": "${create}","updated": "2013-05-21T12:00:00.000Z","object": {"summary": "Project Z Review Meeting","objectType": "meeting","id": "123456789012345678901234567890OP”},"connections": {"rollupid": "123456789012345678901234567890OP”}}Posting to & as other user
  51. 51. How it looks in the UI
  52. 52. Registering generatorswsadmin>execfile("newsAdmin.py")wsadmin>NewsActivityStreamService.listApplicationRegistrations(){wikis=wikis, communities=communities, general=General, profiles=profiles, activities=activities, homepage=homepage, blogs=blogs, forums=forums, files=files, dogear=dogear, demoapp=Demo Application, kudos=Kudos}wsadmin>NewsActivityStreamService.registerApplication("ontimegc", "OnTime GroupCalendar", "http://www.ontimesuite.com", "", ”http://inside.intravision.dk/images/ontime.gif”, ””, ”OnTime Group Calendar”, ”true”)wsadmin>After first use of a generator it can be referenced by ID. Purpose of registeringis that users may filter by it in the UI.
  53. 53. Benefit of registering generator
  54. 54. Granting access (1)• Permission to send to other users are grantedusing the trustedExternalApplication role• Granted in the WidgetContainer applicationusing wsadmin or the Websphere ApplicationServer Integrated Solutions Console – thelatter is easiest
  55. 55. Granting access (2)
  56. 56. Granting access (3)
  57. 57. Granting access (4)
  58. 58. Granting access (5)
  59. 59. Summary• There’s no one stream - @me vs. @public vs. community• Be patient – wrapping your head around these concepts can behard in the beginning• Remember that the data isn’t stored in the stream but rather ispointed to from the stream• Entries are automatically purged from the stream unless saved ormarked actionable• You cannot delete from the stream (yet)• Accessed using REST API URL based on user, group, application andactivity ID• When working with the RESTClient in Firefox use ”Private Browsing”mode as credentials used and cookies returned in one tab doesn’tleak to other ”Private Browsing” tabs.• Pretty easy to use once you grasp the concepts
  60. 60. Resources• Activity Streams in the OpenSocial specification, http://opensocial-resources.googlecode.com/svn/spec/trunk/Social-API-Server.xml#ActivityStreams-Service• AppDev wiki, http://www-10.lotus.com/ldd/appdevwiki.nsf• IBM Connections Activity Stream Integration (AD104 from IBM Connect2013), http://www.slideshare.net/brianog/ad104-ibm-connections-actiivtystream-integration• Activity Stream hands-on lab, http://www-10.lotus.com/ldd/appdevwiki.nsf/xsp/.ibmmodres/domino/OpenAttachment/ldd/appdevwiki.nsf/82567C415DF5243185257AEE00626F82/attach/5-sdk-workshop-activitystreams.pdf
  61. 61. Tools of the trade• RESTclient in Firefox(recommended), https://addons.mozilla.org/da/firefox/addon/restclient/• Advanced REST client in Chrome (issues withPOSTs), http://bit.ly/advancedrest• cURL (for any imaginable operatingsystem), http://curl.haxx.se/• Charles WebProxy, http://www.charlesproxy.com
  62. 62. Q&A• But?, How?, Doesnt thatmean...• Give it to me! (or come talkto me after the session orfind me in the hallways...)• Twitter: @lekkim• Email: mh@intravision.dk• Blog: http://lekkimworld.com

×