Plan: Map ActivityPub object types to Drupal
A place to jot notes towards outlining an ActivityPub implementation.
Format:
- ActivityPub and models (first-level bullets)
- potential Drupal 8+ equivalents (second-level bullets)
- examples and comments (third-level bullets)
- potential Drupal 8+ equivalents (second-level bullets)
References:
- Background info on ActivityPub
- Specification for ActivityPub
- Specification for ActivityStreams, the basis of ActivityPub.
- Specification for Activity Vocabulary, which details "extended types" for ActivityStreams actors and object such as Person and Note.
- LitePub, an unofficial spec extending ActivityPub.
- Discussion forum on ActivityPub
- ActivityPub as it has been understood--includes lots of relevant links.
Sample ActivityPub implementations:
- Mastodon, microblogging, "Social networking, back in your hands"
- PeerTube, video hosting, "A free software to take back control of your videos"
- WordPress running the IdentityPub plugin, blogging, "Your readers will be able to follow your blogposts on Mastodon and other federated platforms that support ActivityPub."
- Write.as/WriteFreely, blogging, "WriteFreely is free and open source software for starting a minimalist, federated blog — or an entire community."
Tutorials, API documentation for specific ActivityPub implementations
- How to implement a basic ActivityPub server (Mastodon)
- FunkWhale Federation
- What is ActivityPub? (MoodleNet)
The idea in this analysis is to focus mainly on Drupal core but also note some relevant Drupal 8 contributed projects.
It's not expected that any given implementation support all or even most of the extended object types below, as is made explicit in the Activity Vocabulary section on extended types:
Support for specific extended vocabulary types is expected to vary, with implementations only selecting the extended types and properties that make sense within the specific context and requirements of those applications.
What Drupal should support is not a totally simply question. The ways ActivityPub could be supported within Drupal could be viewed on a spectrum. On the one end, we have what Drupal core provides on a typical site: users posting content. On the other end would be highly specialized Drupal-based social networking platforms.
Objects that seem like good candidates for early implementation are in bold.
Activity
Activity types
Compared to Actor and Object, below, the extended types for Activity are probably the least relevant to a Drupal implementation.
Drupal storage and handling of activities is complicated by the need to support remote as well as local objects. For example, a user of a Drupal site might follow another user on the same site or an actor on a remote ActivityPub instance.
Rather than a piecemeal assortment of different Drupal modules for each type of action, it would likely be best to standardize on one or a small set with broad applicability. For example, specialized Flag types might be applied to various activity types.
Accept, "Indicates that the actor accepts the object."- A user accepts an invite per Invite
Add, "Indicates that the actor has added the object to the target."Announce, "Indicates that the actor is calling the target's attention the object."Arrive, "An IntransitiveActivity that indicates that the actor has arrived at the location."Block, "Indicates that the actor is blocking the object."Create, "Indicates that the actor has created the object."- Entity create
Delete, "Indicates that the actor has deleted the object."- Entity delete
Dislike, "Indicates that the actor dislikes the object."- See Like, below.
Flag, "Indicates that the actor is "flagging" the object. Flagging is defined in the sense common to many social platforms as reporting content as being inappropriate for any number of reasons."- Flag with the Flag module
Follow, "Indicates that the actor is "following" the object."Ignore, "Indicates that the actor is ignoring the object."Invite, "A specialization of Offer in which the actor is extending an invitation for the object to the target. "Join, "Indicates that the actor has joined the object."- A user joins a group (Group or Organic Groups).
Leave, "Indicates that the actor has left the object."- A user joins a group (Group or Organic Groups).
Like, "Indicates that the actor likes, recommends or endorses the object."Listen, "Indicates that the actor has listened to the object."Move, "Indicates that the actor has moved object from origin to target."Offer, "Indicates that the actor is offering the object."Question, "Represents a question being asked."Reject, "Indicates that the actor is rejecting the object."- See Accept, above.
Read, "Indicates that the actor has read the object."Remove, "Indicates that the actor is removing the object."TentativeReject, " A specialization of Reject in which the rejection is considered tentative. "TentativeAccept, " A specialization of Accept indicating that the acceptance is tentative. "Travel, "Indicates that the actor is traveling to target from origin."Undo, "Indicates that the actor is undoing the object."Update, "Indicates that the actor has updated the object"- Entity update
View, "Indicates that the actor has viewed the object. "
Actor
Actor types
Application, "Describes a software application."- Drupal core
- A specific Drupal distribution that ships with ActivityPub integration, as captured in the
distribution.nameproperty of a profile's*.info.ymlfile.
Group, "Represents a formal or informal collective of Actors."- A group of
userentities assigned to a group per the Group or Organic Groups modules.
- A group of
Organization, "Represents an organization."- The organization behind a site, possibly captured in the
system.siteconfiguration item'snameproperty.
- The organization behind a site, possibly captured in the
Person, "Represents an individual person."- A user entity.
- A node entity of a type associated with people (example: a
personcontent type). - A contact in a Drupal-linked CRM.
Service, "Represents a service of any kind."
Object
Object types
ActivityPub object types will generally map to Drupal content entity types.
Article, "Represents any kind of multi-paragraph written work."- Content type (
nodeentity bundle) with (at least) a field of typetext_long,text_with_summary, orstring_long.- Example:
articlenode type that ships with core'sstandardinstall profile. - Challenges include:
- Required CSS/JS. Can be added via context per https://www.w3.org/TR/activitystreams-core/#h-example-3context but
- The ActivityPub source property won't mix easily with the various filters typically in place in a Drupal text format. For example, even if a text filter is using Markdown via the contrib Markdown module, it's likely that other filters in place will be Drupal-specific, such as media embed filters.
- While technically appropriate for long-form textual items, the
Articletype has limited support in some existing ActivityPub implementations. Reportedly, in Mastodon, whileNotetext is shown in full,Articletext doesn't appear but only a link.
- Example:
- Content type (
Audio, "Represents an audio document of any kind."- Media type (
mediaentity bundle) using theAudioFilesource plugin.- Example:
audiomedia type that ships with core'sstandardinstall profile.
- Example:
- Media type (
Document, "Represents a document of any kind. "Event, "Represents any kind of event."- A node entity of a type that includes at least one field of type
- An event as designated by the RNG - Events and Registrations module or Entity Registration Form
Image, "An image document of any kind."Note, "Represents a short written work typically less than a single paragraph in length."- A comment entity
- Private Message, Microcontent
Page, "Represents a Web Page."Place, "Represents a logical or physical location."- A content type with (at least) one field of type Geolocation or Geofield.
Profile, "A Profile is a content object that describes another Object, typically used to describe Actor Type objects."- A user entity with a field of type
text_longor similar. - A Profile module record.
- A user entity with a field of type
Relationship, "Describes a relationship between two individuals."- A relationship defined in Friend Flag or similar.
Tombstone- Would need something like Entity Delete Log, but no D8 version yet; see https://www.drupal.org/project/entity_delete_log/issues/2922764. Or would need to store deletions in our own entity type or similar.
Video- Media type (
mediaentity bundle) using theVideoFilesource plugin
- Media type (
Links
Link types
Join, "Indicates that the actor has joined the object." A user joins a group (Group or Organic Groups).
I'll already throw this one in here. One of the systems I'm looking to integrate with also implements join, but as I understand it to mean much the same as RSVP, you are joining an Event object. Which makes complete sense as both actor and target of the action are any Activity Vocabulary objects.
This is the fixture they're using for testing: https://framagit.org/framasoft/mobilizon/blob/master/test/fixtures/mobilizon-join-activity.json (the rest of the fixtures there are also helpful examples I've found).
I'll already throw this one in here. One of the systems I'm looking to integrate with also implements join, but as I understand it to mean much the same as RSVP, you are joining an Event object. Which makes complete sense as both actor and target of the action are any Activity Vocabulary objects.
Ha! And there's an RSVP they could use in the spec I notice while writing all this up.
Incidentally more fixtures that are good to get an idea of what is out there:- https://framagit.org/framasoft/mobilizon/blob/master/test/fixtures https://git.pleroma.social/pleroma/pleroma/tree/develop/test/fixtures Sadly not found anything so handy for PeerTube, PixelFed, or Friendica.