Add a web push subscription

POST https://most.archetypal.quest/api/v1/users/me/web_push_subscriptions

Register a browser Web Push subscription so that this server can deliver push notifications to the browser using VAPID, with no push notification bouncer involved.

Registering the same endpoint again updates the stored keys instead of creating a duplicate subscription.

Changes: New in Zulip 13.0 (feature level ZF-16420a).

Usage examples

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 POST https://most.archetypal.quest/api/v1/users/me/web_push_subscriptions \
    -u EMAIL_ADDRESS:API_KEY \
    --data-urlencode endpoint=https://fcm.googleapis.com/fcm/send/abcdef \
    --data-urlencode p256dh_key=BM0RXeBm6BH-5Q_T43um3GJzYxGKpa6yJto75AAb1MnPHds6N_Q_68YezVFcBceNwHKF3ktRjE9ALS8sKClqByg \
    --data-urlencode auth_secret=tBHItJI5svbpez7KI4CCXg \
    --data-urlencode user_agent=Mozilla/5.0

Parameters

endpoint string required

Example: "https://fcm.googleapis.com/fcm/send/abcdef"

The push service URL (PushSubscription.endpoint) that the browser returned. Must be an https URL.


p256dh_key string required

Example: "BM0RXeBm6BH-5Q_T43um3GJzYxGKpa6yJto75AAb1MnPHds6N_Q_68YezVFcBceNwHKF3ktRjE9ALS8sKClqByg"

The base64url-encoded P-256 ECDH public key (PushSubscription.getKey("p256dh")) used to encrypt payloads. This is the 65-byte uncompressed public point.


auth_secret string required

Example: "tBHItJI5svbpez7KI4CCXg"

The base64url-encoded authentication secret (PushSubscription.getKey("auth")).


user_agent string optional

Example: "Mozilla/5.0"

The browser's User-Agent string, stored to help the user identify the subscription later.


Response

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": "",
    "result": "success"
}