ActivityPub

Book description

ActivityPub is the new standard for connecting social networks together on the social web. This open, decentralized social networking protocol defines an API for sharing activities to a social network and a procedure that servers use to distribute those activities to a subscriber's feed. With this book, you'll learn how to assemble ActivityPub-enabled clients for making new kinds of social apps on top of existing networks and build ActivityPub servers that create new human or automated accounts on the social web.

With those skills under your belt, you can explore other applications of this publish-subscribe technology: content management systems, internet of things, and enterprise automation. With hands-on examples and in-depth knowledge from Evan Prodromou, one of the authors of the protocol, this is the ActivityPub handbook that every social software hacker needs.

  • Learn what the social web is and what ActivityPub does
  • Represent social network data in the Activity Streams 2.0 format
  • Write a simple ActivityPub client and server
  • Extend ActivityPub's functionality with new types
  • Find in-depth details about the more obscure ActivityPub data structures

Evan Prodromou is a coauthor of the ActivityPub protocol and the Activity Streams 2.0 data format.

Publisher resources

View/Submit Errata

Table of contents

  1. Preface
    1. Audience
    2. Prerequisites
    3. Structure
    4. Conventions Used in This Book
    5. Using Code Examples
    6. O’Reilly Online Learning
    7. How to Contact Us
    8. Acknowledgments
  2. 1. Welcome to the Fediverse
    1. What Social Networks Do
    2. What Social Networks Don’t Do
    3. Locked In to Social Networks
    4. From Social Network to Social Web
    5. A Tour of the Standards
      1. Activity Streams 2.0
      2. The ActivityPub API
      3. The ActivityPub Protocol
    6. A Brief History of the Fediverse
    7. A Tour of the Fediverse Today
    8. What the Fediverse Holds in Store for Tomorrow
    9. Conclusion
  3. 2. Activity Streams 2.0
    1. The First Steps
    2. Publishers and Consumers
    3. Type
    4. Identity
    5. Vocabulary
    6. Properties
    7. Activity Types
    8. Actor Types
    9. Object Types
      1. HTML
      2. Attachments and Tags
    10. Collections
    11. Addressing Properties
    12. Internationalization
    13. Timestamps
    14. Type Hierarchy
    15. External Vocabularies
    16. Internet Media Types
    17. Representation Granularity
      1. ID-String Representation
      2. Brief Representation
      3. Functional Representation
      4. Link Representation
      5. Full Representation
    18. Names
    19. Using Activity Streams 2.0
    20. Storing AS2 Documents
      1. Considering Storage Options
      2. Storing Collections
    21. Is It JSON or Linked Data?
    22. Conclusion
  4. 3. The ActivityPub API
    1. Using a Standard API
      1. The World of API Clients
      2. An Extended Example
      3. A Follow-Your-Nose API
    2. Following Rules for ActivityPub Data
    3. Reading Data: The Actor
      1. WebFinger for Discovery
      2. OAuth 2.0 for Access Control
    4. Reading Data: Collections
      1. The Inbox and Outbox
      2. The Social Graph
      3. Reading Remote Data: The proxyUrl Endpoint
    5. Writing Data: Activities as Commands
      1. POSTing to Create
      2. Handling Errors
    6. Making Things
      1. Create
      2. Update
      3. Delete
      4. Implicit Create
    7. Modifying the Social Graph
      1. Follow
      2. Accept and Reject
      3. Undo
    8. Managing Collections
      1. Add
      2. Remove
      3. Update
      4. Delete
    9. Reacting
      1. Like
      2. Announce
      3. inReplyTo
    10. Ensuring User Safety
      1. Block
      2. Flag
    11. Uploading Files
    12. Understanding the Authorization Model
    13. Optimizing the ActivityPub API
      1. Use an HTTP Cache
      2. Use Data You Already Have
      3. Use Low-Resolution Representations
      4. Reuse the Output of Posted Activities
      5. Use GZIP Compression
      6. Use Keep-Alive Connections
    14. Understanding What’s Missing
    15. Conclusion
  5. 4. The ActivityPub Protocol
    1. Exploring an Extended Example
    2. Understanding the Shape of Federated Social Networking
    3. An API Becomes a Protocol
    4. Using HTTP Signatures
      1. Performing Server-to-Server Authentication
      2. Understanding the Signature Header
      3. Representing Public Keys
      4. Using the Server Actor
      5. Making Requests
      6. Validating a Signature
    5. Implementing WebFinger
    6. Getting Objects
    7. Fetching Local Objects
    8. Delivering Activities
      1. Shared Inbox
      2. Delivery Queues
      3. Retries
      4. Delivery Failure
    9. Receiving Activities
    10. Caching Remote Data
      1. “Trust…for Now”
      2. Trust Heuristics
      3. Digital Signatures
    11. Handling Activity Side Effects
      1. Create
      2. Update
      3. Delete
      4. Add
      5. Remove
      6. Follow
      7. Accept
      8. Reject
      9. Like
      10. Announce
      11. Block
      12. Flag
      13. Undo
    12. Filtering Activities
    13. Optimizing Federated Servers
    14. Following a Server Checklist
    15. Conclusion
  6. 5. Extending ActivityPub
    1. Understanding Senders and Receivers
      1. Receiving Extended Properties
      2. Receiving Extended Types
      3. Sending Extended Properties
      4. Sending Extended Types
    2. Using the Rest of the Activity Vocabulary
      1. Polls
      2. Account Portability
      3. Events
      4. Groups
      5. Geosocial
      6. Media Experiences
    3. Using Other Well-Known Vocabularies
      1. Miscellany
      2. vCard
      3. Schema.org
      4. Dublin Core
    4. Creating a New Vocabulary
      1. Defining the Terms
      2. Defining the Context Document
      3. Publishing the Documentation
      4. Growing an Extension
    5. Conclusion
  7. 6. Far Horizons
    1. Near Horizons
    2. Objects as Actors
    3. Search
    4. Artificial Intelligence
    5. Content Management
    6. Games
    7. Health Tracking
    8. Internet of Things
    9. Dating
    10. Enterprise Software
    11. Software Development
    12. Payments
    13. Marketplace
    14. Happiness
    15. Conclusion
  8. A. Activity Vocabulary Types
    1. Groups
    2. Accept
    3. Activity
    4. Add
    5. Announce
    6. Application
    7. Arrive
    8. Article
    9. Audio
    10. Block
    11. Collection
    12. CollectionPage
    13. Create
    14. Delete
    15. Dislike
    16. Document
    17. Event
    18. Flag
    19. Follow
    20. Group
    21. Ignore
    22. Image
    23. IntransitiveActivity
    24. Invite
    25. Join
    26. Leave
    27. Like
    28. Link
    29. Listen
    30. Mention
    31. Move
    32. Note
    33. Object
    34. Offer
    35. OrderedCollection
    36. OrderedCollectionPage
    37. Organization
    38. Page
    39. Person
    40. Place
    41. Profile
    42. Question
    43. Read
    44. Reject
    45. Relationship
    46. Remove
    47. Service
    48. TentativeAccept
    49. TentativeReject
    50. Tombstone
    51. Travel
    52. Undo
    53. Update
    54. Video
    55. View
  9. B. Activity Streams 2.0 Properties
    1. Groups
    2. accuracy
    3. actor
    4. alsoKnownAs
    5. altitude
    6. anyOf
    7. attachment
    8. attributedTo
    9. audience
    10. bcc
    11. bto
    12. cc
    13. closed
    14. content
    15. contentMap
    16. context
    17. current
    18. deleted
    19. describes
    20. duration
    21. endpoints
    22. endTime
    23. first
    24. following
    25. followers
    26. formerType
    27. generator
    28. height
    29. href
    30. hreflang
    31. icon
    32. id
    33. image
    34. inbox
    35. inReplyTo
    36. instrument
    37. items
    38. last
    39. latitude
    40. liked
    41. likes
    42. location
    43. longitude
    44. mediaType
    45. name
    46. nameMap
    47. next
    48. object
    49. oneOf
    50. origin
    51. outbox
    52. partOf
    53. preferredUsername
    54. prev
    55. preview
    56. published
    57. radius
    58. rel
    59. relationship
    60. replies
    61. result
    62. shares
    63. source
    64. startIndex
    65. startTime
    66. streams
    67. subject
    68. summary
    69. summaryMap
    70. tag
    71. target
    72. to
    73. totalItems
    74. type
    75. units
    76. updated
    77. url
    78. width
  10. About the Author

Product information

  • Title: ActivityPub
  • Author(s): Evan Prodromou
  • Release date: September 2024
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781098169466