Update a message's flags
Add or remove flags in a list of messages.
POST https://chat.convergenceservices.in/api/v1/messages/flags
For updating the read
flag on common collections of messages, see also
the
special endpoints for marking message as read in bulk.
Usage examples
#!/usr/bin/env python3
import zulip
# Pass the path to your zuliprc file here.
client = zulip.Client(config_file="~/zuliprc")
# Add the "read" flag to the messages with IDs in "message_ids"
request = {
'messages': message_ids,
'op': 'add',
'flag': 'read'
}
result = client.update_message_flags(request)
print(result)
# Remove the "starred" flag from the messages with IDs in "message_ids"
request = {
'messages': message_ids,
'op': 'remove',
'flag': 'starred'
}
result = client.update_message_flags(request)
print(result)
More examples and documentation can be found here.
const zulip = require('zulip-js');
// Pass the path to your zuliprc file here.
const config = {
zuliprc: 'zuliprc',
};
const flagParams = {
messages: [4, 8, 15],
flag: 'read',
};
zulip(config).then((client) => {
// Add the "read" flag to messages with IDs 4, 8 and 15
client.messages.flags.add(flagParams)
.then(console.log)
// Remove the "read" flag from said messages
client.messages.flags.remove(flagParams)
.then(console.log);
});
curl -X POST https://chat.convergenceservices.in/api/v1/messages/flags \
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
-d "messages=[4,8,15]" \
-d "op=add" \
-d "flag=starred"
Arguments
Argument |
Example |
Required |
Description |
messages |
[4,8,15] |
Yes |
An array containing the IDs of the target messages. |
op |
"add" |
Yes |
Whether to add the flag or remove it.
Must be one of: add , remove . |
flag |
"read" |
Yes |
The flag that should be added/removed.
Must be one of: read , starred , collapsed , mentioned , wildcard_mentioned , summarize_in_home , summarize_in_stream , force_expand , force_collapse , has_alert_word , historical . |
Response
Return values
messages
: An array with the IDs of the modified messages.
Example response
A typical successful JSON response may look like:
{
"messages": [
4,
18,
15
],
"msg": "",
"result": "success"
}