Desktop Web Subscription Management
In Teak a player’s desktop web subscription status is not connected to their per device opt-in/out state. That is, if a player denies desktop web notifications from the browser specific push notification permission prompt, their subscription status reported by this API will still be opt_in
. This API applies across all of a player’s desktop devices and browsers, and the subscription status may be changed even if the player has no desktop devices or browsers.
The subscription status set by this API applies to Facebook Canvas App to User Notifications and Desktop Web push notifications.
The subscription status set by this API applies to both locally scheduled notifications and dashboard managed schedules.
Reading
Endpoint |
|
Request Type |
GET |
Rate Limiting |
300 requests per second |
Description: The GET v2/desktop_push/subscription_status
endpoint retrieves the current desktop web push subscription status for a game assigned player id.
Required Parameters
game_id |
Your Teak App ID |
secret_key |
Your Teak Server Secret |
user_id |
The Game Assigned Player ID of the player you are retrieving desktop web push subscription status for. This must match the value provided by the game client’s Teak SDK integration. |
Success Response
Status Code |
200 |
||||||||||||
Response Body |
JSON dictionary with 'status', 'channel', 'user_id', 'state', 'reachable', and 'categories' keys.
|
||||||||||||
Example |
|
Error Responses
Player Not Found
Status Code |
404 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'error'. 'errors' will be a dictionary containing keys indicating which resources were not found, with values being an array of human readable error messages. |
Example |
|
Rate Limit Response
Status Code |
429 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'rate_limit'. 'errors' will contain the key 'rate_limit' |
Example |
|
Updating
Endpoint |
|
Request Type |
POST |
Content-Type |
application/json or application/x-www-form-urlencoded |
Rate Limiting |
300 requests per second |
Description: The POST v2/desktop_push/subscription_status
endpoint updates the desktop web push subscription status for a given player.
The state will apply to all of a player’s desktop devices and browsers. However please be aware that if the user has chosen to opt out of desktop web notifications in their browser settings or by denying notifications from the browser specific push notification permission prompt, this API cannot be used to cause a player to receive desktop web notifications on that device or browser.
It is not necessary for the player to have any desktop devices to make this call.
Required Parameters
game_id |
Your Teak App ID |
||||
secret_key |
Your Teak Server Secret |
||||
user_id |
The Game Assigned Player ID of the player you are updating desktop web push subscription status for. This must match the value provided by the game client’s Teak SDK integration. |
||||
state |
One of 'opt_out' or 'opt_in'
|
Success Response
Status Code |
200 |
||||||||||||||
Response Body |
JSON dictionary with 'status', 'channel', 'user_id', 'previous_state', 'state', 'reachable', and categories keys.
|
||||||||||||||
Example |
|
Error Responses
Unknown State
Status Code |
404 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'error'. 'errors' will be a dictionary containing keys indicating which parameters were invalid, with values being an array of human readable error messages.. |
Example |
|
Player Not Found
Status Code |
404 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'error'. 'errors' will be a dictionary containing keys indicating which resources were not found, with values being an array of human readable error messages. |
Example |
|
Rate Limit Response
Status Code |
429 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'rate_limit'. 'errors' will contain the key 'rate_limit' |
Example |
|
Category Update
Endpoint |
|
Request Type |
POST |
Content-Type |
application/json or application/x-www-form-urlencoded |
Rate Limiting |
300 requests per second |
Description: The POST v2/desktop_push/subscription_status/:category_identifier
endpoint updates the desktop web push subscription status for a given player and Opt Out Category.
The state will apply to all of a player’s desktop devices and browsers. However please be aware that if the user has chosen to opt out of desktop web notifications in their browser settings or by denying notifications from the browser specific push notification permission prompt, this API cannot be used to cause a player to receive desktop web notifications on that device or browser.
It is not necessary for the player to have any desktop devices to make this call.
Required Parameters
category_identifier |
Note that this is a path parameter. The identifier of the opt out category the player’s desktop web push subscription status is being updated for. |
||||
game_id |
Your Teak App ID |
||||
secret_key |
Your Teak Server Secret |
||||
user_id |
The Game Assigned Player ID of the player you are updating desktop web push subscription status for. This must match the value provided by the game client’s Teak SDK integration. |
||||
state |
One of 'opt_out' or 'opt_in'
|
Success Response
Status Code |
200 |
||||||||||||||
Response Body |
JSON dictionary with 'status', 'channel', 'user_id', 'previous_state', 'state', 'reachable', and 'category' keys.
|
||||||||||||||
Example |
|
Error Responses
Unknown State
Status Code |
404 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'error'. 'errors' will be a dictionary containing keys indicating which parameters were invalid, with values being an array of human readable error messages.. |
Example |
|
Player Not Found
Status Code |
404 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'error'. 'errors' will be a dictionary containing keys indicating which resources were not found, with values being an array of human readable error messages. |
Example |
|
Rate Limit Response
Status Code |
429 |
Response Body |
JSON dictionary with 'status' and 'errors' keys. 'status' will be 'rate_limit'. 'errors' will contain the key 'rate_limit' |
Example |
|