•over 2 years ago
In these days of massive social tech innovation, we’re happy to report that activity streams are a crucial feature in nearly all apps. Any application developer worth her code knows it, and every social media user knows it: feeds are everywhere, and they’re incredibly useful.
The reason? Activity streams keep you in the loop, the best ones going so far as to leverage deep learning algorithms to create highly personalized content discovery. For social apps, they’re key to seeing what friends are up to.
And, in workplace tools, they’re often part of the core functionality required for the product to make any sense at all. Examples include collaborative tools like Basecamp or Airtable: “Vanessa and 2 others uploaded project files.” How else would you keep track of all the progress during a big project?
Therefore, it makes sense that activity streams would be highly sought-after by app developers. Whatever you’re building, it probably provides some (or most) of its value to users in the form of an information feed, right?
If so, how do you go about building a great stream for your users? Let’s dig in.
Scalability Is the Name of the Game
Writing a basic JSON file that tells us "Patty updated a document" is a great start, but what happens when Patty is one of several hundred thousand users contributing to millions of documents? How do you avoid adopting your own pet Fail Whale while trying to keep up with your awesome app’s growing adoption rates?
We won’t pretend it’s easy to properly scale feed technology—that’s why Stream exists. When we realized developers were struggling with this, we resolved to build a real solution to the pain points of stream design. And scalability is a big one. Product Hunt realized this and implemented Stream’s API for a more powerful feed and in-depth analytics.
Specifications Make a Developer’s Job Much Easier
If you want to keep from tearing your hair out as you build your first or umpteenth activity stream, you’re best off getting intimate with W3C’s spec on the subject. It’s pretty technical, reading more like a textbook than anything else, but hey—you didn’t get into programming because it was easy, did you?
It’s well worth taking some time at first to skim through the many examples, definitions, and considerations offered in that spec. Get a sense for how actors are essentially a type of object capable of performing an activity, and how it’s possible to define variable language formats. Study some real-world examples too, which offer a unique flavor of context that can really help you wrap your head around tough concepts.
We also highly recommend reading into how you can (and should) protect your users’ privacy when handling all this data—especially if you’re servicing the European Union. The last thing you want for your budding app is a legal dispute. Dig into the core and vocabulary specs for more details than this post covers.
Audience Targeting Is Now Part of the Core Spec
In the same way, you might CC someone on an email, adding the to property allows app developers to send notifications to specific users. An example of this is Facebook indicating that someone is “—with Sarah.” That simple @mention makes the content much more likely to appear in many of Sarah’s friends’ news feeds.
Are you wondering how this helps your app? When users can tag each other, you start to experience real network effects. Adding audience targeting into the core activity stream spec makes it easier than ever for developers to incorporate and support the functionality. It’s a much-needed addition that validates the relevance of activity streams in the social web.
What Else Is New in 2.0?
Activity Streams 2 (AS2), expands on the original spec in several key ways without sacrificing its original intent. The W3C Social Web Working Group originally led the drafting and expansion, and officially published the update on May 23rd, 2017. Among the handful of improvements, it built upon the wording for the summary as a text representation and threw in some more realistic context examples. A few more updates are listed below.
New MIME Media Type
The original purpose of multipurpose Internet mail extension (MIME) types was to improve on basic email functionality. They were designed to tell email clients on how to process and combine different elements like text and attachments.
Since then, MIME types have expanded to all kinds of messaging formats and file types. Activity Streams 2.0 added support for the application/activity+json MIME type to help apps identify documents in the AS2 format.
Compatibility with JSON-Ld (Linked Data)
Linked data creates a better Web, according to JSON-LD’s W3C-supported website. It’s lightweight and easy to read, both valuable traits to any development process—especially those that need to scale. AS2 adding JSON-LD compatibility means less hair-tearing and more flexibility as you build your awesome activity streams.
Support for Objectless Activities
These are also called intransitive activities, and they’re responsible for letting you know things like “Sam is feeling excited.” This kind of support is needed when the actor is also the object, which is becoming commonplace in social apps—for example, a Facebooker checking into a city.
The Internet has brought digital technology to the wider world, and with that comes a dire need to offer as much language support as possible. A great example of this is Android’s documentation on supporting different languages and cultures.
Unless you are specifically targeting English-speaking users, building a multilingual app is building a product that can reach global markets and audiences.
Putting the Pieces Together
Before the World Wide Web was born, most people couldn’t even imagine the possibility of links on their computers taking them anywhere in the world. The Internet was purely a source of information, not a place to interact with others—much less share your every thought with strangers.
Today, most younger people have never even experienced a world without social media, memes, or instant access to the world’s information. At work, we rely on massively powerful SaaS products like Salesforce to update us on project statuses and much more. We network and build our personal brands on LinkedIn. We connect with our neighbors on Nextdoor more than we do in our own front yards. A staggering two billion people find out about their friends’ engagements and pregnancies on Facebook every month. And it all happens with activity streams.
This humble concept is at the core of the largest social and business applications in the world, quietly feeding you the information you care most about, in both your work and personal life. And thanks to the power of open source, it’s helping a global community of software engineers add relevance and stickiness to their apps.
The question, then, becomes: what are you building? Let us know in the comments, and sign up for free to experience how Stream’s API can make activity streams a breeze in your projects.
The original version of this article can be found on the GetStream.io blog on April 26, 2016.