#!/usr/bin/env python3importpero# Pass the path to your perorc file here.client=pero.Client(config_file="~/.perorc")# Add the "read" flag to messages, given the messages' IDs.request={"messages":message_ids,"op":"add","flag":"read",}result=client.update_message_flags(request)# Remove the "starred" flag from messages, given the messages' 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.
constzulipInit=require("zulip-js");// Pass the path to your perorc file here.constconfig={zuliprc:"perorc"};(async()=>{constclient=awaitzulipInit(config);// Add the "read" flag to the messages with IDs in "message_ids"constaddflag={messages:message_ids,flag:"read",};console.log(awaitclient.messages.flags.add(addflag));// Remove the "starred" flag from the messages with IDs in "message_ids"constremoveflag={messages:message_ids,flag:"starred",};console.log(awaitclient.messages.flags.remove(removeflag));})();
The -u line implements HTTP Basic authentication.
See the Authorization header documentation for how
to get those credentials for users and bots.
An array containing the IDs of the target messages.
opstringrequired
Example: "add"
Whether to add the flag or remove it.
Must be one of: "add", "remove".
flagstringrequired
Example: "read"
The flag that should be added/removed.
Available flags
Flag
Purpose
read
Whether the user has read the message. Messages
start out unread (except for messages the user
themself sent using a non-API client) and can
later be marked as read.
Whether the user has hidden auto-generated link previews on this message.
Can be set on any message, regardless of whether it currently has a link preview.
Changes: New in Zulip 13.0 (feature level 510).
mentioned
Whether the current user
was mentioned
by this message, either directly or via a user
group. Cannot be changed by the user directly, but
can change if the message is edited to add/remove
a mention of the current user.
stream_wildcard_mentioned
Whether this message contained a
channel wildcard mention
(like @**all**). Cannot be changed by the user directly, but
can change if the message is edited to add/remove
a channel wildcard mention.
Changes: New in Zulip 8.0 (feature level 224).
topic_wildcard_mentioned
Whether this message contained a
topic wildcard mention
(@**topic**).
Cannot be changed by the user directly, but can change if
the message is edited to add/remove a topic wildcard mention.
Changes: New in Zulip 8.0 (feature level 224).
has_alert_word
Whether the message contains any of the current user's
configured alert words.
Cannot be changed by the user directly, but
can change if the message is edited to add/remove
one of the current user's alert words.
historical
Is true for messages that the user did not receive
at the time they were sent but later was added to
the user's history (e.g. because they starred or
reacted to a message sent to a public channel
before they subscribed to that channel). Cannot be
changed by the user directly.
wildcard_mentioned
Whether this message contained either a
channel wildcard mention
(like @**all**) or a
topic wildcard mention
(@**topic**). Cannot be changed by the user directly, but can change if
the message is edited to add/remove a channel and/or topic wildcard
mention.
Changes: Deprecated in Zulip 8.0 (feature level 224), in favor of
the stream_wildcard_mentioned and
topic_wildcard_mentioned flags. The
wildcard_mentioned flag exists for backwards compatibility
with older clients and equals
stream_wildcard_mentioned || topic_wildcard_mentioned.
Clients supporting older server versions should treat this field as a
previous name for the stream_wildcard_mentioned flag as
topic wildcard mentions were not available prior to this feature level.
Only present if the flag is read and the operation is remove.
All unread channel messages must be in channels
the user is subscribed to. This field will contain a list of the
channels whose messages were skipped to mark as unread because the
user is not subscribed to them.
Changes: New in Zulip 10.0 (feature level 355).
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.