ActivityPub/Primer/Outbox

From W3C Wiki

The outbox property of an Actor object is used for a number of use cases:

  • It is the POST endpoint for client-to-server submissions
  • It is used for fetching an Actor's activities for the client-to-server API
  • It is used for "warm-starting" a new interaction between accounts on different servers
  • It can be used for "catchup" in synchronization when there have been connectivity issues or outages

It is required by the ActivityPub standard. However, some processors, such as Mastodon, will not enforce this requirement when working with an external Actor object, especially if they are not going to use it.

The text of the ActivityPub spec defines outbox as:

An [ActivityStreams] OrderedCollection comprised of all the messages produced by the actor; see 5.1 Outbox.

The outbox collection is an ActivityPub object in its own right, and needs to conform to the requirements of the ActivityPub definition for objects -- namely, it should have a dereferenceable identifier, such as an HTTPS URL, and a type.

Examples

The value of the outbox property of an ActivityPub actor can be an URL:

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Person",
  "id": "https://example.com/person/12345678",
  "name": "James Riley",
  "inbox": "https://example.com/collection/87654321",
  "outbox": "https://example.com/collection/76543218"
}

The value of the outbox property can also be a JSON object, including the id as well as other properties of the outbox collection:

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Person",
  "id": "https://example.com/person/12345678",
  "name": "James Riley",
  "inbox": "https://example.com/collection/87654321",
  "outbox": {
     "id": "https://example.com/collection/76543218",
     "type": "OrderedCollection",
     "name": "James Riley's outbox",
     "totalItems": 738
  }   
}

The JSON object format has the benefit of sharing important metadata about the collection, such as the totalItems property that counts the number of members of the collection, without requiring an extra HTTP request.

Guidelines for publishers

  • Use the URL form for the outbox property. Unfortunately, not all consumers recognize the object form of the outbox property; some require an URL only.
  • The outbox collection should be a real ActivityPub object; consumers should be able to GET the id for the outbox, and get its metadata and contents.
  • Outboxes for even moderately productive actors on the social web can get very full very fast; it is a good idea to use pagination for the outbox collection.

Guidelines for consumers

  • Support both the URL form and the object form of the property. If your implementation is only using the outbox id as an endpoint to POST to, make sure to extract the id property from the object.