Push Subscription Management
In Teak a player’s push subscription status is not connected to their per device opt-in/out state. That is, if a player denies push notifications from the platform 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 mobile devices, and the subscription status may be changed even if the player has no mobile devices.
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/push/subscription_status
endpoint retrieves the current 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 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/push/subscription_status
endpoint updates the push subscription status for a given player.
The state will apply to all of a player’s mobile devices. However please be aware that if the user has chosen to opt out of push notifications in their device settings or by denying the push notifications from the platform specific push notification permission prompt, this API cannot be used to cause a player to receive push notifications on that device.
It is not necessary for the player to have any mobile 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 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/push/subscription_status/:category_identifier
endpoint updates the push subscription status for a given player and Opt Out Category.
The state will apply to all of a player’s mobile devices. However please be aware that if the user has chosen to opt out of push notifications in their device settings or by denying the push notifications from the platform specific push notification permission prompt, this API cannot be used to cause a player to receive push notifications on that device.
It is not necessary for the player to have any mobile 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 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 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 |
|