Chapter 5. Extending ActivityPub

At its base specification, ActivityPub covers some of the most essential activities that we do with social networks: creating and editing content, reacting to content, organizing content, and managing the social graph. For many social applications, this is going to cover most of what you need.

But human sociality is large and sprawling, and we can use ActivityPub for thousands of social applications. The goal of ActivityPub is to be a platform for building social applications, not to be the endpoint for a tiny subset of the social world. If a form of social interaction can be mediated or represented digitally, ActivityPub should be able to handle it. That’s why ActivityPub is extensible.

Extensibility is built into the ActivityPub model because it’s built into the Activity Streams 2.0 model, which (in turn) is built on top of JSON-LD, as you learned in Chapter 1. Adding new properties and even new data types can facilitate different types of social interaction online.

In this chapter, I’m first going to talk about general principles for receiving extended properties or object types that your program wasn’t designed for. Then I’ll cover the flip side: sending properties and object types that other programs might not be able to understand. I’ll be using made-up extensions to illustrate these principles.

I’ll then get into two major categories of extended types: using other parts of the Activity Vocabulary and using other well-known vocabularies. ...

Get ActivityPub now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.