Skip to API content
TalkLabs API Docs v3
Recipes
GET Chat

List Previous Events

This method allows you to go back in time to "scroll" in reverse through past messages.

GET /api/v3/{appid}/chat/rooms/{roomid}/listpreviousevents
  • This method allows you to go back in time to "scroll" in reverse through past messages. The typical use case for this method is to power the scroll-back feature of a chat window allowing the user to look at recent messages that have scrolled out of view. It's intended use is to retrieve small batches of historical events as the user is scrolling up.
  • This method returns a list of events sorted from newest to oldest.
  • This method excludes events that are not in the active state (for example if they are removed by a moderator)
  • This method excludes non-displayable events (reaction, replace, remove, purge)
  • This method will not return events that were emitted and then deleted before this method was called

URL PARAMETERS

  • limit : (Optional) Defaults to 100, maximum 500.
  • cursor: (Optional) If not provided, the most recent events will be returned. To get older events, call this method again using the cursor string returned from the previous call.
Request

Parameters

Values in the path and query string.

appid path
string TalkLabs ID required

The TalkLabs application ID assigned to your account.

Example: your-app-id
roomid path
string TalkLabs ID required

The TalkLabs assigned room ID returned when the room was created.

Example: room-id
limit query
integer · int32

The maximum number of records to return.

Example: 100
cursor query
string

The cursor returned by the previous page.

Response

Status codes

Every JSON response uses the API result envelope.

