Render a message
POST https://zulip.noaidi.eu/api/v1/messages/render
Render a message to HTML.
Usage examples
#!/usr/bin/env python3
import zulip
# Pass the path to your zuliprc file here.
client = zulip.Client(config_file="~/zuliprc")
# Render a message.
request = {
"content": "**foo**",
}
result = client.render_message(request)
print(result)
More examples and documentation can be found here.
const zulipInit = require("zulip-js");
// Pass the path to your zuliprc file here.
const config = { zuliprc: "zuliprc" };
(async () => {
const client = await zulipInit(config);
// Render a message
const params = {
content: "**foo**",
};
console.log(await client.messages.render(params));
})();
The -u line implements HTTP Basic authentication.
See the Authorization header documentation for how
to get those credentials for Zulip users and bots.
curl -sSX POST https://zulip.noaidi.eu/api/v1/messages/render \
-u EMAIL_ADDRESS:API_KEY \
--data-urlencode content=Hello \
--data-urlencode populate_url_embed_data=true
Parameters
content string required
Example: "Hello"
The content of the message.
Clients should use the max_message_length returned by the
POST /register endpoint to determine
the maximum message size.
populate_url_embed_data boolean optional
Example: true
Whether the server should populate
URL embed data
for the links in content: data the server already has is
included in rendered, and the rest is fetched
asynchronously. If that changes the rendered content, it is
delivered to the requesting user via a
url_embed_data event, so
that a client displaying the rendered content can live-update
it. See the event's documentation for when it is not sent.
Only links that would get URL embeds if content were sent
as a message are populated. For example, links to websites
are not populated for bots, or if the organization has
disabled website previews.
Changes: New in Zulip 13.0 (feature level 513).
Defaults to false.
Response
Return values
-
rendered: string
The rendered HTML.
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:
{
"msg": "",
"rendered": "<p><strong>foo</strong></p>",
"result": "success"
}