Get a message's edit history
GET https://cdfa-phs.zulipchat.com/api/v1/messages/{message_id}/history
Fetch the message edit history of a previously edited message.
Note that edit history may be disabled in some organizations; see the
Zulip Help Center documentation on editing messages.
Usage examples
#!/usr/bin/env python3
import zulip
# Pass the path to your zuliprc file here.
client = zulip.Client(config_file="~/zuliprc")
# Get the edit history for a message, given the message's ID.
result = client.get_message_history(message_id)
print(result)
curl -sSX GET -G https://cdfa-phs.zulipchat.com/api/v1/messages/43/history \
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
Parameters
message_id integer required in path
Example: 43
Response
Return values
-
message_history
: (object)[]
A chronologically sorted, oldest to newest, array
of snapshot
objects, each one with the values of
the message after the edit.
-
topic
: string
The topic of the message immediately
after this edit event.
-
prev_topic
: string
Only present if message's topic was edited.
The topic of the message immediately
prior to this edit event.
-
stream
: integer
Only present if message's channel was edited.
The ID of the channel containing the message
immediately after this edit event.
Changes: New in Zulip 5.0 (feature level 118).
-
prev_stream
: integer
Only present if message's channel was edited.
The ID of the channel containing the message immediately
prior to this edit event.
Changes: New in Zulip 3.0 (feature level 1).
-
content
: string
The raw Markdown content of the message
immediately after this edit event.
-
rendered_content
: string
The rendered HTML representation of content
.
-
prev_content
: string
Only present if message's content was edited.
The raw Markdown content of the message immediately
prior to this edit event.
-
prev_rendered_content
: string
Only present if message's content was edited.
The rendered HTML representation of prev_content
.
-
user_id
: integer | null
The ID of the user that made the edit.
Will be null
only for edit history
events predating March 2017.
Clients can display edit history events where this
is null
as modified by either the sender (for content
edits) or an unknown user (for topic edits).
-
content_html_diff
: string
Only present if message's content was edited.
An HTML diff between this version of the message
and the previous one.
-
timestamp
: integer
The UNIX timestamp for this edit.
Please note that the original message's snapshot only contains the fields
topic
, content
, rendered_content
, timestamp
and user_id
. This
snapshot will be the only one present if the message has never been edited.
Also note that each snapshot object will only contain additional data for the
modified fields for that particular edit (e.g. if only the topic or channel
was edited, prev_content
, prev_rendered_content
, and
content_html_diff
will not appear).
Example response(s)
Changes: As of Zulip 7.0 (feature level 167), if any
parameters sent in the request are not supported by this
endpoint, a successful JSON response will include an
ignored_parameters_unsupported
array.
A typical successful JSON response may look like:
{
"message_history": [
{
"content": "Hello!",
"rendered_content": "<p>Hello!</p>",
"timestamp": 1530129122,
"topic": "party at my houz",
"user_id": 5
},
{
"content": "Howdy!",
"content_html_diff": "<div><p><span class=\"highlight_text_inserted\">Howdy!</span></p> <p><span class=\"highlight_text_deleted\">Hello!</span></p></div>",
"prev_content": "Hello!",
"prev_rendered_content": "<p>Hello!</p>",
"prev_topic": "party at my houz",
"rendered_content": "<p>Howdy!</p>",
"timestamp": 1530129134,
"topic": "party at my house",
"user_id": 5
}
],
"msg": "",
"result": "success"
}
An example JSON response for when the specified message does not exist:
{
"code": "BAD_REQUEST",
"msg": "Invalid message(s)",
"result": "error"
}