List the messages in a room along with any data updates from a specified date.
Changelog
Version | Description |
---|---|
1.0.0 | Added |
The authToken
of the authenticated user.
The userId
of the authenticated user.
The room ID.
Number of items to "skip" in the query, i.e. requests return count items, skipping the first offset items. Refer to the official documentation to learn more.
List of fields to order by, and in which direction. This is a JSON object, with properties listed in desired order, with values of 1 for ascending, or -1 for descending. For example, { "value": -1, "_id": 1 }
. Refer to the official documentation to learn more.
The date as an ISO string. You cannot use this parameter if you are using the next
or previous
parameter.
This indicates whether the query should retrieve items from a later point in time. The value must be the number of milliseconds, as it follows Date getTime(). Note that you can use either next
or previous
at the same time.
This indicates whether the query should retrieve items from an earlier point in time. The value must be the number of milliseconds, as it follows Date getTime().
You must specify whether you want to retrieve DELETED
(for deleted messages) or UPDATED
(for updated messages, which is the default use case). This parameter is required if you are using the next
or previous
parameter.
Note: offset
, sort
, and count
are optional parameters. By default, the endpoint returns 20 items if you don't specify a value for count
. According to the remaining query parameters you use, this endpoint returns the messages in two ways:
- With the
lastUpdate
parameter: If you use thelastUpdate
parameter, the endpoint returns the messages updated since the specified date. - With the cursor based pagination: For this approach, you must enter either the
next
or theprevious
parameter, andtype
is a mandatory field. In this case, thelastUpdate
parameter cannot be used.
OK
{
"result": {
"updated": [
{
"_id": "ak3WdaLbf4P7ZW3wQ",
"rid": "5qW6ssMFyzWjJev69",
"u": {
"_id": "FWfHnJmcudrCagGDX",
"username": "555192857993",
"name": "555192857993"
},
"msg": "teste",
"ts": "2021-09-24T19:19:47.911Z",
"_updatedAt": "2021-09-24T19:19:48.048Z",
"alias": "mauricio pretto",
"token": "do554ryecscmfrrxyxpvm",
"unread": true,
"urls": [],
"mentions": [],
"channels": [],
"md": [
{
"type": "PARAGRAPH",
"value": [
{
"type": "PLAIN_TEXT",
"value": "teste"
}
]
}
]
},
{
"_id": "2ttrNPABcCKbsbEtB",
"t": "livechat-started",
"msg": "",
"groupable": false,
"ts": "2021-09-24T19:19:46.523Z",
"u": {
"_id": "FWfHnJmcudrCagGDX",
"username": "555192857993",
"name": "555192857993"
},
"rid": "5qW6ssMFyzWjJev69",
"unread": true,
"_updatedAt": "2021-09-24T19:19:46.691Z",
"urls": [],
"mentions": [],
"channels": []
}
],
"deleted": []
},
"success": true
}
Bad Request
{
"success": false,
"error": "The required \"roomId\" query param is missing. [error-roomId-param-not-provided]",
"errorType": "error-roomId-param-not-provided"
}
{
"success": false,
"error": "The required \"lastUpdate\" query param is missing. [error-lastUpdate-param-not-provided]",
"errorType": "error-lastUpdate-param-not-provided"
}
{
"success": false,
"error": "The \"lastUpdate\" query parameter must be a valid date. [error-roomId-param-invalid]",
"errorType": "error-roomId-param-invalid"
}
Unauthorized
{
"status": "error",
"message": "You must be logged in to do this."
}