summaryrefslogtreecommitdiffstats
path: root/docs/conversation.md
blob: bcb13ce249828fac42614d1f4160702d9ec7aaf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
# Conversation API

* API v1: 🏁 Removed with API v4: until Nextcloud 21
* API v2: 🏁 Removed with API v4: Nextcloud 19 - 21
* API v3: 🏁 Removed with API v4: Nextcloud 21 only
* API v4: Base endpoint `/ocs/v2.php/apps/spreed/api/v4`: since Nextcloud 22

## Get user´s conversations

!!! note

    Due to the structure of the `lastMessage.reactions` array the response is not valid in XML.
    It is therefor recommended to use `format=json` or send the `Accept: application/json` header,
    to receive a JSON response.

!!! note

    When `modifiedSince` is provided only conversations with a newer `lastActivity` are returned. If `includeStatus` is set to `true` all one-to-one conversations will be returned to make sure the latest user status is returned.
    Due to the nature of the data structure we can not return information that a conversation was deleted
    or the user removed from a conversation. Therefore it is recommended to do a full refresh:
    * Every 5 minutes
    * When a signaling message of type `delete` or `disinvite` was received
    * Internal signaling mode is used


* Method: `GET`
* Endpoint: `/room`
* Data:

| field            | type | Description                                                                                                                                                                     |
|------------------|------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `noStatusUpdate` | int  | When the user status should not be automatically set to online set to 1 (default 0)                                                                                             |
| `includeStatus`  | bool | Whether the user status information of all one-to-one conversations should be loaded (default false)                                                                            |
| `modifiedSince`  | int  | **Use with care as per note above.** When provided only conversations with a newer `lastActivity` (and one-to-one conversations when `includeStatus` is provided) are returned. |

* Response:
    - Status code:
        + `200 OK`
        + `401 Unauthorized` when the user is not logged in

    - Header:

| field                              | type   | Description                                                                                                                                              |
|------------------------------------|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `X-Nextcloud-Talk-Hash`            | string | Sha1 value over some config. When you receive a different value on subsequent requests, the capabilities and the signaling settings should be refreshed. |
| `X-Nextcloud-Talk-Modified-Before` | string | Timestamp from before the database request that can be used as `modifiedSince` parameter in the next request                                             |

    - Data:
        Array of conversations, each conversation has at least:

