In ActivityPub, how do you get an inbox URL?

1.2k views Asked by At

I know that servers communicate by POSTing to an inbox and outbox. But what's the URL for the inbox and outbox?

1

There are 1 answers

2
Evan Conrad On

How to get the inbox or outbox URL

The URL is whatever the implementing server says it is. So it's different for each ActivityPub server.

The inbox and outbox URL for an actor is defined in the JSON-LD document for an actor:

{ 
  "@context": ["https://www.w3.org/ns/activitystreams",
               {"@language": "ja"}],
  "type": "Person",
  "id": "https://kenzoishii.example.com/",
  
  // Right here!
  "inbox": "https://kenzoishii.example.com/inbox.json",
  "outbox": "https://kenzoishii.example.com/feed.json",

  ...
}

This also means that the inbox and outbox can be actor-specific, not just server specific.

How to get the actor JSON

Some ActivityPub sites like Mastodon make use of Webfinger to standardize a URL that can be used to get an actor's JSON-LD doc:

/.well-known/webfinger?resource=acct:[email protected]

In this case, if you wanted to know the inbox for [email protected], you would first query the webfinger:

GET https://mastodon.technology/.well-known/webfinger?resource=acct:[email protected]

That would give you a JSON object like this:

{
  subject: "acct:[email protected]",
  links: [
    {
      rel: "self",
      type: "application/activity+json",
      href: "https://mastodon.technology/users/Flaque"
    }
  ]
}

With that href: https://mastodon.technology/users/Flaque, you can get the JSON representation with:

https://mastodon.technology/users/Flaque.json

(Note the .json!)

That would then give you a full actor object, which would include the inbox and outbox:

{
  "inbox": "https://mastodon.technology/users/Flaque/inbox",
  "outbox": "https://mastodon.technology/users/Flaque/outbox",
  ...
}