Get a user's presence

GET https://unstructured.zulipchat.com/api/v1/users/{user_id_or_email}/presence

Get the presence status for a specific user.

This endpoint is most useful for embedding data about a user's presence status in other sites (e.g. an employee directory). Full Zulip clients like mobile/desktop apps will want to use the main presence endpoint, which returns data for all active users in the organization, instead.

Usage examples

#!/usr/bin/env python3

import zulip

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

# Get presence information for "iago@zulip.com".
result = client.get_user_presence("iago@zulip.com")
print(result)

The -u line implements HTTP Basic authentication. See the Authorization header documentation for how to get those credentials for Zulip users and bots.

curl -sSX GET -G https://unstructured.zulipchat.com/api/v1/users/iago@zulip.com/presence \
    -u EMAIL_ADDRESS:API_KEY

Parameters

user_id_or_email string required in path

Example: "iago@zulip.com"

The ID or Zulip API email address of the user whose presence you want to fetch.

Changes: New in Zulip 4.0 (feature level 43). Previous versions only supported identifying the user by Zulip API email.


Response

Return values

  • presence: object

    An object containing the presence details for the user.

    Changes: In Zulip 12.0 (feature level 487), the active_timestamp and idle_timestamp fields were added to this object, deprecating and removing the website and aggregated dictionaries, which contained a timestamp and a status string.

    • active_timestamp: integer

      The UNIX timestamp of the last time a client connected to Zulip reported that the user was actually present (e.g. via focusing a browser window or interacting with a computer running the desktop app).

      Clients should display users with a current active_timestamp as fully present.

    • idle_timestamp: integer

      The UNIX timestamp of the last time the user had a client connected to Zulip, including idle clients where the user hasn't interacted with the system recently.

      The Zulip server has no way of distinguishing whether an idle web app user is at their computer, but hasn't interacted with the Zulip tab recently, or simply left their desktop computer on when they left.

      Thus, clients should display users with a current idle_timestamp but no current active_timestamp as potentially present.

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": "",
    "presence": {
        "active_timestamp": 1656958520,
        "idle_timestamp": 1656958530
    },
    "result": "success"
}