POST /register
This powerful endpoint can be used to register a Zulip "event queue" (subscribed to certain types of "events", or updates to the messages and other Zulip data the current user has access to), as well as to fetch the current state of that data.
(register also powers the call_on_each_event Python API, and is
intended primarily for complex applications for which the more convenient
call_on_each_event API is insufficient).
This endpoint returns a queue_id and a last_event_id; these can be
used in subsequent calls to the
"events" endpoint to request events from
the Zulip server using long-polling.
The server will queue events for up to idle_queue_timeout_secs
seconds of inactivity. After that timeout, your event queue will be
garbage-collected. The server will send heartbeat events
every minute, which makes it easy to implement a robust client that
does not miss events unless the client loses network connectivity
with the Zulip server for longer than the configured timeout.
Once the server garbage-collects your event queue, the server will
return an error
with a code of BAD_EVENT_QUEUE_ID if you try to fetch events from
the event queue. Your software will need to handle that error
condition by re-initializing itself (e.g. this is what triggers your
browser reloading the Zulip web app when your laptop comes back online
after being offline for more than idle_queue_timeout_secs seconds).
When prototyping with this API, we recommend first calling register
with no event_types parameter to see all the available data from all
supported event types. Before using your client in production, you
should set appropriate event_types and fetch_event_types filters
so that your client only requests the data it needs. A few minutes
doing this often saves 90% of the total bandwidth and other resources
consumed by a client using this API.
See the events system developer documentation if you need deeper details about how the Zulip event queue system works, avoids clients needing to worry about large classes of potentially messy races, etc.
Changes: New in Zulip 12.0 (feature level 481),
the idle_queue_timeout request parameter and idle_queue_timeout_secs
response field were added to allow clients to configure
how long the server keeps an event queue alive during inactivity.
Removed dense_mode setting in Zulip 10.0 (feature level 364)
as we now have web_font_size_px and web_line_height_percent
settings for more control.
Before Zulip 7.0 (feature level 183), the
realm_community_topic_editing_limit_seconds property
was returned by the response. It was removed because it
had not been in use since the realm setting
move_messages_within_stream_limit_seconds was introduced
in feature level 162.
In Zulip 7.0 (feature level 163), the realm setting
email_address_visibility was removed. It was replaced by a user
setting with
a realm user default, with the encoding of different
values preserved. Clients can support all versions by supporting the
current API and treating every user as having the realm's
email_address_visibility value.
Servers
- https://{subdomain}.zulipchat.com/api/v1
- {server}/api/v1
- https://chat.zulip.org/api/v1
Request headers
| Name | Type | Required | Description |
|---|---|---|---|
Content-Type |
String | Yes |
The media type of the request body.
Default value: "application/x-www-form-urlencoded" |
Request body fields
| Name | Type | Required | Description |
|---|---|---|---|
narrow[] |
Array | No |
A JSON-encoded array of arrays of length 2 indicating the narrow filter(s) for which you'd like to receive events for. For example, to receive events for direct messages (including
group direct messages) received by the user, one can use
Unlike the API for fetching messages, this narrow parameter is simply a filter on messages that the user receives through their channel subscriptions (or because they are a recipient of a direct message). This means that a client that requests a Newly created bot users are not usually subscribed to any channels, so bots using this API need to be subscribed to any channels whose messages you'd like them to process using this endpoint. See the Changes: See changes section of search/narrow filter documentation. |
idle_queue_timeout |
No |
At least how long (in seconds) the server should keep the event queue alive when the client is not polling. If the client does not poll before this timeout, the queue will eventually be garbage-collected. Alternatively, the string If not specified, the server uses a default of 10 minutes. The maximum allowed value is 7 days. Changes: New in Zulip 12.0 (feature level 481). |
|
apply_markdown |
Boolean | No |
Set to Default value: false |
all_public_streams |
Boolean | No |
Whether you would like to request message events from all public channels. Useful for workflow bots that you'd like to see all new messages sent to public channels. (You can also subscribe the user to private channels). Default value: false |
fetch_event_types[] |
Array | No |
Same as the Event types not supported by the server are ignored, in order to simplify the implementation of client apps that support multiple server versions. |
include_subscribers |
String | No |
Whether each returned channel object should include a Client apps supporting organizations with many thousands of users
should not pass If a client passes The server guarantees that it will always return a Passing Changes: The Before Zulip 6.0 (feature level 149), this parameter was silently
ignored and processed as though it were New in Zulip 2.1.0. Valid values:
Default value: "false" |
event_types[] |
Array | No |
A JSON-encoded array indicating which types of events you're interested in. Values that you might find useful include:
If you do not specify this parameter, you will receive all
events, and have to filter out the events not relevant to
your client in your client code. For most applications, one
is only interested in messages, so one specifies:
Event types not supported by the server are ignored, in order to simplify the implementation of client apps that support multiple server versions. |
presence_history_limit_days |
Integer | No |
Limits how far back in time to fetch user presence data. If not specified, defaults to 14 days. A value of N means that the oldest presence data fetched will be from at most N days ago. Changes: New in Zulip 10.0 (feature level 288). |
client_capabilities |
Object | No |
Dictionary containing details on features the client supports that are relevant to the format of responses sent by the server.
|
slim_presence |
Boolean | No |
If Changes: New in Zulip 3.0 (no feature level; API unstable). Default value: false |
client_gravatar |
Boolean | No |
Whether the client supports computing gravatars URLs. If
enabled, The default value is Changes: Before Zulip 6.0 (feature level 149), this
parameter was silently ignored and processed as though it
were |
How to start integrating
- Add HTTP Task to your workflow definition.
- Search for the API you want to integrate with and click on the name.
- This loads the API reference documentation and prepares the Http request settings.
- Click Test request to test run your request to the API and see the API's response.