Push Notifications

The playPORTAL API can be used to send mobile push notifications. Make sure you have enabled and configured push notifications in playPORTAL Studio for your app before using these endpoints. You also must be able to generate an iOS device token or Android registration ID to register a user to receive notifications in your app.

Reminder: if you are using an app/client ID in sandbox, you must use sandbox.playportal.io as the endpoint for your requests. Requests to api.playportal.io with a sandbox client ID will fail!

put
Create Notification

https://api.playportal.io/notifications/v1
Sends a push notification to a user.
Request
Response
Headers
Authorization
required
string
Auth token generated by user login.
Body Parameters
text
required
string
Text of the notification.
receiver
required
string
User ID of the notification recipient.
persist
required
boolean
Determines whether the resulting notification is saved on the playPORTAL servers to be returned in a user's notification list.
textParameters
optional
object
Inserts dynamic strings into a notification's text.
path
optional
string
Can be specified to direct the app to open a specific view when the notification is opened.
200: OK
Notification sent.

put
Register for Notifications

https://api.playportal.io/notifications/v1/register
Register's a user's session for receiving notifications. Note that this route must be called every time a user logs in to ensure they will receive notifications from other users.
Request
Response
Headers
Authorization
required
string
Auth token generated by user login.
Body Parameters
refreshToken
required
string
Refresh token of the session the user wishes to register for push notifications.
deviceToken
required
string
iOS or Android device token.
200: OK
Registration successful.
{
"success": true
}

get
Get List of Notifications

https://api.playportal.io/notifications/v1
Register's a user's session for receiving notifications. Note that this route must be called every time a user logs in to ensure they will receive notifications from other users.
Request
Response
Headers
Authorization
required
string
Auth token generated by user login.
Query Parameters
since
optional
string
Date string, return all notifications created after this date.
page
optional
integer
Page number to return.
limit
optional
integer
Page size to return.
acknowledged
optional
boolean
Whether or not to return acknowledged notifications.
200: OK
Notification list retrieved.
{ docs:
[ { notificationId: 'ccb728ba49c7806ca2977a7c084ec2c0d7a21a143b1216b5f5878fab0d047fb1ea64aede35298a62534cf97fb8adf7ca6eb47c8c3cbb351b47f8ed705c9d3bcf3a1a29765120faa993f8f9121b63879883$021f5d54a38855cb506766175f32d9f0',
text: 'You are super ${{status}}.',
textParameters: { status: 'cool' },
createdDate: '2019-01-31T20:14:31.716Z',
sender: 'ccb728ba49c7806ca2977a7c084ec2c0d7a21a143b1214e4f5878fab0d047fb1ea64aede35298a62534cf97fb8adf7ca6eb47c8c3cbb351b47f8ed705c9d3bcf3a1a29765120faa993f8f9121b63879883$021f5d54a38855cb506766175f32d9f0',
acknowledged: false } ],
page: 1,
limit: 10,
total: 1 }

post
Acknowledge a Notification

https://api.playportal.io/notifications/v1/acknowledge
Sets a notification's acknowledged flag to true.
Request
Response
Headers
Authorization
required
string
Auth token generated by user login.
Body Parameters
notificationId
required
string
ID of the notification to acknowledge.
200: OK
{ notificationId: 'ccb728ba49c78063a2977a7c084ec2c0d7a21a143b1218b7f5878fab0d047fb1ea35aed1652bdd385119ae78b8acf39b69b77cdb3ebe331f15f8e47050966e9b671f2c700523f4a993f4f9151c38d69ade$021f5d54a38855cb506766175f32d9f0',
text: 'You are super ${{status}}.',
textParameters: { status: 'cool' },
createdDate: '2019-01-31T20:14:32.322Z',
sender: 'ccb728ba49c78063a2977a7c084ec2c0d7a21a143b1216e1f5878fab0d047fb1ea35aed1652bdd385119ae78b8acf39b69b77cdb3ebe331f15f8e47050966e9b671f2c700523f4a993f4f9151c38d69ade$021f5d54a38855cb506766175f32d9f0',
acknowledged: true }