Posting to Pleroma inbox

If anything is still unclear feel free to describe your use case.

I was building a new AP client (only C2S) application, how would I send a message to some other AP implementation using C2S API?

Do you want to use ActivityPub in a peer to peer context without servers?


For me the graphics and this recap helped:

Hey nice, so just as a recap:

  • You can POST to someone’s inbox to send them a message (server-to-server / federation only… this is federation!)
  • You can GET from your inbox to read your latest messages (client-to-server; this is like reading your social network stream)
  • You can POST to your outbox to send messages to the world (client-to-server)
  • You can GET from someone’s outbox to see what messages they’ve posted (or at least the ones you’re authorized to see). (client-to-server and/or server-to-server)

Of course, if that last one (GET’ing from someone’s outbox) was the only way to see what people have sent, this wouldn’t be a very efficient federation protocol! Indeed, federation happens usually by servers posting messages sent by actors to actors on other servers’ inboxes.

Hm, found this example today and tried to post this activity:

{
@context”: “https://www.w3.org/ns/activitystreams”,
“type”: “Create”,
“actor”: “https://social.liberta.vip/users/”,
“object”: {
“type”: “Note”,
“content”: “Test”
}
}

to a pleroma instane.

Response:
“Unhandled activity type”

That should also be possibel ??

curl --location --request POST ‘https://social.liberta.vip/users/r/outbox’
–header ‘Content-Type: application/activity+json’
–header ‘Authorization: Basic xxxxxxxxxx’
–header ‘Cookie: __Host…’
–data-raw ‘{
@context”: “https://www.w3.org/ns/activitystreams”,
“type”: “Note”,
“content”: “Test”
}’

Response:
“Unhandled activity type”

Does anybody see my problem ?
Thanks

The second snippet isn’t going to work, you’re sending in an object and
at the moment pleroma doesn’t auto-wraps them into Creates.
And it seems quite weird that you’re using Auth Basic and cookies,
shouldn’t cause this error message but not entirely ruling it out.

For the first one it’s weird to have this message, another one wouldn’t have
surprised me as it’s missing addressing(to or cc).

what is the correct address to use for “to” ? e.g. https://chaos.social/@naturzukunft

It must be the id of the actor in that case, e.g. https://chaos.social/users/naturzukunft. The URI you are using is instead the actor’s url property.

curl --location --request POST ‘https://social.liberta.vip/users/rdf4j7340/outbox
–header ‘Content-Type: application/activity+json’
–header ‘profile: https://www.w3.org/ns/activitystreams"’
–header ‘Authorization: Basic xxxxxxxxxxxxxx’
–data-raw ‘{
@context”: “https://www.w3.org/ns/activitystreams”,
“type”: “Create”,
“actor”: “https://social.liberta.vip/users/rdf4j7340”,
“to”: “https://chaos.social/users/naturzukunft”,
“object”: {
“type”: “Note”,
“content”: “Test”
}
}’

-> Internal Server Error

;-(

Pleroma probably wants to to be a list.

curl --location --request POST ‘https://social.liberta.vip/users/rdf4j7340/outbox
–header ‘Content-Type: application/activity+json’
–header ‘profile: https://www.w3.org/ns/activitystreams"’
–header ‘Authorization: Basic cmRmNGo3MzQwOkhhbGJlR2xhczI4Iw==’
–data-raw ‘{
@context”: “https://www.w3.org/ns/activitystreams”,
“type”: “Create”,
“actor”: “https://social.liberta.vip/users/rdf4j7340”,
“to”: [
https://chaos.social/users/naturzukunft
],
“object”: {
“type”: “Note”,
“content”: “Test”
}
}’

–>

{
“errors”: {
“detail”: “Internal server error”
}
}

Probably should also have an empty list for cc.

{
@context”: “https://www.w3.org/ns/activitystreams”,
“type”: “Create”,
“actor”: “https://social.liberta.vip/users/rdf4j7340”,
“to”: [
https://chaos.social/users/naturzukunft
],
“cc”: [],
“object”: {
“type”: “Note”,
“content”: “Test”
}
}

-> Internal server error

Hi @naturzukunft. I unfortunately don’t have the solution, but would like to point you to Guide for new ActivityPub implementers, which is a wiki post for anyone to edit. Once you fix this issue, it might be helpful to add to this tutorial for the next person that comes after you, if you can spare a couple of minutes to update :blush:

I’m not sure, that object is a valid AS object as far as Pleroma 1.x is concerned, but Pleroma 2 has a different validation engine which may actually be too strict here. I would suggest filing a bug though, as this is a conformance issue.

Do you no a pleroma instance that is well maintained and the newest version is deployed? i don’t know how this is at https://social.liberta.vip.
Fredy

$ curl -sSL https://social.liberta.vip/api/v1/instance | jq .version
"2.7.2 (compatible; Pleroma 2.2.2)"

And with checking at https://git.pleroma.social/pleroma/pleroma/-/releases, you can see that it’s the latest version.

What would more likely help you is to have the server logs, “Internal Server Error” often means “check/ask for server logs”.

Are there any examples out there, preferably with curl, from someone who has already played with pleroma ?

I managed to post activites to pleroma. When I query my outbox afterwards, I get a json. unfortunately, you can’t attach files here.

When I run this through my parser, I get:

com.github.jsonldjava.core.JsonLdError: recursive context inclusion: https://www.w3.org/ns/activitystreams

Maybe this works: board.net

Error occurs in Line 194

See also the following id’s in this document

  • #ter02
  • #ter03

I’m not able to post a bug report (yet), because i need a https://git.pleroma.social account.

Conclusion: Playing with activityPub is somehow annoying and anything but fun

^ [ActivityPub C2S] JsonLdError: recursive context inclusion (users outbox) (#2540) · Issues · Pleroma / pleroma · GitLab

Agree with @lanodan that this seem to be a bug in jsonld-java’s recursive context parsing—it maintains a global list of all remote contexts defined in the entire document, and errors whenever a remote context is referenced twice. It looks like this was fixed in this PR: Throw RECURSIVE_CONTEXT_INCLUSION only when cyclic dependency exists by umbreak · Pull Request #303 · jsonld-java/jsonld-java · GitHub, which doesn’t appear to be included in the version you linked. However, for parsing Pleroma’s output, this issue may also be relevant: JSON-LD 1.1 missing scoped context support · Issue #288 · jsonld-java/jsonld-java · GitHub

1 Like

Yesterday i had the same issue by reading a pleromas actor profile. i upgraded to the newest version of jsonld-java and it worked!

no i’m struggling with other “issues”. It seems to be a long way ;-(

And the C2S Issues are a little bit old: Issues · Pleroma / pleroma · GitLab

My next problem: [ActivityPub C2S] json+ld type vs. @type (#2638) · Issues · Pleroma / pleroma · GitLab

A ton of stuff in Pleroma is done directly with Merge Requests, issues are basically created when it’s not practical to create a (WIP) Merge Request and I don’t think we have good labeling.

It means that AP C2S · Search · GitLab is more accurate.