Update a message

Edit/update the content or topic of a message.

PATCH https://chat.fhir.org/api/v1/messages/<msg_id>

<msg_id> in the above URL should be replaced with the ID of the message you wish you update.

Usage examples

curl -X "PATCH" https://chat.fhir.org/api/v1/messages/<msg_id> \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY \
    -d "content=New content"
#!/usr/bin/env python3

import zulip

# Download ~/zuliprc-dev from your dev server
client = zulip.Client(config_file="~/zuliprc-dev")

# Edit a message
# (make sure that message_id below is set to the ID of the
# message you wish to update)
request = {
    "message_id": message_id,
    "content": "New content"
}
result = client.update_message(request)
print(result)

More examples and documentation can be found here.

const zulip = require('zulip-js');

// Download zuliprc-dev from your dev server
const config = {
    zuliprc: 'zuliprc-dev',
};

zulip(config).then((client) => {
    // Update a message
    const params = {
        message_id: 131,
        content: 'New Content',
    }

    client.messages.update(params).then(console.log);
});

Permissions

You only have permission to edit a message if:

  1. You sent it, OR:
  2. This is a topic-only edit for a (no topic) message, OR:
  3. This is a topic-only edit and you are an admin.

Arguments

Argument Example Required Description
message_id 134 Required

The ID of the message that you wish to edit/update.

subject Castle Optional

The topic of the message. Only required for a stream message. Defaults to None. Maximum length of 60 characters.

content Hello Optional

The content of the message. Maximum message size of 10000 bytes.

propagate_mode change_all Optional

In the case of a topic update, propagate_mode is a value specifying whether the topic of any other messages in the same conversation would be updated or not. Possible values include:

* change_one (Default): Update the topic only of the message with the given message_id.
* change_all: Update the topic of all messages with the same previous topic as the message with message_id.
* change_later: Update the topic of the message with message_id and update the topic of the messages with the same previous topic after it.

Response

Example response

A typical successful JSON response may look like:

{
    "msg": "",
    "result": "success"
}

A typical JSON response for when one doesn't have the permission to edit a particular message:

{
    "code": "BAD_REQUEST",
    "msg": "You don't have permission to edit this message",
    "result": "error"
}