John Holdun

What Is ActivityPub?

ActivityPub is how people can Like your blog posts. ActivityPub is how your social network can interact with my social network. ActivityPub layers social activity on the website you already have.

If I visit your website in my browser, I’ll probably receive HTML—a human-friendly document. If I load that same URL in my feed reader, I may receive RSS—a machine-friendly feed. I might even request that same URL in another format and receive structure data like CSV or JSON—harder for a human to read directly but easier for a machine to manipulate and then display in various ways. When these different clients—my browser, my feed reader, my API request—load this same URL, they are specifying what kind of data they’d like to receive.

One kind of data is called Activity Streams. It’s just JSON, but it’s formatted in a particular way to describe what happens on social networks: things like “Tamara published a Photo” and “Jo liked Tamara’s Photo.” Tamara and Jo are Actors; Tamara’s Photo and Jo’s Like are Objects, and each of these examples is an Activity.

Anyone can publish Activity Streams data by creating these JSON objects and putting them on their website, in the same way they might publish an HTML page or an RSS feed. However, we’re missing the social part: this is just a format and it doesn’t say anything about how other people should consume or interact with this stuff. That’s what ActivityPub is for!

To use ActivityPub, you define your Actor (by creating a JSON object) and include links to two endpoints—an inbox and an outbox. These are just two URLs that serve JSON objects called Collections. Anything you publish gets added to your outbox Collection, and anything someone else wants you to see gets added to your inbox Collection. If some Actor adds a Follow Activity to your outbox, you’ll know that they want to receive all of your new Activities. Now, every time you publish a new Activity, you’ll add it to your outbox and to your new follower’s inbox. Blog posts, statuses, RSVPs, check-ins, and even private messages are all just Activity Streams Objects that move around between inboxes and outboxes.

Your inbox and outbox can live on your personal website, like a blog, or you can create an account on a shared website, like a social network, and all of these websites can talk to each other with ease. It’s like if I were to publish a video to my YouTube channel and you automatically saw that video in your Instagram feed—not because I reposted it to Instagram, but because it’s just another Activity that landed in your inbox.

It’s for this reason that large corporate social networks like YouTube and Instagram have not implemented ActivityPub and probably never will. Their financial success depends on displaying ads to a captive audience, and ActivityPub is simply too flexible to make sure their audience is seeing those ads. So independent developers and non-profit groups are building open alternatives to the classic social networks: you won’t see my YouTube video in your Instagram feed, but you can see my PeerTube video in your Pixelfed feed, or on your personal website, or in any client of your choice, formatted however you like.

We’re still in the very early days of this technology and there’s lots of untapped potential, but the community is growing rapidly: for example, millions of people use Mastodon and Pleroma, two popular Twitter-like web apps that are ActivityPub-compliant and interoperable.

So to summarize: ActivityPub is social media, but it’s also blogs, and it’s also just the web. It’s whatever you want it to be. Hope this helps!

Further Reading