/unified-push-notifications-server

Unified Push Notifications Server

Primary LanguageJavaScriptMIT LicenseMIT

Unified Push Notifications Service (V1)

Alt Architecture

Requirements:

In progress ...

Client Integration

Registration

Request:

POST /api/v1/subscribers/:id?platform={platform}&service={service_name}&token={push_token}

Response:

Status: 201 Created || 204 No Content

Retrieving Payload

To retrieve a push event payload you should send the ID of the event as a parameter.

Request:

GET /api/v1/events/:id/payload

Response:

Status: 200 OK
{
    "object": "payload",
    "type": "image",
    "payload": {
        "source": "http://lorempixel.com",
        "watermark": "UNIFIED PUSH DELIVERY",
        "category": "animals"
    }
}

Server Integration

Protocol Description

Headers

Type

Defines the type of the notification payload. Allows different resources to be opened via push notifications.

Text

Short text notification message.

Payload

Customer defined protocol, which is directly dependent of the "type" header. Contains additional resources that can be retrieved by the client applications.

Target

Use JSON format for target request param. You can target by following params:

  • services
  • platforms (Valid: ["windows", "ios", "android"])
  • id
  • locale
  • country
  • version

Example: Target all iOS devices from Singapore with application version (less than or equal to 2) or (more than or equal to 4, but less than 5)

{
    "services": ["test", "test123"],
    "platforms": "ios",
    "country": "sg",
    "version": ["<= 2","~> 4"]
}

Send Notification

Create and send push notification

Request:

POST /api/v1/events
Content-Type: application/json
{
    "headers": {
	    "type": "image",
	    "text": "Cool animal pictures!"
    },
    "payload": {
	    "category": "animals",
    	"watermark": "UNIFIED ANIMAL DELIVERY",
	    "source": "http://lorempixel.com"
    },
    "target": {
	    "services": ["test"],
	    "platforms": ["ios", "android", "windows"]
    }
}

Response:

Status: 200 OK
{
    "object": "event",
    "id": "546b46a3277d5802000d09f0"
}

Resend push notification

Request:

POST /api/v1/events/:id

Response:

Status: 200 OK
{
    "object": "event",
    "id": "546b46a3277d5802000d09f0"
}