How do I download all chat messages or those from a particular room (over all time)? A script may be able to do it, but is there a more convenient way?
Is there something at https://data.stackexchange.com/ all I see are the QA sites.
Meta Stack Exchange is a question and answer site for meta-discussion of the Stack Exchange family of Q&A websites. It only takes a minute to sign up.Sign up to join this community
In absence of any formal API, one can just obtain them by executing a
POST request to
http://chat.stackexchange.com/chats/<room_id>/events with form parameters:
'Messages'(there might be other modes, haven't checked.)
fkey: A valid user's
msgCount: integer, defaults to 100, capped to 500
message_idto to get messages prior to. If missing, it gets the most recent
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: a list of up to
msgCountmessages (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).; Begins with "" if there's more content which is not contained in the event record (i.e. it was a long message; the full content, if desired, has to be individually fetched).
1...only ever seen that.
message_edits: Integer, may be missing if not edited.
message_id: Integer; unique across all rooms on the chat server, but not between servers.
time_stamp: UNIX epoch, second-precision.
user_id: Integer, Chat.SE/Chat.MSE/Chat.SO user. Chat.SE ID is not related to a specific site or network ID; Chat.MSE and Chat.SO user IDs usually match the profile ID of the user on MSE and SO respectively, but that's not required. May be missing if the user_id no longer exists.
user_name: Name associated with
user_idwhen the message was posted. If the user changes their username later, this does not update.
parent_id: Integer; Message ID to which this event is replying. May be an actual reply or just an
@-ping. If it's the result of an
@-ping, then this is the message ID of the most recent message by the pinged user. Usually missing if the message is not a actual or
show_parent: Boolean; If true, then this is an actual reply and the replied-to arrow is shown. Usually missing if the message is not a direct reply.
moved: Boolean; If true, then this message has been moved from another room into its current room. Usually missing if the message has not been moved.