Create a saved snippet

POST https://vercre.zulipchat.com/api/v1/saved_snippets

Create a new saved snippet for the current user.

Changes: New in Zulip 10.0 (feature level 297).

Usage examples

#!/usr/bin/env python3

import zulip

# Pass the path to your zuliprc file here.
client = zulip.Client(config_file="~/zuliprc")

# Create a saved snippet.
request = {"title": "Welcome message", "content": "**Welcome** to the organization."}
result = client.call_endpoint(
    request=request,
    url="/saved_snippets",
    method="POST",
)
print(result)

curl -sSX POST https://vercre.zulipchat.com/api/v1/saved_snippets \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY \
    --data-urlencode 'title=Example title' \
    --data-urlencode 'content=Welcome to the organization.'

Parameters

title string required

Example: "Example title"

The title of the saved snippet.


content string required

Example: "Welcome to the organization."

The content of the saved snippet in text/markdown format.

Clients should insert this content into a message when using a saved snippet.


Response

Return values

  • saved_snippet_id: integer

    The unique ID of the saved snippet created.

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": "",
    "result": "success",
    "saved_snippet_id": 1
}

A typical failed JSON response for when either title or content is empty:

{
    "code": "BAD_REQUEST",
    "msg": "Title cannot be empty.",
    "result": "error"
}