Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 157 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

How do I download all chat messages or those from a particular room (over all time)? Some dopey script may be able to do it, but is there a more convenient way? Is there something at; all I see are the QA sites.

Trying to learn some data analysis stuff, figured I'd try to toy with a rather unique set.

share|improve this question

In absence of any formal API, one can just scrape them by executing a POST request to<room_id>/events with form parameters:

  • mode: 'Messages' (there might be other modes, haven't checked.)
  • (optional) msgCount: integer, defaults to 100, capped to 500
  • (optional) before: message_id to to get messages prior to. If missing, it gets the most recent msgCount messages

Example Jupyter Notebook.

The returned value is a mapping with the following keys:

  • ms: Time it took for the query to run?
  • time: Time since Aug 4, 2014 in seconds???
  • sync: UNIX epoch time (mislabeled, or used to "sync" correct server-time to JS client?)
  • events...

events is a list of up to msgCount messages (may be fewer if there aren't that many.) Each is a mapping with the following keys:

  • content: HTML-formatted message, may be missing if (removed).
  • event_type: 1...only ever seen that.
  • message_edits: Integer, may be missing if not edited.
  • message_id: Integer, unique across all rooms
  • room_id: Integer
  • time_stamp: UNIX epoch, second-precision.
  • user_id: Integer, Chat.SE user. Not related to a specific site or network ID
  • user_name: Name associated with user_id when message posted (if user changes it later, this does not update)
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .