On Supporting Activity Streams in Drupal

Supporting Activity Streams in Drupal is an interesting problem. On the one hand you have the endless possible actions afforded by Drupal and on the other hand you have the necessarily restrictive standard on which to map those actions. Add to that the need to make this as transparent to the user as possible and it becomes a really fun little exercise. In this post we take a brief look at Activity Streams and what some of implications of supporting them in Drupal are.

A couple of days ago I wrote a post about the importance of de-centralised social networks in general and the role Drupal can play, in particular. I also indicated that one of the first things we would like to look at here at Istos is providing support for Activity Streams in Drupal. In this post we briefly look at Activity Streams and discuss some of the issues for adding support in Drupal.

I should add that these blog posts serve as a means for us to collect together thoughts and put ideas down in writing - as everything is pretty much at the reasoning / planning stages things may not be described in the best possible way (i.e. they might be quite wrong!).

Activity Streams

Activity Streams is a standard to describe and syndicate social activities. It started out of the DISO project and now is part of the set of standards promoted by OStatus to support de-centralised social networks.

As one can see from the front page of the Activity Streams website is has garnered wide support with big names like Facebook, Google Buzz and MySpace amongst the organisations that put out Activity Streams of their users activities.

The basic format of an activity in the stream follows a simple "Actor Verb Object (Target)" structure. As in: Ronald posted a Post on his Blog, John tagged a Picture on Flickr, Angelo followed Andrea on Twitter... you get the idea.

The technical implementation of Activity Streams is made up of two parts, essentially:

1. A few more tags on to the Atom format to represent Verbs and Objects

2. A list of Verbs and Objects that seem to cover a wide range of situations.

A few of them:

Verbs: Add Friend, Favorite, Follow, Like, Join
Objects: Article, Audio, Bookmark, Comment, File, Folder, Group

Drupal and Activity Streams

Ok, so far so good. That is what Activity Streams are. There is a bunch of Verbs and Objects and users perform actions that get mapped to these "phrases" and the whole thing is presented as an Atom feed for others to pick-up and use as they like. Simple, right?

Well, kind of.

The interesting part is the mapping. Drupal, as many like to say, is a box of Legos. You can do pretty much whatever you like. So what exactly is an Adding a Friend activity? Or a Follow, Like, etc. Also when does it count and when not? If I post a photo in an Article content type I may not want that in the "official" activity stream but a photo in a User Photo Gallery content type should count towards the activity stream.

Drupal's own Activity module actually allows us to define phrases by putting together tokens supplied by Drupal and our own terminology. In its fantastically Drupalish way it offers a lot of flexibility and allows you to do just about what you like. As long as the end result makes sense to us, our users and the application's context we are good to go.

Supporting Activity Streams, however, means bringing some order to this scenario. Firstly, we must use the exact terminology supported or else our stream won't be very useful. Secondly, this can't be turned into a tedious process for website owners. The ideal end result should be you install module, turn it on and hey presto you have activity streams.

Adding some educated guesses to the mix

Our current thinking is that an Activity Streams module should essentially do three things in order to figure out what streams to create.

1. Sniff around your site and figure out what functionality there is (e.g. fivestar, voting, following, picture uploading, flags, etc) and based on that output the appropriate activities. It would have to be aware of what popular modules / fields / Drupal actions mean in an Activity Streams context and "know" how to represent those actions when it gets switched on.

2. Allow you to map actions it has not discovered to proper Activity Streams verbs and objects. For example, it would be sensible to provide an interface where activities created by the Activity module are made available to be mapped on to the Activity Streams standard.

3. Allow you to adjust and refine the sum of the two actions above. It may have guessed a few things wrong or it may be that you already have activities to represent some of the actions that the module discovered on its own so you need to flatten those out to just one thing, etc.

There are almost certainly a few more things we haven't thought of here, but hopefully this is a good start. Let us know what you think - in the meantime we will be looking at getting together some code that takes care of a few basic scenarios like commenting, posting a photo, etc.


Submitted by Anonymous (not verified) on

The records generated by the Activity module are based on Actions that are aware of various types of entities. Activity should just add a new property to the hook that allows defining a new entity Action in order to specify the verb or noun(s) associated with that action.

Alternatively, there could be a select list in the UI when an Activity Publishing Template is set up.

Submitted by Raj Singla (not verified) on

Is there anymore information you can give on this subject. It answers a lot of my questions but there is still more info I need. I will drop you an email if I can find it. Never mind I will just use the contact form. Hopefully you can help me further.
SEO Outsourcing India

Submitted by Marcel (not verified) on

You can actually check out since there are some modules on the activity stream available.
the organizational culture dude

Submitted by Anonymous (not verified) on

periodically I just suppose that people write and dont really have much to say. Not so here. You definitely have something to say and you say it with style, my man! You sure do have an interesting way of drawing folks in, what with your videos and your words. Youve got quite a one-two punch for a blog!
custom software | Free online legal advice

Submitted by Düsseldorf Zahnarzt (not verified) on

Sorry, no offense, but there are people out there who still use drupal?

Submitted by marco (not verified) on

this is very interesting for all thanks for all this

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
By submitting this form, you accept the Mollom privacy policy.