The create activity

July 12, 2017 by Jessica Tallon

ActivityPub is a set of social APIs which provide client to server and server to server federation. It’s based upon the premise of inboxes and outboxes, just like e-mail! A user creates a note/image/whatever and submits it to their outbox, it’s then sent to folks’ inboxes via the server which they can then read to see what has been sent.

Everything in their outbox and inbox has an Activity. Just like we in native languages use verbs and nouns, the verbs describing what we’re doing - those are the activities. For example:

Jessica  creates    an image

<who>   <did what>  <what did they do it to>

So what does one of these things look like?

{
	"@context": "https://www.w3.org/ns/activitystreams",
	"type": "Create",
	"id": "https://tsyesika.se/activity/1"
	"actor": "https://tsyesika.se/",
	"object": {
		"id": "https://tsyesika.se/notes/72",
		"type": "Note",
		"attributedTo": "https://tsyesika.se/",
		"content": "This is a note",
		"published": "2015-02-10T15:04:55Z",
	},
	"published": "2015-02-10T15:04:55Z",
	"to": ["https://example.org/~john/"],
	"cc": ["https://example.com/~erik/followers",
				 "https://www.w3.org/ns/activitystreams#Public"]
}

So the activity has a bit of info here:

  • Who’s doing the thing (actor)
  • When it was done (published)
  • What was being done (type)
  • Where it’s going (to, cc)

What’s the problem?

There is a divide in the ActivityPub sphere and the wider federated social protocol community. Some think the create activity is superfluous, introduces complexity and it can also cause problems with legacy sites adopting it.

Over the last few years of specification development several changes have been made to help people who just want to work with the object. The main one is allowing the client to post simply an object and let the server handle wrapping it in an activity (https://www.w3.org/TR/activitypub/#object-without-create).

Why have it?

Consistency

Everything else is an activity wrapping an object. If you Like, Share, Delete, Eat, Buy, etc - you’re doing it to other things. For example:

{
	"@context": "https://www.w3.org/ns/activitystreams",
	"type": "Like",
	"id": "https://tsyesika.se/activity/2"
	"actor": "https://tsyesika.se/",
	"object": {
		"id": "https://tsyesika.se/notes/72",
	},
	"published": "2015-02-10T15:10:06Z",
	"to": ["https://www.w3.org/ns/activitystreams#Public"]
}

or

{
	"@context": "https://www.w3.org/ns/activitystreams",
	"type": "Visit",
	"id": "https://tsyesika.se/activity/2"
	"actor": "https://tsyesika.se/",
	"object": {
		"type": "Place"
		"name": "Veggie Galaxy",
		"latitude": "42.364",
		"longitude": "-71.101"
	},
	"published": "2015-02-10T15:10:06Z",
	"to": ["https://www.w3.org/ns/activitystreams#Public"]
}

If your inbox or outbox has a bunch of other activities and then raw objects randomly appear in-place of create objects it becomes frustrating to code around (right now you can assume all activities have an object property).

Activity Streams and thus ActivityPub was built around the concept of folks wanting to share the things they’re doing. Those are activities, be it creating blog posts, taking a bike ride or eating one of those awesome burgers at Veggie Galaxy. Everyone then interacts with things by “liking”, “sharing”, etc. those posts.

Social networks can’t get away from activities, nor should they.

I’m aware that people aren’t suggesting removing all activities, just create. The create however is just as important, it gives me the context of why an object is showing up. In ActivityPub all activities are first class citizens, why should posting a note be any different from riding my bike or cooking a recipe?

When someone first builds a blog on their personal site they probably don’t think about creating an activity. They just submit their post and, what else would they be doing? Of course they created it, right? But that only makes sense in terms of that blog, if that’s federated to Strava where most people just run or ride a random blog post is out of context.

In a world where Reddit, Strava, my blog, Mastodon and GNU Mediagoblin could all be federating with each other and they all have their individual perspectives, activities contextualise everything. They don’t presume what one has or is doing, it doesn’t skew the client or user in favour of blogging or tooting - every activity is equal.

Log

Inboxes and outboxes provide a log of everything we do. They are a list of activities which read like english sentences, for example:

  • “Jessica posted an image”
  • “Chris liked the image”
  • “Jessica updated the image”
  • “Matt created a note in reply to the image”
  • “Jessica deleted the image”

When I eventually delete the image it also (relatively) gracefully handles the fact the image ended up in a bunch of other people’s inboxes. Just because we have federation that doesn’t mean we want to remove the ability of people to delete things.

An example of that initial post once it’s been deleted:

{
	"@context": "https://www.w3.org/ns/activitystreams",
	"type": "Create",
	"id": "https://tsyesika.se/activity/3"
	"actor": "https://tsyesika.se/",
	"object": {
	  "id": "https://tsyesika.se/image/1"
		"type": "Tombstone",
		"deleted": "2015-02-10T15:04:55Z"
	},
	"published": "2015-02-10T15:10:06Z",
	"to": ["https://www.w3.org/ns/activitystreams#Public"]
}

It causes no confusion. You deleting it doesn’t change the fact you posted it, folks interacted with it, and then you deleted it. It lets everyone see easily what happened.

More data

Some of the extra data has been resolved as of Activity Streams 2.0, however I’d still argue there is a decent difference between the object and the activity.

Who (actor)

This has now been improved with the attributedTo property being more descriptive. It is still true though that Person A might have taken a photo but Person B might be the one to post it.

When (published)

The “published” property in my opinion is named badly. It however, could still be different depending on the situation, for example. Imagine a “buy” activity where I buy a game. The game itself might have been published at a different time than when I bought the game.

© 2017 Jessica Tallon
Verbatim copying and redistribution of this entire page are permitted provided this notice is preserved.