Some checks failed
Code scanning / CodeQL (push) Failing after 15s
Zulip production suite / Ubuntu 22.04 production build (push) Failing after 26s
Zulip production suite / Debian 12 production install with custom db name and user (push) Has been skipped
Zulip production suite / Ubuntu 22.04 production install and PostgreSQL upgrade with pgroonga (push) Has been skipped
Zulip production suite / Ubuntu 24.04 production install (push) Has been skipped
Zulip production suite / Ubuntu 26.04 production install (push) Has been skipped
Zulip production suite / Debian 13 production install (push) Has been skipped
Zulip production suite / 7.0 Version Upgrade (push) Has been skipped
Zulip production suite / 8.0 Version Upgrade (push) Has been skipped
Zulip production suite / 6.0 Version Upgrade (push) Has been skipped
Zulip production suite / 10.0 Version Upgrade (push) Has been skipped
Zulip production suite / 9.0 Version Upgrade (push) Has been skipped
Zulip production suite / 12.0 Version Upgrade (push) Has been skipped
Zulip production suite / 11.0 Version Upgrade (push) Has been skipped
GitHub Actions Security Analysis with zizmor / zizmor (push) Failing after 3s
Zulip CI / Debian 12 (Python 3.11, backend + documentation) (push) Failing after 26s
Zulip CI / Ubuntu 22.04 (Python 3.10, backend + frontend) (push) Failing after 3s
Zulip CI / Ubuntu 24.04 (Python 3.12, backend) (push) Failing after 25s
Zulip CI / Ubuntu 26.04 (Python 3.14, backend) (push) Failing after 25s
Zulip CI / Debian 13 (Python 3.13, backend) (push) Failing after 28s
Zulip production suite / Required jobs (push) Has been cancelled
Zulip CI / Required jobs (push) Has been cancelled
API Documentation Update Check / check-feature-level-updated (push) Has been cancelled
API Documentation Update Check / notify-if-api-docs-changed (push) Has been cancelled
39 lines
1.8 KiB
Markdown
39 lines
1.8 KiB
Markdown
# Clients in Zulip
|
|
|
|
`zerver.models.Client` is Zulip's analogue of the HTTP User-Agent
|
|
header (and is populated from User-Agent). It exists for use in
|
|
analytics and other places to provide human-readable summary data
|
|
about "which Zulip client" was used for an operation (e.g., was it the
|
|
Android app, the desktop app, or a bot?).
|
|
|
|
In general, it shouldn't be used for anything controlling the behavior
|
|
of Zulip; it's primarily intended to assist debugging.
|
|
|
|
## Analytics
|
|
|
|
A `Client` is used to sort messages into client categories such as
|
|
`ZulipElectron` on the `/stats` page. For more information see,
|
|
[Analytics](analytics.md).
|
|
|
|
## Integrations
|
|
|
|
Generally, integrations in Zulip should declare a unique User-Agent,
|
|
so that it's easy to figure out which integration is involved when
|
|
debugging an issue. For incoming webhook integrations, we do that
|
|
conveniently via the auth decorators (as we will describe shortly);
|
|
other integrations generally should set the first User-Agent element
|
|
on their HTTP requests to something of the form
|
|
ZulipIntegrationName/1.2 so that they are categorized properly.
|
|
|
|
The `webhook_view` auth decorator, used for most incoming
|
|
webhooks, accepts the name of the integration as an argument and uses
|
|
it to generate a client name that it adds to the `request_notes`
|
|
object that can be accessed with the `request` (Django
|
|
[HttpRequest](https://docs.djangoproject.com/en/5.0/ref/request-response/#django.http.HttpRequest))
|
|
object via `zerver.lib.request.get_request_notes(request)`.
|
|
|
|
In most integrations, `request_notes.client` is then passed to
|
|
`check_send_webhook_message`, where it is used to keep track of which client
|
|
sent the message (which in turn is used by analytics). For more
|
|
information, see [the incoming webhook walkthrough](../webhooks/incoming-webhooks-walkthrough.md).
|