Push Notifications

The MOTAR API can be used to send mobile push notifications. Make sure you have enabled and configured push notifications in MOTAR 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!

Create Notification

PUT https://api.motar.io/notifications/v1

Sends a Push Notification to a user.

Headers

NameTypeDescription

Authorization

string

Auth token generated by user login.

Request Body

NameTypeDescription

path

string

Can be specified to direct the app to open a specific view when the notification is open.

textParameters

string

Inserts dynamic strings into a notification's text.

persist

string

Determines whether the resulting notification is saved on the AFCreate servers to be returned in a user's notification list.

receiver

string

User ID of the notification recipient.

text

string

Text of the notification.

Register for Notifications

PUT https://api.motar.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.

Headers

NameTypeDescription

Authorization

string

Auth token generated by user login.

Request Body

NameTypeDescription

deviceToken

string

IOS or Android device token.

refreshToken

string

Refresh token of the session the user wishes to register for push notifications.

{
    "success": true
}

Get List of Notifications

GET https://api.motar.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.

Query Parameters

NameTypeDescription

acknowledge

boolean

Whether or not to return acknowledge notifications.

limit

integer

Page size to return.

page

integer

Page number to return.

since

string

Date string, return all notifications created after this date.

Headers

NameTypeDescription

Authorization

string

Auth token generated by user login.

{ 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 }

Acknowledge a Notification

POST https://api.motar.io/notifications/v1/acknowledge

Sets a notifications acknowledge flag to true.

Headers

NameTypeDescription

Authorization

string

Auth token generated by user login.

Request Body

NameTypeDescription

notificationId

string

ID of the notification to acknowledge.

{ notificationId: 'ccb728ba49c78063a2977a7c084ec2c0d7a21a143b1218b7f5878fab0d047fb1ea35aed1652bdd385119ae78b8acf39b69b77cdb3ebe331f15f8e47050966e9b671f2c700523f4a993f4f9151c38d69ade$021f5d54a38855cb506766175f32d9f0',
  text: 'You are super ${{status}}.',
  textParameters: { status: 'cool' },
  createdDate: '2019-01-31T20:14:32.322Z',
  sender: 'ccb728ba49c78063a2977a7c084ec2c0d7a21a143b1216e1f5878fab0d047fb1ea35aed1652bdd385119ae78b8acf39b69b77cdb3ebe331f15f8e47050966e9b671f2c700523f4a993f4f9151c38d69ade$021f5d54a38855cb506766175f32d9f0',
  acknowledged: true }

Last updated