linkeddata / dokieli

:bulb: dokieli is a clientside editor for decentralised article publishing, annotations and social interactions
https://dokie.li/
Other
788 stars 81 forks source link

Render LDN notifications of type as:Create, to show off related social activities delivered via ActivityPub et al #166

Open gobengo opened 7 years ago

gobengo commented 7 years ago

From IRC

[19:28:29] Would you mind creating https://github.com/linkeddata/dokieli/issues/ mentioning 1) what the notification would contain 2) what data to expect inside the external resources

I built a tool that's useful to publish little notes and, according to ActivityPub and therefore LDN, notify other resources the note may mention (e.g. the note may be a reply to a dokieli document).

You can try it out by going to http://distbin.com/ , posting whatever as the main message, and making sure to use something like 'https://linkedresearch.org/ldn/tests/' as the value for the inReplyTo (last) text input.

Right now, notifications are successfully received the the inboxes, but dokieli does not render them in the UI. It would be great if it did.

I belive this is because dokieli currently only tries to render as:Announces, as:Likes, and a few others. However, I am sening as:Creates, because that's what ActivityPub says to do when a new thing is Created.

Here is an example of a notification I created. https://linkedresearch.org/ldn/tests/inbox/164083d0-cf57-11e6-9565-3de12904d1c5

The exact request body in my notification request would be almost exactly like this, but some property values made absolute URLs instead of relative (e.g. 'replies', 'url') http://distbin.com/activities/5892c77b-c9cc-4525-beab-fb91478b1749.json

ActivityPub also encourages implementations to send notifications of the form as:Like, as:Undo, as:Add, as:Remove, as:Update, as:Delete, as:Follow. However, distbin does not currently send them so I don't have much experience with them. I do plan on add as:Likes at some point, but I think dokieli handles these.

2) what data to expect inside the external resources

I'm not sure exactly what you mean by this

btw @rhiaro told me she also intends to have rhiaro/sloph send these types of notifications before too long.

csarven commented 7 years ago

re: "external resources", what I meant is that if the notification is referring to resources at a different domain (than the one the notification is at) then knowing the content of those resources help with a number of things eg extra information that can be put to use for enrichment or verification.. The example at distbin/activities is fine, that's what I was asking for.

csarven commented 7 years ago

I'm copying the example notification here because ldn/tests/inbox/ is not meant to be persistent. I'll flush that stuff from time to time.

{
 "@context":"https://www.w3.org/ns/activitystreams",
 "type":"Create",
 "object":{
   "@context":"https://www.w3.org/ns/activitystreams",
   "type":"Note",
   "content":"Hey dude, let's federate",
   "cc":[
     "https://www.w3.org/ns/activitystreams#Public",
     "https://linkedresearch.org/ldn/tests/"
   ],
   "inReplyTo":"https://linkedresearch.org/ldn/tests/"
 },
 "cc":[
   "https://www.w3.org/ns/activitystreams#Public",
   "https://linkedresearch.org/ldn/tests/"
 ],
  "id":"urn:uuid:5892c77b-c9cc-4525-beab-fb91478b1749",
  "published":"2016-12-31T12:46:01.523Z",
  "inbox":"http://distbin.com/activitypub/inbox",
  "url":"http://distbin.com/activities/5892c77b-c9cc-4525-beab-fb91478b1749",
  "uuid":"5892c77b-c9cc-4525-beab-fb91478b1749",
  "replies":"http://distbin.com/activities/5892c77b-c9cc-4525-beab-fb91478b1749/replies"
}

Minor note that uuid is not part of AS2. The external url to distbin.com/activity contains:

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Create",
  "object": {
    "@context": "https://www.w3.org/ns/activitystreams",
    "type": "Note",
    "content": "Hey dude, let's federate",
    "cc": [
      "https://www.w3.org/ns/activitystreams#Public",
      "https://linkedresearch.org/ldn/tests/"
    ],
    "inReplyTo": "https://linkedresearch.org/ldn/tests/"
  },
  "cc": [
    "https://www.w3.org/ns/activitystreams#Public",
    "https://linkedresearch.org/ldn/tests/"
  ],
  "id": "urn:uuid:5892c77b-c9cc-4525-beab-fb91478b1749",
  "published": "2016-12-31T12:46:01.523Z",
  "inbox": "/activitypub/inbox",
  "url": "/activities/5892c77b-c9cc-4525-beab-fb91478b1749",
  "uuid": "5892c77b-c9cc-4525-beab-fb91478b1749",
  "replies": "/activities/5892c77b-c9cc-4525-beab-fb91478b1749/replies"
}