Load room history. After the initial load, you can stream room messages.
Payload Parameters
Argument | Example | Required | Description |
---|---|---|---|
|
| Required | The room ID. |
| null | Required | The newest message timestamp date (or null) to only retrieve messages before this time. |
| 50 | Required | The quantity of results to be returned. |
|
| Required | The date of the last time the client got data for the room. |
Example call
Request of the latest 50 messages:
{
"msg": "method",
"method": "loadHistory",
"id": "42",
"params": [ "64e37db1fedadc25c854843d", { "$date": 1480377205 }, 50, { "$date": 1480377601 } ]
}
Request of the latest 50 messages, using pagination:
{
"msg": "method",
"method": "loadHistory",
"id": "42",
"params": [ "64e37db1fedadc25c854843d", { "$date": 1480377205 }, 50, { "$date": 1480377601 } ]
}
Example response
The response consists of the message
and unreadNotLoaded
. The unreadNotLoaded
counts the number of unread messages not loaded by the call.
{
"msg": "result",
"id": "42",
"result": {
"messages": [
{
"_id": "PbqaTCegrjT2aMY5B",
"rid": "64e37db1fedadc25c854843d",
"msg": "hi",
"ts": {
"$date": 1693045291715
},
"u": {
"_id": "4SebuZCHhQKvTt23o",
"username": "funke.olasupo",
"name": "Funke Olasupo"
},
"_updatedAt": {
"$date": 1693045291977
},
"urls": [],
"mentions": [],
"channels": [],
"md": [
{
"type": "PARAGRAPH",
"value": [
{
"type": "PLAIN_TEXT",
"value": "hi"
}
]
}
]
},
{
"_id": "Sj2genTaum82B4xRh",
"rid": "64e37db1fedadc25c854843d",
"msg": "hi",
"ts": {
"$date": 1692630610658
},
"u": {
"_id": "4SebuZCHhQKvTt23o",
"username": "funke.olasupo",
"name": "Funke Olasupo"
},
"_updatedAt": {
"$date": 1692630610822
},
"urls": [],
"mentions": [],
"channels": [],
"md": [
{
"type": "PARAGRAPH",
"value": [
{
"type": "PLAIN_TEXT",
"value": "hi"
}
]
}
]
}
],
"unreadNotLoaded": 0
}
}