]> Untitled Git - lemmy.git/blob - docs/src/contributing_apub_api_outline.md
0556e484d386ae011ed2acacc7d8eb95d4e29267
[lemmy.git] / docs / src / contributing_apub_api_outline.md
1 # Activitypub API outline
2
3 This document is targeted at developers who are familiar with the ActivityPub and ActivityStreams protocols. It gives a detailed outline of the actors, objects and activities used by Lemmy.
4
5 Before reading this, have a look at our [Federation Overview](contributing_federation_overview.md) to get an idea how Lemmy federation works on a high level.
6
7 Lemmy does not yet follow the ActivityPub spec in all regards. For example, we don't set a valid context indicating our context fields. We also ignore fields like `inbox`, `outbox` or `endpoints` for remote actors, and assume that everything is Lemmy. For an overview of deviations, read [#698](https://github.com/LemmyNet/lemmy/issues/698). They will be fixed in the near future.
8
9 Lemmy is also really inflexible when it comes to incoming activities and objects. They need to be exactly identical to the examples below. Things like having an array instead of a single value, or an object ID instead of the full object will result in an error.
10
11 In the following tables, "mandatory" refers to whether or not Lemmy will accept an incoming activity without this field. Lemmy itself will always include all non-empty fields.
12
13 <!-- toc -->
14
15 - [Actors](#actors)
16   * [Community](#community)
17   * [User](#user)
18 - [Objects](#objects)
19   * [Post](#post)
20   * [Comment](#comment)
21   * [Private Message](#private-message)
22 - [Activities](#activities)
23   * [Follow](#follow)
24   * [Accept Follow](#accept-follow)
25   * [Unfollow](#unfollow)
26   * [Create or Update Post](#create-or-update-post)
27   * [Create or Update Comment](#create-or-update-comment)
28   * [Like Post or Comment](#like-post-or-comment)
29   * [Dislike Post or Comment](#dislike-post-or-comment)
30   * [Delete Post or Comment](#delete-post-or-comment)
31   * [Remove Post or Comment](#remove-post-or-comment)
32   * [Undo](#undo)
33   * [Announce](#announce)
34   * [Create or Update Private message](#create-or-update-private-message)
35   * [Delete Private Message](#delete-private-message)
36   * [Undo Delete Private Message](#undo-delete-private-message)
37
38 <!-- tocstop -->
39
40 ## Actors
41
42 ### Community
43
44 An automated actor. Users can send posts or comments to it, which the community forwards to its followers in the form of `Announce`.
45
46 Sends activities to user: `Accept/Follow`, `Announce`
47
48 Receives activities from user: `Follow`, `Undo/Follow`, `Create`, `Update`, `Like`, `Dislike`, `Remove` (only admin/mod), `Delete` (only creator), `Undo` (only for own actions)
49
50 ```json
51 {
52     "@context": "https://www.w3.org/ns/activitystreams",
53     "id": "https://enterprise.lemmy.ml/c/main",
54     "type": "Group",
55     "preferredUsername": "main",
56     "name": "The Main Community",
57     "category": { 
58         "identifier": "1",
59         "name": "Discussion"
60     },
61     "sensitive": false,
62     "attributedTo": [
63         "https://enterprise.lemmy.ml/u/picard",
64         "https://enterprise.lemmy.ml/u/riker"
65     ],
66     "content": "Welcome to the default community!",
67     "icon": {
68         "type": "Image",
69         "url": "https://enterprise.lemmy.ml/pictrs/image/Z8pFFb21cl.png"
70     },
71     "image": {
72         "type": "Image",
73         "url": "https://enterprise.lemmy.ml/pictrs/image/Wt8zoMcCmE.jpg"
74     },
75     "inbox": "https://enterprise.lemmy.ml/c/main/inbox",
76     "outbox": "https://enterprise.lemmy.ml/c/main/outbox",
77     "followers": "https://enterprise.lemmy.ml/c/main/followers",
78     "endpoints": {
79         "sharedInbox": "https://enterprise.lemmy.ml/inbox"
80     },
81     "published": "2020-10-06T17:27:43.282386+00:00",
82     "updated": "2020-10-08T11:57:50.545821+00:00",
83     "publicKey": {
84         "id": "https://enterprise.lemmy.ml/c/main#main-key",
85         "owner": "https://enterprise.lemmy.ml/c/main",
86         "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA9JJ7Ybp/H7iXeLkWFepg\ny4PHyIXY1TO9rK3lIBmAjNnkNywyGXMgUiiVhGyN9yU7Km8aWayQsNHOkPL7wMZK\nnY2Q+CTQv49kprEdcDVPGABi6EbCSOcRFVaUjjvRHf9Olod2QP/9OtX0oIFKN2KN\nPIUjeKK5tw4EWB8N1i5HOuOjuTcl2BXSemCQLAlXerLjT8xCarGi21xHPaQvAuns\nHt8ye7fUZKPRT10kwDMapjQ9Tsd+9HeBvNa4SDjJX1ONskNh2j4bqHHs2WUymLpX\n1cgf2jmaXAsz6jD9u0wfrLPelPJog8RSuvOzDPrtwX6uyQOl5NK00RlBZwj7bMDx\nzwIDAQAB\n-----END PUBLIC KEY-----\n"
87     }
88 }
89 ```
90
91 | Field Name | Mandatory | Description |
92 |---|---|---|
93 | `preferredUsername` | yes | Name of the actor |
94 | `name` | yes | Title of the community |
95 | `category` | yes | Hardcoded list of categories, see https://dev.lemmy.ml/api/v1/categories |
96 | `sensitive` | yes | True indicates that all posts in the community are nsfw |
97 | `attributedTo` | yes | First the community creator, then all the remaining moderators |
98 | `content` | no | Text for the community sidebar, usually containing a description and rules |
99 | `icon` | no | Icon, shown next to the community name |
100 | `image` | no | Banner image, shown on top of the community page |
101 | `inbox` | no | ActivityPub inbox URL |
102 | `outbox` | no | ActivityPub outbox URL, only contains up to 20 latest posts, no comments, votes or other activities |
103 | `followers` | no | Follower collection URL, only contains the number of followers, no references to individual followers |
104 | `endpoints` | no | Contains URL of shared inbox |
105 | `published` | no | Datetime when the community was first created |
106 | `updated` | no | Datetime when the community was last changed |
107 | `publicKey` | yes | The public key used to verify signatures from this actor |
108    
109 ### User
110
111 A person, interacts primarily with the community where it sends and receives posts/comments. Can also create and moderate communities, and send private messages to other users.
112
113 Sends activities to Community: `Follow`, `Undo/Follow`, `Create`, `Update`, `Like`, `Dislike`, `Remove` (only admin/mod), `Delete` (only creator), `Undo` (only for own actions)
114
115 Receives activities from Community: `Accept/Follow`, `Announce`
116
117 Sends and receives activities from/to other users: `Create/Note`, `Update/Note`, `Delete/Note`, `Undo/Delete/Note` (all those related to private messages)
118
119 ```json
120 {
121     "@context": "https://www.w3.org/ns/activitystreams",
122     "id": "https://enterprise.lemmy.ml/u/picard",
123     "type": "Person",
124     "preferredUsername": "picard",
125     "name": "Jean-Luc Picard",
126     "summary": "The user bio",
127     "icon": {
128         "type": "Image",
129         "url": "https://enterprise.lemmy.ml/pictrs/image/DS3q0colRA.jpg"
130     },
131     "image": {
132         "type": "Image",
133         "url": "https://enterprise.lemmy.ml/pictrs/image/XenaYI5hTn.png"
134     },
135     "inbox": "https://enterprise.lemmy.ml/u/picard/inbox",
136     "endpoints": {
137         "sharedInbox": "https://enterprise.lemmy.ml/inbox"
138     },
139     "published": "2020-10-06T17:27:43.234391+00:00",
140     "updated": "2020-10-08T11:27:17.905625+00:00",
141     "publicKey": {
142         "id": "https://enterprise.lemmy.ml/u/picard#main-key",
143         "owner": "https://enterprise.lemmy.ml/u/picard",
144         "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyH9iH83+idw/T4QpuRSY\n5YgQ/T5pJCNxvQWb6qcCu3gEVigfbreqZKJpOih4YT36wu4GjPfoIkbWJXcfcEzq\nMEQoYbPStuwnklpN2zj3lRIPfGLht9CAlENLWikTUoW5kZLyU6UQtOGdT2b1hDuK\nsUEn67In6qYx6pal8fUbO6X3O2BKzGeofnXgHCu7QNIuH4RPzkWsLhvwqEJYP0zG\nodao2j+qmhKFsI4oNOUCGkdJejO7q+9gdoNxAtNNKilIOwUFBYXeZJb+XGlzo0X+\n70jdJ/xQCPlPlItU4pD/0FwPLtuReoOpMzLi20oDsPXJBvn+/NJaxqDINuywcN5p\n4wIDAQAB\n-----END PUBLIC KEY-----\n"
145     }
146 }
147 ```
148
149 | Field Name | Mandatory | Description |
150 |---|---|---|
151 | `preferredUsername` | yes | Name of the actor |
152 | `name` | no | The user's displayname |
153 | `summary` | no | User bio |
154 | `icon` | no | The user's avatar, shown next to the username |
155 | `image` | no | The user's banner, shown on top of the profile |
156 | `inbox` | no | ActivityPub inbox URL |
157 | `endpoints` | no | Contains URL of shared inbox |
158 | `published` | no | Datetime when the user signed up |
159 | `updated` | no | Datetime when the user profile was last changed |
160 | `publicKey` | yes | The public key used to verify signatures from this actor |
161
162 ## Objects
163
164 ### Post
165
166 A page with title, and optional URL and text content. The URL often leads to an image, in which case a thumbnail is included. Each post belongs to exactly one community.
167
168 ```json
169 {
170     "@context": "https://www.w3.org/ns/activitystreams",
171     "id": "https://voyager.lemmy.ml/post/29",
172     "type": "Page",
173     "attributedTo": "https://voyager.lemmy.ml/u/picard",
174     "to": "https://voyager.lemmy.ml/c/main",
175     "summary": "Test thumbnail 2",
176     "content": "blub blub",
177     "url": "https://voyager.lemmy.ml:/pictrs/image/fzGwCsq7BJ.jpg",
178     "image": {
179         "type": "Image",
180         "url": "https://voyager.lemmy.ml/pictrs/image/UejwBqrJM2.jpg"
181     },
182     "commentsEnabled": true,
183     "sensitive": false,
184     "stickied": false,
185     "published": "2020-09-24T17:42:50.396237+00:00",
186     "updated": "2020-09-24T18:31:14.158618+00:00"
187 }
188 ```
189
190 | Field Name | Mandatory | Description |
191 |---|---|---|
192 | `attributedTo` | yes | ID of the user which created this post |
193 | `to` | yes | ID of the community where it was posted to |
194 | `summary` | yes | Title of the post |
195 | `content` | no | Body of the post |
196 | `url` | no | An arbitrary link to be shared |
197 | `image` | no | Thumbnail for `url`, only present if it is an image link |
198 | `commentsEnabled` | yes | False indicates that the post is locked, and no comments can be added |
199 | `sensitive` | yes | True marks the post as NSFW, blurs the thumbnail and hides it from users with NSFW settign disabled |
200 | `stickied` | yes | True means that it is shown on top of the community |
201 | `published` | no | Datetime when the post was created |
202 | `updated` | no | Datetime when the post was edited (not present if it was never edited) |
203
204 ### Comment
205
206 A reply to a post, or reply to another comment. Contains only text (including references to other users or communities). Lemmy displays comments in a tree structure.
207
208 ```json
209 {
210     "@context": "https://www.w3.org/ns/activitystreams",
211     "id": "https://enterprise.lemmy.ml/comment/95",
212     "type": "Note",
213     "attributedTo": "https://enterprise.lemmy.ml/u/picard",
214     "to": "https://enterprise.lemmy.ml/c/main",
215     "content": "mmmk",
216     "inReplyTo": [
217         "https://enterprise.lemmy.ml/post/38",
218         "https://voyager.lemmy.ml/comment/73"
219     ],
220     "published": "2020-10-06T17:53:22.174836+00:00",
221     "updated": "2020-10-06T17:53:22.174836+00:00"
222 }
223 ```
224
225 | Field Name | Mandatory | Description |
226 |---|---|---|
227 | `attributedTo` | yes | ID of the user who created the comment |
228 | `to` | yes | Community where the comment was made |
229 | `content` | yes | The comment text |
230 | `inReplyTo` | yes | IDs of the post where this comment was made, and the parent comment. If this is a top-level comment, `inReplyTo` only contains the post |
231 | `published` | no | Datetime when the comment was created |
232 | `updated` | no | Datetime when the comment was edited (not present if it was never edited) |
233
234 ### Private Message
235
236 A direct message from one user to another. Can not include additional users. Threading is not implemented yet, so the `inReplyTo` field is missing.
237
238 ```json
239 {
240     "@context": "https://www.w3.org/ns/activitystreams",
241     "id": "https://enterprise.lemmy.ml/private_message/34",
242     "type": "Note",
243     "attributedTo": "https://enterprise.lemmy.ml/u/picard",
244     "to": "https://voyager.lemmy.ml/u/janeway",
245     "content": "test",
246     "published": "2020-10-08T19:10:46.542820+00:00",
247     "updated": "2020-10-08T20:13:52.547156+00:00"
248 }
249 ```
250
251 | Field Name | Mandatory | Description |
252 |---|---|---|
253 | `attributedTo` | ID of the user who created this private message |
254 | `to` | ID of the recipient |
255 | `content` | yes | The text of the private message |
256 | `published` | no | Datetime when the message was created |
257 | `updated` | no | Datetime when the message was edited (not present if it was never edited) |
258
259 ## Activities
260
261 ### Follow
262
263 When the user clicks "Subscribe" in a community, a `Follow` is sent. The community automatically responds with an `Accept/Follow`.
264
265 Sent by: User
266
267 Sent to: Community
268
269 ```json
270 {
271     "@context": "https://www.w3.org/ns/activitystreams",
272     "id": "https://enterprise.lemmy.ml/activities/follow/2e4784b7-4edf-4fa1-a352-674d5d5f8891",
273     "type": "Follow",
274     "actor": "https://enterprise.lemmy.ml/u/picard",
275     "to": "https://ds9.lemmy.ml/c/main",
276     "object": "https://ds9.lemmy.ml/c/main"
277 }
278 ```
279
280 | Field Name | Mandatory | Description |
281 |---|---|---|
282 | `actor` | yes | The user that is sending the follow request |
283 | `object` | yes | The community to be followed |
284
285 ### Accept Follow
286
287 Automatically sent by the community in response to a `Follow`. At the same time, the community adds this user to its followers list.
288
289 Sent by: Community
290
291 Sent to: User
292
293 ```json
294 {
295     "@context": "https://www.w3.org/ns/activitystreams",
296     "id": "https://ds9.lemmy.ml/activities/accept/5314bf7c-dab8-4b01-baf2-9be11a6a812e",
297     "type": "Accept",
298     "actor": "https://ds9.lemmy.ml/c/main",
299     "to": "https://enterprise.lemmy.ml/u/picard",
300     "object": {
301         "@context": "https://www.w3.org/ns/activitystreams",
302         "id": "https://enterprise.lemmy.ml/activities/follow/2e4784b7-4edf-4fa1-a352-674d5d5f8891",
303         "type": "Follow",
304         "object": "https://ds9.lemmy.ml/c/main",
305         "actor": "https://enterprise.lemmy.ml/u/picard"
306     }
307 }
308 ```
309
310 | Field Name | Mandatory | Description |
311 |---|---|---|
312 | `actor` | yes | The same community as in the `Follow` activity |
313 | `to` | no | ID of the user which sent the `Follow` |
314 | `object` | yes | The previously sent `Follow` activity |
315
316 ### Unfollow
317
318 Clicking on the unsubscribe button in a community causes an `Undo/Follow` to be sent. The community removes the user from its follower list after receiving it.
319
320 Sent by: User
321
322 Sent to: Community
323
324 ```json
325 {
326     "@context": "https://www.w3.org/ns/activitystreams",
327     "id": "http://lemmy-alpha:8541/activities/undo/2c624a77-a003-4ed7-91cb-d502eb01b8e8",
328     "type": "Undo",
329     "actor": "http://lemmy-alpha:8541/u/lemmy_alpha",
330     "to": "http://lemmy-beta:8551/c/main",
331     "object": {
332         "@context": "https://www.w3.org/ns/activitystreams",
333         "id": "http://lemmy-alpha:8541/activities/follow/f0d732e7-b1e7-4857-a5e0-9dc83c3f7ee8",
334         "type": "Follow",
335         "actor": "http://lemmy-alpha:8541/u/lemmy_alpha",
336         "object": "http://lemmy-beta:8551/c/main"
337     }
338 }
339 ```
340 ### Create or Update Post
341
342 When a user creates a new post, it is sent to the respective community. Editing a previously created post sends an almost identical activity, except the `type` being `Update`. We don't support mentions in posts yet.
343
344 Sent by: User
345
346 Sent to: Community
347
348 ```json
349 {
350     "@context": "https://www.w3.org/ns/activitystreams",
351     "id": "https://enterprise.lemmy.ml/activities/create/6e11174f-501a-4531-ac03-818739bfd07d",
352     "type": "Create",
353     "actor": "https://enterprise.lemmy.ml/u/riker",
354     "to": "https://www.w3.org/ns/activitystreams#Public",
355     "cc": [
356       "https://ds9.lemmy.ml/c/main/"
357     ],
358     "object": ...
359 }
360 ```
361
362 | Field Name | Mandatory | Description |
363 |---|---|---|
364 | `type` | yes | either `Create` or `Update` |
365 | `cc` | yes | Community where the post is being made |
366 | `object` | yes | The post being created |
367
368 ### Create or Update Comment
369
370 A reply to a post, or to another comment. Can contain mentions of other users. Editing a previously created post sends an almost identical activity, except the `type` being `Update`.
371
372 Sent by: User
373
374 Sent to: Community
375
376 ```json
377 {
378     "@context": "https://www.w3.org/ns/activitystreams",
379     "id": "https://enterprise.lemmy.ml/activities/create/6f52d685-489d-4989-a988-4faedaed1a70",
380     "type": "Create",
381     "actor": "https://enterprise.lemmy.ml/u/riker",
382     "to": "https://www.w3.org/ns/activitystreams#Public",
383     "tag": [{
384         "type": "Mention",
385         "name": "@sisko@ds9.lemmy.ml",
386         "href": "https://ds9.lemmy.ml/u/sisko"
387     }],
388     "cc": [
389         "https://ds9.lemmy.ml/c/main/",
390         "https://ds9.lemmy.ml/u/sisko"
391     ],
392     "object": ...
393 }
394 ```
395
396 | Field Name | Mandatory | Description |
397 |---|---|---|
398 | `tag` | no | List of users which are mentioned in the comment (like `@user@example.com`) |
399 | `cc` | yes | Community where the post is being made, the user being replied to (creator of the parent post/comment), as well as any mentioned users |
400 | `object` | yes | The comment being created |
401
402 ### Like Post or Comment
403
404 An upvote for a post or comment.
405
406 Sent by: User
407
408 Sent to: Community
409
410 ```json
411 {
412     "@context": "https://www.w3.org/ns/activitystreams",
413     "id": "https://enterprise.lemmy.ml/activities/like/8f3f48dd-587d-4624-af3d-59605b7abad3",
414     "type": "Like",
415     "actor": "https://enterprise.lemmy.ml/u/riker",
416     "to": "https://www.w3.org/ns/activitystreams#Public",
417     "cc": [
418         "https://ds9.lemmy.ml/c/main/"
419     ],
420     "object": ...
421 }
422 ```
423
424 | Field Name | Mandatory | Description |
425 |---|---|---|
426 | `cc` | yes | ID of the community where the post/comment is |
427 | `object` | yes | The post or comment being upvoted |
428
429 ### Dislike Post or Comment
430
431 A downvote for a post or comment.
432
433 Sent by: User
434
435 Sent to: Community
436
437 ```json
438 {
439     "@context": "https://www.w3.org/ns/activitystreams",
440     "id": "https://enterprise.lemmy.ml/activities/dislike/fd2b8e1d-719d-4269-bf6b-2cadeebba849",
441     "type": "Dislike",
442     "actor": "https://enterprise.lemmy.ml/u/riker",
443     "to": "https://www.w3.org/ns/activitystreams#Public",
444     "cc": [
445       "https://ds9.lemmy.ml/c/main/"
446     ],
447     "object": ...
448 }
449 ```
450
451 | Field Name | Mandatory | Description |
452 |---|---|---|
453 | `cc` | yes | ID of the community where the post/comment is |
454 | `object` | yes | The post or comment being upvoted |
455
456 ### Delete Post or Comment
457
458 Deletes a previously created post or comment. This can only be done by the original creator of that post/comment.
459
460 Sent by: User
461
462 Sent to: Community
463
464 ```json
465 {
466     "@context": "https://www.w3.org/ns/activitystreams",
467     "id": "https://enterprise.lemmy.ml/activities/delete/f1b5d57c-80f8-4e03-a615-688d552e946c",
468     "type": "Delete",
469     "actor": "https://enterprise.lemmy.ml/u/riker",
470     "to": "https://www.w3.org/ns/activitystreams#Public",
471     "cc": [
472         "https://enterprise.lemmy.ml/c/main/"
473     ],
474     "object": "https://enterprise.lemmy.ml/post/32"
475 }
476 ```
477
478 | Field Name | Mandatory | Description |
479 |---|---|---|
480 | `cc` | yes | ID of the community where the post/comment is |
481 | `object` | yes | ID of the post or comment being deleted |
482
483 ### Remove Post or Comment
484
485 Removes a post or comment. This can only be done by a community mod, or by an admin on the instance where the community is hosted.
486
487 Sent by: User
488
489 Sent to: Community
490
491 ```json
492 {
493     "@context": "https://www.w3.org/ns/activitystreams",
494     "id": "https://ds9.lemmy.ml/activities/remove/aab93b8e-3688-4ea3-8212-d00d29519218",
495     "type": "Remove",
496     "actor": "https://ds9.lemmy.ml/u/sisko",
497     "to": "https://www.w3.org/ns/activitystreams#Public",
498     "cc": [
499         "https://ds9.lemmy.ml/c/main/"
500     ],
501     "object": "https://enterprise.lemmy.ml/comment/32"
502 }
503 ```
504
505 | Field Name | Mandatory | Description |
506 |---|---|---|
507 | `cc` | yes | ID of the community where the post/comment is |
508 | `object` | yes | ID of the post or comment being removed |
509
510 ### Undo
511
512 Reverts a previous activity, can only be done by the `actor` of `object`. In case of a `Like` or `Dislike`, the vote count is changed back. In case of a `Delete` or `Remove`, the post/comment is restored. The `object` is regenerated from scratch, as such the activity ID and other fields are different.
513
514 Sent by: User
515
516 Sent to: Community
517
518 ```json
519 {
520   "@context": "https://www.w3.org/ns/activitystreams",
521   "id": "https://ds9.lemmy.ml/activities/undo/70ca5fb2-e280-4fd0-a593-334b7f8a5916",
522   "type": "Undo",
523   "actor": "https://ds9.lemmy.ml/u/sisko",
524   "to": "https://www.w3.org/ns/activitystreams#Public",
525   "cc": [
526     "https://ds9.lemmy.ml/c/main/"
527   ],
528   "object": ...
529 }
530 ```
531
532 | Field Name | Mandatory | Description |
533 |---|---|---|
534 | `object` | yes | Any `Like`, `Dislike`, `Delete` or `Remove` activity as described above |
535
536 ### Announce
537
538 When the community receives a post or comment activity, it wraps that into an `Announce` and sends it to all followers.
539
540 Sent by: Community
541
542 Sent to: User
543
544 ```json
545 {
546   "@context": "https://www.w3.org/ns/activitystreams",
547   "id": "https://ds9.lemmy.ml/activities/announce/b98382e8-6cb1-469e-aa1f-65c5d2c31cc4",
548   "type": "Announce",
549   "actor": "https://ds9.lemmy.ml/c/main",
550   "to": "https://www.w3.org/ns/activitystreams#Public",
551   "cc": [
552     "https://ds9.lemmy.ml/c/main/followers"
553   ],
554   "object": ...
555 }
556 ```
557
558 | Field Name | Mandatory | Description |
559 |---|---|---|
560 | `object` | yes | Any `Create`, `Update`, `Like`, `Dislike`, `Delete` `Remove` or `Undo` activity as described above |
561
562 ### Create or Update Private message 
563
564 Creates a new private message between two users.
565
566 Sent by: User
567
568 Sent to: User
569
570 ```json
571 {
572     "@context": "https://www.w3.org/ns/activitystreams",
573     "id": "https://ds9.lemmy.ml/activities/create/202daf0a-1489-45df-8d2e-c8a3173fed36",
574     "type": "Create",
575     "actor": "https://ds9.lemmy.ml/u/sisko",
576     "to": "https://enterprise.lemmy.ml/u/riker/inbox",
577     "object": ...
578 }
579 ```
580
581 | Field Name | Mandatory | Description |
582 |---|---|---|
583 | `type` | yes | Either `Create` or `Update` |
584
585 ### Delete Private Message
586
587 Deletes a previous private message.
588
589 Sent by: User
590
591 Sent to: User
592
593 ```json
594 {
595     "@context": "https://www.w3.org/ns/activitystreams",
596     "id": "https://ds9.lemmy.ml/activities/delete/2de5a5f3-bf26-4949-a7f5-bf52edfca909",
597     "type": "Delete",
598     "actor": "https://ds9.lemmy.ml/u/sisko",
599     "to": "https://enterprise.lemmy.ml/u/riker/inbox",
600     "object": "https://ds9.lemmy.ml/private_message/341"
601 }
602 ```
603
604 ### Undo Delete Private Message
605
606 Restores a previously deleted private message. The `object` is regenerated from scratch, as such the activity ID and other fields are different.
607
608 Sent by: User
609
610 Sent to: User
611
612 ```json
613 {
614     "@context": "https://www.w3.org/ns/activitystreams",
615     "id": "https://ds9.lemmy.ml/activities/undo/b24bc56d-5db1-41dd-be06-3f1db8757842",
616     "type": "Undo",
617     "actor": "https://ds9.lemmy.ml/u/sisko",
618     "to": "https://enterprise.lemmy.ml/u/riker/inbox",
619     "object": ...
620 }
621 ```