Skip to content

Posting as the user

Applications can post to the user’s outbox as if they were the user. This can be used, for example, to automatically accept some type of activity.

Posting as the user

You can use the post action of the PodOutboxService which is automatically created for every application.

const activityUri = await ctx.call('pod-outbox.send', {
activity: {
type: 'Accept',
object: 'http://localhost:3000/bob/eba0227a-3bbb-4582-b879'
},
actorUri: 'http://localhost:3000/alice'
});

The action will return the generated activity URI, which will look like this:

{
"@context": "https://www.w3.org/ns/activitystreams",
"id": "http://localhost:3000/alice/data/cdc993eb-d3e1-4d12-9487",
"type": "Like",
"actor": "http://localhost:3000/alice",
"object": "http://localhost:3000/bob/eba0227a-3bbb-4582-b879",
"generator": "http://localhost:3001/app"
}

The generator property is automatically added to indicate that the activity was generated by the application. There is currently no use for this, but it seems important to semantically distinguish activities posted by the user from activities automatically generated by applications.

Create, Update and Delete activities

Create, Update and Delete activities are supported, and will result in changes in the Pod server. However, you can only create or update resources for which you have requested write permission.