New to ActivityPub, How to implement non-microblog services?

Hello,

I’m new to activitypub. I want to implement a social network that is more like a forum, rather than twitter. After reading the spec, I’m not sure what the best way to implement it is. For example, should I treat each forum thread as a Person?

How to handle moderation (multiple people can delete a thread) etc.

if another activitypub server that doesn’t implement the same forum connects with my server (for example, Mastodon), will that mess things up?

2 Likes

Welcome!

It should be possible to use ActivityPub for forums, and the best way to think about how ActivityPub fits that use-case is to think about how to model typical activities. While the spec maps most cleanly onto email-like messaging, in practice it is generic enough to map onto any “actor-activity-object” model of information.

To answer specific questions:

The best way is whatever makes the most sense. If you need help with a specific mechanism, then feel free to ask more about that specific mechanism.

Nope. You would probably use a Collection or OrderedCollection.

You could have a system actor “own” the threads with attributedTo and then use that actor to send out either Delete and/or Remove activities. In your business logic you would handle multiple actors being able to call the delete function.

It might mess things up if you don’t handle edge cases properly. Otherwise, it should mostly be fine? A good idea would be to drop anything you don’t understand and transform whatever you do understand to fit your internal models.

More generally: an actor Creates a thread (OrderedCollection) that contains posts (activities) within the context of your thread. So a thread might look something like this:

id: example.com/threads/1
type: OrderedCollection
orderedItems: [
  {
  id: example.com/activities/1
  type: Create
  object: example.com/notes/1
  context: example.com/threads/1
  }
  {
  id: example.com/activities/2
  type: Create
  object: example.com/notes/2
  context: example.com/threads/1
  }
  {
  id: example.com/activities/3
  type: Create
  object: example.com/notes/3
  context: example.com/threads/1
  inReplyTo: example.com/notes/2
  }
]

note that the order would have to be reversed since ActivityPub mandates reverse chronological order for any OrderedCollection.

I don’t know the full details, but I know that there are challenges with using ActivityPub for forums and groups. While the specifications allow you to specify relevant fields, many platforms don’t understand what a group or forum is, and it causes them to respond in unexpected ways.

For example, Mastodon does not understand groups, and has restrictions on who can communicate with who. This means that you cannot put the author of the post as the actor because Mastodon will reject the message if it does not recognize the author of the post as an allowed sender.

In Hubzilla and Streams, for example, they had to put the forum as the author of the post so that Mastodon would not reject the message. This allows a Mastodon user to follow or connect to a Hubzilla forum and see all posts made in that forum.

I don’t know all of the technical details, but this is what was explained to me when I asked why the author of the post is not listed as the actor in ActivityPub.

So, just because you can send the fields via ActivityPub doesn’t mean the receiving platform will understand them. Some testing will be required.

The biggest problem we had with implementing traditional forums in the fediverse is the fact that a title is optional in most microblog projects - and is a critical index in a forum application. We tried various approaches to create forums where the title was optional (and auto-generated from whatever content is provided) but these typically look awful and nobody really cares for them. For example somebody posting just a video or image. You can use the link as the title, but this rarely conveys any useful information. Eventually we settled on conversational groups which don’t have this need for a topic summary/headline; it’s just the first post in the group thread. You can create a forum app under your control where a title is mandatory, but then people can’t always post from their own fediverse accounts on their own server unless their service recognises the title is mandatory and helps to enforce it. Some projects don’t even have the concept of a title.

2 Likes

Lemmy is essentially a type of forum, although with a Reddit-like frontend. The way federation works is basically this: each forum is represented by a Group actor, which Announces all activities inside the forum to its followers. This means the Group can verify that actions are valid (eg only mods can remove threads).

You can read the full documentation here. As for compatibility, Mastodon users can follow Lemmy groups without problems, but cant create new topics because it cant send the title field. It would be possible to add a workaround for that, but I think it would be very ugly.

You might also be interested in lemmyBB, an alternative, forum-like frontend for Lemmy.

3 Likes

(Great! I added lemmyBB to delightful-fediverse-clients curated list, even though it is rather a front-end)

You should be able to make use of my publicly-appendable collections FEP for this. I did say that this is a fairly popular primitive in all kinds of human communication, after all.

1 Like