| field                   | type    | Added | Removed | Description                                                                                                                                                                                                                                                                                                                                                                                       |
|-------------------------|---------|-------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `id`                    | int     | v1    |         | Numeric identifier of the conversation                                                                                                                                                                                                                                                                                                                                                            |
| `token`                 | string  | v1    |         | Token identifier of the conversation which is used for further interaction                                                                                                                                                                                                                                                                                                                        |
| `type`                  | int     | v1    |         | See list of conversation types in the [constants list](constants.md#conversation-types)                                                                                                                                                                                                                                                                                                           |
| `name`                  | string  | v1    |         | Name of the conversation (can also be empty)                                                                                                                                                                                                                                                                                                                                                      |
| `displayName`           | string  | v1    |         | `name` if non empty, otherwise it falls back to a list of participants                                                                                                                                                                                                                                                                                                                            |
| `description`           | string  | v3    |         | Description of the conversation (can also be empty) (only available with `room-description` capability)                                                                                                                                                                                                                                                                                           |
| `participantType`       | int     | v1    |         | Permissions level of the current user                                                                                                                                                                                                                                                                                                                                                             |
| `attendeeId`            | int     | v3    |         | Unique attendee id                                                                                                                                                                                                                                                                                                                                                                                |
| `attendeePin`           | string  | v3    |         | Unique dial-in authentication code for this user, when the conversation has SIP enabled (see `sipEnabled` attribute)                                                                                                                                                                                                                                                                              |
| `actorType`             | string  | v3    |         | Actor type of the current user (see [constants list](constants.md#attendee-types))                                                                                                                                                                                                                                                                                                                |
| `actorId`               | string  | v3    |         | The unique identifier for the given actor type                                                                                                                                                                                                                                                                                                                                                    |
| `permissions`           | int     | v4    |         | Combined final permissions for the current participant, permissions are picked in order of attendee then call then default and the first which is `Custom` will apply (see [constants list](constants.md#attendee-permissions))                                                                                                                                                                   |
| `attendeePermissions`   | int     | v4    |         | Dedicated permissions for the current participant, if not `Custom` this are not the resulting permissions (see [constants list](constants.md#attendee-permissions))                                                                                                                                                                                                                               |
| `callPermissions`       | int     | v4    |         | Call permissions, if not `Custom` this are not the resulting permissions, if set they will reset after the end of the call (see [constants list](constants.md#attendee-permissions))                                                                                                                                                                                                              |
| `defaultPermissions`    | int     | v4    |         | Default permissions for new participants (see [constants list](constants.md#attendee-permissions))                                                                                                                                                                                                                                                                                                |
| `participantInCall`     | bool    | v1    | v2      | **Removed:** use `participantFlags` instead                                                                                                                                                                                                                                                                                                                                                       |
| `participantFlags`      | int     | v1    |         | "In call" flags of the user's session making the request (only available with `in-call-flags` capability)                                                                                                                                                                                                                                                                                         |
| `readOnly`              | int     | v1    |         | Read-only state for the current user (only available with `read-only-rooms` capability)                                                                                                                                                                                                                                                                                                           |
| `listable`              | int     | v3    |         | Listable scope for the room (only available with `listable-rooms` capability)                                                                                                                                                                                                                                                                                                                     |
| `messageExpiration`     | int     | v4    |         | The message expiration time in seconds in this chat. Zero if disabled. (only available with `message-expiration` capability)                                                                                                                                                                                                                                                                      |
| `count`                 | int     | v1    | v2      | **Removed:** Count the users on the [Get list of participants in a conversation](participant.md#get-list-of-participants-in-a-conversation) endpoint                                                                                                                                                                                                                                              |
| `numGuests`             | int     | v1    | v2      | **Removed:** Count the guests on the [Get list of participants in a conversation](participant.md#get-list-of-participants-in-a-conversation) endpoin                                                                                                                                                                                                                                              |
| `lastPing`              | int     | v1    |         | Timestamp of the user's session making the request                                                                                                                                                                                                                                                                                                                                                |
| `sessionId`             | string  | v1    |         | `'0'` if not connected, otherwise an up to 512 character long string that is the identifier of the user's session making the request. Should only be used to pre-check if the user joined already with this session, but this might be outdated by the time of usage, so better check via [Get list of participants in a conversation](participant.md#get-list-of-participants-in-a-conversation) |
| `hasPassword`           | bool    | v1    |         | Flag if the conversation has a password                                                                                                                                                                                                                                                                                                                                                           |
| `hasCall`               | bool    | v1    |         | Flag if the conversation has an active call                                                                                                                                                                                                                                                                                                                                                       |
| `callFlag`              | int     | v3    |         | Combined flag of all participants in the current call (see [constants list](constants.md#participant-in-call-flag), only available with `conversation-call-flags` capability)                                                                                                                                                                                                                     |
| `canStartCall`          | bool    | v1    |         | Flag if the user can start a new call in this conversation (joining is always possible) (only available with `start-call-flag` capability)                                                                                                                                                                                                                                                        |
| `canDeleteConversation` | bool    | v2    |         | Flag if the user can delete the conversation for everyone (not possible without moderator permissions or in one-to-one conversations)                                                                                                                                                                                                                                                             |
| `canLeaveConversation`  | bool    | v2    |         | Flag if the user can leave the conversation (not possible for the last user with moderator permissions)                                                                                                                                                                                                                                                                                           |
| `lastActivity`          | int     | v1    |         | Timestamp of the last activity in the conversation, in seconds and UTC time zone                                                                                                                                                                                                                                                                                                                  |
| `isFavorite`            | bool    | v1    |         | Flag if the conversation is favorited by the user