Subscribe to and receive push notifications when a server-side notification is received, via the Web Push API
Web Push API
Mastodon natively supports the Web Push API. You can utilize the same mechanisms for your native app. It requires running a proxy server that connects to Android’s and Apple’s proprietary notification gateways. However, the proxy server does not have access to the contents of the notifications. For a reference, see Mozilla’s web push server, or more practically, see:
Add a Web Push API subscription to receive notifications. Each access token can have one push subscription. If you create a new subscription, the old subscription is deleted.
Returns: PushSubscription
OAuth: User token + pushVersion history:
2.4.0 - added
Headers
Name
Type
Description
Authorization
string
Bearer <user token>
Request Body
Name
Type
Description
subscription[endpoint]
string
Endpoint URL that is called when a notification event occurs.
subscription[keys][p256dh]
string
User agent public key. Base64 encoded string of public key of ECDH key using prime256v1 curve.
subscription[keys][auth]
string
Auth secret. Base64 encoded string of 16 bytes of random data.
View the PushSubscription currently associated with this access token.
Returns: PushSubscription
OAuth: User token + pushVersion history:
2.4.0 - added
Updates the current push subscription. Only the data part can be updated. To change fundamentals, a new subscription must be created instead.
Returns: PushSubscription
OAuth: User token + pushVersion history:
2.4.0 - added