Request format: HMAC(random + ops) + random + ops
, hmac
is SHA-512
(64 bytes), random
is 8 bytes random data, ops
is JSON array
Op format: All ops contain an op
key, which is one of:
transcript
: Read from a room's transcriptroom
: Add a roomdrop_room
: Remove a roompost
: Add a messagemodify
: Edit a messagedrop
: Delete a message
Operations should be sent in batches, preferrably at least 24 at a time.
Single:
{
"op": "transcript",
"room": "AaBbCc-_",
"id": 2
}
An id
will fetch a single message, and return a response of:
{
"post": (data)
}
Multiple:
{
"op": "transcript",
"room": "AaBbCc-_",
"ids": [20, 86]
}
With ids
, a range of messages are chosen (inclusive start, exclusive end). If no end is specified, all messages after a certain point are returned (most useful with negative numbers; [-17]
gets the last 17 messages in a room, assuming sequential IDs). An empty array will return as much of the room's history as possible, ending with the last message. The maximum number of messages which can be requested at once is 1024. The result returned looks like this:
{
"posts": [(data), (data), ...]
}
{
"op": "room",
"room": "NewRoom1"
}
Result:
{}
{
"op": "room",
"room": "abcd----"
}
Result:
{
"did_drop_room": true
}
This will be true
if the room existed, and false
if the room did not (and thus nothing happened).
{
"op": "post",
"room": "xyz-xyz-",
"id": 11,
"data": (data)
}
This will create a post. If a message with the chosen id
already exists, it will be edited instead, and did_modify
in the response will be true
. The response looks like:
{
"did_modify": false
}
{
"op": "modify",
"room": "abc-dfg-",
"id": -7,
"data": (data)
}
This will edit a post. If a message with the chosen id
doesn't exist, a new post will be made instead, and did_post
in the response will be true
. The response looks like:
{
"did_post": false
}
{
"op": "modify",
"room": "__frog__",
"id": 0
}
This will delete a post. Result:
{
"did_drop": true
}
This will be true
if a message with the id
existed, and false
if one did not (and thus nothing happened).