200 OK ApiResult
400 Bad Request ApiResult
403 Forbidden ApiResult
404 Not Found ApiResult
500 Internal Server Error ApiResult
Example response · 200
{
  "message": "",
  "errors": {},
  "data": {
    "kind": "list.chatevents",
    "cursor": "637275092820138536",
    "more": false,
    "itemcount": 4,
    "events": [
      {
        "kind": "chat.event",
        "id": "5ee2a8225617e01b9cae081c",
        "roomid": "5ee2a81f5617e01b9cae0816",
        "body": "Mind if I quote you?",
        "originalbody": "",
        "added": "2020-06-11T21:54:42.9770073Z",
        "modified": "2020-06-11T21:54:42.9770073Z",
        "ts": 637275092829770100,
        "eventtype": "quote",
        "userid": "userid_abe",
        "user": {
          "kind": "app.user",
          "userid": "userid_abe",
          "handle": "HonestAbe",
          "handlelowercase": "honestabe",
          "displayname": "Abraham Lincoln",
          "pictureurl": "https://www.biography.com/.image/ar_1:1%2Cc_fill%2Ccs_srgb%2Cg_face%2Cq_auto:good%2Cw_300/MTU5MDUzMTE0Mzk2MTI0OTUy/abraham-lincoln-1809---18652c-sixteenth-president-of-the-united-states-of-america-photo-by-stock-montagestock-montagegetty-images_promo.jpg",
          "profileurl": "https://www.biography.com/us-president/abraham-lincoln",
          "banned": false
        },
        "customtype": "",
        "customid": "",
        "custompayload": "",
        "customtags": [],
        "customfield1": "",
        "customfield2": "",
        "replyto": {
          "kind": "chat.event",
          "id": "5ee2a8225617e01b9cae0819",
          "roomid": "5ee2a81f5617e01b9cae0816",
          "body": "No, you're misunderstaning me, Prince Valiant. I'm saying if you were a sheep, would you **** a sheep, if you were another sheep? We can't tolerate that in Scunthorpe.",
          "originalbody": "No, you're misunderstaning me, Prince Valiant. I'm saying if you were a sheep, would you fuck a sheep, if you were another sheep? We can't tolerate that in Scunthorpe.",
          "added": "2020-06-11T21:54:42.239921Z",
          "modified": "2020-06-11T21:54:42.239921Z",
          "ts": 637275092822399200,
          "eventtype": "speech",
          "userid": "userid_abe",
          "user": {
            "kind": "app.user",
            "userid": "userid_abe",
            "handle": "HonestAbe",
            "handlelowercase": "honestabe",
            "displayname": "Abraham Lincoln",
            "pictureurl": "https://www.biography.com/.image/ar_1:1%2Cc_fill%2Ccs_srgb%2Cg_face%2Cq_auto:good%2Cw_300/MTU5MDUzMTE0Mzk2MTI0OTUy/abraham-lincoln-1809---18652c-sixteenth-president-of-the-united-states-of-america-photo-by-stock-montagestock-montagegetty-images_promo.jpg",
            "profileurl": "https://www.biography.com/us-president/abraham-lincoln",
            "banned": false
          },
          "customtype": "",
          "customid": null,
          "custompayload": "",
          "customtags": [],
          "customfield1": "",
          "customfield2": "",
          "replyto": null,
          "parentid": "",
          "hierarchy": [],
          "depth": 0,
          "edited": false,
          "editedbymoderator": true,
          "censored": true,
          "deleted": false,
          "active": true,
          "mutedby": [],
          "shadowban": false,
          "hashtags": [],
          "likecount": 0,
          "replycount": 1,
          "reactions": [],
          "moderation": "na",
          "reports": []
        },
        "parentid": "5ee2a8225617e01b9cae0819",
        "hierarchy": [],
        "depth": 0,
        "edited": false,
        "editedbymoderator": false,
        "censored": false,
        "deleted": false,
        "active": true,
        "mutedby": [],
        "shadowban": false,
        "hashtags": [],
        "likecount": 0,
        "replycount": 0,
        "reactions": [],
        "moderation": "na",
        "reports": []
      },
      {
        "kind": "chat.event",
        "id": "5ee2a8225617e01b9cae081b",
        "roomid": "5ee2a81f5617e01b9cae0816",
        "body": "I spy with my little eye an opportunity to post a reply!",
        "originalbody": "",
        "added": "2020-06-11T21:54:42.7482416Z",
        "modified": "2020-06-11T21:54:42.7482416Z",
        "ts": 637275092827482400,
        "eventtype": "reply",
        "userid": "userid_abe",
        "user": {
          "kind": "app.user",
          "userid": "userid_abe",
          "handle": "HonestAbe",
          "handlelowercase": "honestabe",
          "displayname": "Abraham Lincoln",
          "pictureurl": "https://www.biography.com/.image/ar_1:1%2Cc_fill%2Ccs_srgb%2Cg_face%2Cq_auto:good%2Cw_300/MTU5MDUzMTE0Mzk2MTI0OTUy/abraham-lincoln-1809---18652c-sixteenth-president-of-the-united-states-of-america-photo-by-stock-montagestock-montagegetty-images_promo.jpg",
          "profileurl": "https://www.biography.com/us-president/abraham-lincoln",
          "banned": false
        },
        "customtype": "",
        "customid": "",
        "custompayload": "",
        "customtags": [],
        "customfield1": "",
        "customfield2": "",
        "replyto": {
          "kind": "chat.event",
          "id": "5ee2a8225617e01b9cae0819",
          "roomid": "5ee2a81f5617e01b9cae0816",
          "body": "No, you're misunderstaning me, Prince Valiant. I'm saying if you were a sheep, would you **** a sheep, if you were another sheep? We can't tolerate that in Scunthorpe.",
          "originalbody": "No, you're misunderstaning me, Prince Valiant. I'm saying if you were a sheep, would you fuck a sheep, if you were another sheep? We can't tolerate that in Scunthorpe.",
          "added": "2020-06-11T21:54:42.239921Z",
          "modified": "2020-06-11T21:54:42.239921Z",
          "ts": 637275092822399200,
          "eventtype": "speech",
          "userid": "userid_abe",
          "user": {
            "kind": "app.user",
            "userid": "userid_abe",
            "handle": "HonestAbe",
            "handlelowercase": "honestabe",
            "displayname": "Abraham Lincoln",
            "pictureurl": "https://www.biography.com/.image/ar_1:1%2Cc_fill%2Ccs_srgb%2Cg_face%2Cq_auto:good%2Cw_300/MTU5MDUzMTE0Mzk2MTI0OTUy/abraham-lincoln-1809---18652c-sixteenth-president-of-the-united-states-of-america-photo-by-stock-montagestock-montagegetty-images_promo.jpg",
            "profileurl": "https://www.biography.com/us-president/abraham-lincoln",
            "banned": false
          },
          "customtype": "",
          "customid": null,
          "custompayload": "",
          "customtags": [],
          "customfield1": "",
          "customfield2": "",
          "replyto": null,
          "parentid": "",
          "hierarchy": [],
          "depth": 0,
          "edited": false,
          "editedbymoderator": true,
          "censored": true,
          "deleted": false,
          "active": true,
          "mutedby": [],
          "shadowban": false,
          "hashtags": [],
          "likecount": 0,
          "replycount": 0,
          "reactions": [],
          "moderation": "na",
          "reports": []
        },
        "parentid": "5ee2a8225617e01b9cae0819",
        "hierarchy": [
          "5ee2a8225617e01b9cae0819"
        ],
        "depth": 1,
        "edited": false,
        "editedbymoderator": false,
        "censored": false,
        "deleted": false,
        "active": true,
        "mutedby": [],
        "shadowban": false,
        "hashtags": [],
        "likecount": 0,
        "replycount": 0,
        "reactions": [],
        "moderation": "na",
        "reports": []
      },
      {
        "kind": "chat.event",
        "id": "5ee2a8225617e01b9cae081a",
        "roomid": "5ee2a81f5617e01b9cae0816",
        "body": "Abraham Lincoln gave Dave M. a high 5!",
        "originalbody": "",
        "added": "2020-06-11T21:54:42.5294899Z",
        "modified": "2020-06-11T21:54:42.5294899Z",
        "ts": 637275092825294800,
        "eventtype": "action",
        "userid": "userid_abe",
        "user": {
          "kind": "app.user",
          "userid": "userid_abe",
          "handle": "HonestAbe",
          "handlelowercase": "honestabe",
          "displayname": "Abraham Lincoln",
          "pictureurl": "https://www.biography.com/.image/ar_1:1%2Cc_fill%2Ccs_srgb%2Cg_face%2Cq_auto:good%2Cw_300/MTU5MDUzMTE0Mzk2MTI0OTUy/abraham-lincoln-1809---18652c-sixteenth-president-of-the-united-states-of-america-photo-by-stock-montagestock-montagegetty-images_promo.jpg",
          "profileurl": "https://www.biography.com/us-president/abraham-lincoln",
          "banned": false
        },
        "customtype": "",
        "customid": "",
        "custompayload": "",
        "customtags": [],
        "customfield1": "",
        "customfield2": "",
        "replyto": null,
        "parentid": "",
        "hierarchy": [],
        "depth": 0,
        "edited": false,
        "editedbymoderator": false,
        "censored": false,
        "deleted": false,
        "active": true,
        "mutedby": [],
        "shadowban": false,
        "hashtags": [],
        "likecount": 0,
        "replycount": 0,
        "reactions": [],
        "moderation": "na",
        "reports": []
      },
      {
        "kind": "chat.event",
        "id": "5ee2a8225617e01b9cae0818",
        "roomid": "5ee2a81f5617e01b9cae0816",
        "body": "Hello, Dev World!",
        "originalbody": "",
        "added": "2020-06-11T21:54:42.0138536Z",
        "modified": "2020-06-11T21:54:42.0138536Z",
        "ts": 637275092820138500,
        "eventtype": "speech",
        "userid": "userid_abe",
        "user": {
          "kind": "app.user",
          "userid": "userid_abe",
          "handle": "HonestAbe",
          "handlelowercase": "honestabe",
          "displayname": "Abraham Lincoln",
          "pictureurl": "https://www.biography.com/.image/ar_1:1%2Cc_fill%2Ccs_srgb%2Cg_face%2Cq_auto:good%2Cw_300/MTU5MDUzMTE0Mzk2MTI0OTUy/abraham-lincoln-1809---18652c-sixteenth-president-of-the-united-states-of-america-photo-by-stock-montagestock-montagegetty-images_promo.jpg",
          "profileurl": "https://www.biography.com/us-president/abraham-lincoln",
          "banned": false
        },
        "customtype": "",
        "customid": "",
        "custompayload": "",
        "customtags": [],
        "customfield1": "",
        "customfield2": "",
        "replyto": null,
        "parentid": "",
        "hierarchy": [],
        "depth": 0,
        "edited": false,
        "editedbymoderator": false,
        "censored": false,
        "deleted": false,
        "active": true,
        "mutedby": [],
        "shadowban": false,
        "hashtags": [],
        "likecount": 0,
        "replycount": 0,
        "reactions": [],
        "moderation": "na",
        "reports": []
      }
    ]
  }
}
Search all 118 endpoints Try “join room”, “moderate”, or “POST”.
Request environment

Connect your application

These values fill request examples and the API console. They stay in this browser tab and are never sent to TalkLabs until you run a request.

Credentials are stored in sessionStorage, not in cookies or analytics.