Flow for publishing first post to federation

Hello,

My brain is having difficulty forming a mental model of the ActivityPub protocol. I’ve read through the ActivityPub spec and the ActivityPub vocabulary, but I still do not understand how to publish content to the federation.

My current understanding is that there are inboxes and outboxes. Users (servers) POST to each other’s inboxes, and optionally, browsers (clients) can post to a user’s outbox to later be processed by their server. Does that mean to publish I have to send my content to a specific user/server, or is there a better way?

If I’m implementing AP for my blog, how can I broadcast my post to the world? Is it a MUST that I send a Note wrapped in a Create activity to a specific inbox (signed, of course)? Or is there some REST-like aspect to AP where I can display all my current posts on my profile, and other servers in the federation just magically discover it?

Can someone explain how this works, or point me in the right direction? As always, any help is much appreciated!

1 Like

You can basically send out all kinds of objects with an activity. If you build it for a blog, you might want to use the Article object since a bunch of implementations have some kind of custom handling for articles, treating them as long-form posts.

If you want the posts to just be repostable, you don’t have to send anything out. You can just put the link to your ActivityPub-enabled blog post into the search bar of your instance and it should then import it.
From there you can just repost it.

Note that Mastodon requires Webfinger for federation to work. So if you want your stuff to show up on Mastodon instances, you need support for the Webfinger protocol as well

If you want the posts to pop up on home feeds of followers, you will need to fan out the posts to the follower inboxes.

Some implementations do back-filling of old posts by paginating your outbox, since outboxes should be an OrderedCollection of public posts in form of their respective Create activities. They get paginated over next and prev attributes of the collection.

2 Likes

First my obligatory bit of self-promotion: I’ve written up how to send a first message with bovine here. Basically bovine is a python library, that makes the tasks that you describe easier.

ActivityPub is not a broadcast protocol. Instead how it works is that you are somehow discovered and people start following you. So if you just start your blog, nobody will be following you, so your messages might go nowhere.

As stated above, basically yes: You must send individual objects to all relevant inboxes. There are some caveats: You don’t have to use a Note. You don’t have to send the same message to people sharing a sharedInbox. You can send it to said sharedInbox instead.

It is theoretically enough to display your posts in your outbox. I think me and @silverpill have capabilities to read your messages from the outbox. I’m not sure how many other people can do it. People using Mastodon cannot.

3 Likes

Thank you all! I did not realize I could send content to any inbox. I successfully published my first content to the Fediverse!

1 Like

Please don’t. Only send content to an inbox you have business to. :wink:

On another note, it’s one of the unfortunate things about the ActivityPub specification that it doesn’t provide clear algorithms for what the recipients and thus inboxes are.