2020-01-01 22:37:59 +01:00
|
|
|
---
|
|
|
|
title: PushSubscription
|
|
|
|
description: Represents a subscription to the push streaming server.
|
|
|
|
menu:
|
|
|
|
docs:
|
|
|
|
parent: entities
|
|
|
|
---
|
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
{
|
|
|
|
"id": 328183,
|
|
|
|
"endpoint": "https://yourdomain.example/listener",
|
|
|
|
"alerts": {
|
|
|
|
"follow": false,
|
|
|
|
"favourite": false,
|
|
|
|
"reblog": false,
|
|
|
|
"mention": true,
|
|
|
|
"poll": false
|
|
|
|
},
|
|
|
|
"server_key": "BCk-QqERU0q-CfYZjcuB6lnyyOYfJ2AifKqfeGIm7Z-HiTU5T9eTG5GxVA0_OH5mMlI4UkkDTpaZwozy0TzdZ2M="
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2020-01-12 14:11:56 +01:00
|
|
|
## Required attributes {#push-subscription}
|
2020-01-01 22:37:59 +01:00
|
|
|
|
2020-01-12 14:11:56 +01:00
|
|
|
### `id` {#id}
|
2020-01-01 22:37:59 +01:00
|
|
|
|
2020-01-12 14:11:56 +01:00
|
|
|
**Description:** The id of the push subscription in the database.\
|
|
|
|
**Type:** String \(cast from an integer, but not guaranteed to be a number\)\
|
2020-01-01 22:37:59 +01:00
|
|
|
**Version history:** Added in 2.4.0
|
|
|
|
|
2020-01-12 14:11:56 +01:00
|
|
|
### `endpoint` {#endpoint}
|
2020-01-01 22:37:59 +01:00
|
|
|
|
2020-01-12 14:11:56 +01:00
|
|
|
**Description:** Where push alerts will be sent to.\
|
|
|
|
**Type:** String \(URL\)\
|
2020-01-01 22:37:59 +01:00
|
|
|
**Version history:** Added in 2.4.0
|
|
|
|
|
2020-01-12 14:11:56 +01:00
|
|
|
### `server_key` {#server_key}
|
2020-01-01 22:37:59 +01:00
|
|
|
|
2020-01-12 14:11:56 +01:00
|
|
|
**Description:** The streaming server's VAPID key.\
|
|
|
|
**Type:** String\
|
2020-01-01 22:37:59 +01:00
|
|
|
**Version history:** Added in 2.4.0
|
|
|
|
|
2020-01-12 14:11:56 +01:00
|
|
|
### `alerts` {#alerts}
|
2020-01-01 22:37:59 +01:00
|
|
|
|
2020-01-12 14:11:56 +01:00
|
|
|
**Description:** Which alerts should be delivered to the `endpoint`.\
|
|
|
|
**Type:** Hash\
|
2020-01-01 22:37:59 +01:00
|
|
|
**Version history:** Added in 2.4.0. `alerts[poll]` added in 2.8.0.
|
|
|
|
|
|
|
|
#### `alerts[follow]`
|
|
|
|
|
|
|
|
Receive a push notification when someone has followed you? Boolean.
|
|
|
|
|
|
|
|
#### `alerts[favourite]`
|
|
|
|
|
|
|
|
Receive a push notification when a status you created has been favourited by someone else? Boolean.
|
|
|
|
|
|
|
|
#### `alerts[mention]`
|
|
|
|
|
|
|
|
Receive a push notification when someone else has mentioned you in a status? Boolean.
|
|
|
|
|
|
|
|
#### `alerts[reblog]`
|
|
|
|
|
|
|
|
Receive a push notification when a status you created has been boosted by someone else? Boolean.
|
|
|
|
|
|
|
|
#### `alerts[poll]`
|
|
|
|
|
|
|
|
Receive a push notification when a poll you voted in or created has ended? Boolean. Added in 2.8.0
|
|
|
|
|
|
|
|
## See also
|
|
|
|
|
|
|
|
{{< page-ref page="methods/notifications/push.md" >}}
|
|
|
|
|
|
|
|
{{< caption-link url="https://github.com/tootsuite/mastodon/blob/master/app/serializers/rest/web_push_subscription_serializer.rb" caption="app/serializers/rest/web\_push\_subscription\_serializer.rb" >}}
|
|
|
|
|
|
|
|
|
|
|
|
|