Jump to content

ActivityPub/Primer/Actors

From W3C Wiki

The actor role in ActivityPub is a core part of the API and federation protocol. Actors are objects that can publish activities.

The ActivityPub specification has a detailed description of the actor role.

All actors must have two important properties:

  • outbox is a collection of all activities that the actor has done, namely, that it is the actor property for.
  • inbox is a collection of all the activities that the actor has received, typically because the actor is an addressee (in the `to`, `cc`, `bto`, `bcc`, `audience` properties or in a collection in one of those properties).

Actor object types

An important thing to note is that actors are identified using duck-typing, that is, they are identified by whether they have a certain set of properties. There is no Actor type defined in ActivityPub.

The Activity Streams 2.0 Vocabulary has an entire list of types called "actor types". These are object types that are often actors in a social network context, such as a Person, an Application, or an Organization.

However, the ActivityPub specification specifically allows other types of objects to be ActivityPub actors.

ActivityPub actors are generally one of the ActivityStreams Actor Types, but they don't have to be. For example, a Profile object might be used as an actor, or a type from an ActivityStreams extension. Actors are retrieved like any other Object in ActivityPub.

Objects with other types can be ActivityPub actors, just like actor-type objects. For example, it's possible for an Image to be followed, to have followers, and to publish activities, as long as it has inbox and outbox properties.

Following an actor

An important relationship between two actors is the follower-following relationship. A follower will receive new activities addressed to the followed object's followers.

Following in ActivityPub is one-directional; A following B does not necessarily imply that B follows A.

A following relationship is initiated by the follower, using the Follow activity. The following relationship can be terminated by the follower using a Undo activity, or by the followed actor using a Block activity.

Once a following relationship is established, the followed actor is added to the follower's following collection, and the follower is added to the followed actor's followers collection.

Following other object type

To make a content-type object followable, like an Image, make it an ActivityPub actor by adding an inbox and an outbox. Adding a followers collection is also recommended.

Other actors can follow the content-type object using an Follow activity.

In the social media framework, content-type objects are not particularly "active" and probably won't generate a lot of activities in which they are the actor property.

However, a content-type object can re-share activities in which it is the object or target property (or possibly other properties).

The easiest way to re-share an activity is by using Announce activities. Another option is to use inbox forwarding.

Some implementations, like Mastodon, will not accept actors unless they use the actor types from AS2 vocabulary. One workaround is to implement the object as an Application or Service, but this loses a lot of the type semantics for content objects.

What can go in the outbox

- TBD, possibly inbox forwarding stuff

Terminology

There are at least three uses of the word "actor" in ActivityPub and Activity Streams 2.0, which can be really confusing for implementers. Although they often overlap, they are not required to!

  • The ActivityPub definition of an actor, that is, an object with an inbox and an outbox.
  • The actor property of an Activity is the object that performed the activity. In AP, it is usually an ActivityPub actor, but in other uses of AS2, it might not be.
  • The "actor types" in AS2 Vocabulary, which are a group of types that are **often** AP actors, or used in the actor property, but not necessarily.