Push Token Reporter

Overview

This web service can be used to report the Push Token to a server, together with other information like application id, account username etc. Push Token is an identifier which can be used to send push notifications to the mobile device via Apple Push Notification Service or Google Cloud Messaging service.

The token will be reported every time the app is newly started.

Push notifications are sent via Acrobits Push Notification Mediator (pnmediator) server. For instructions on how to send pushes, see Push Notifications over HTTP.

Parameters

Parameter templates for Push Token Reporter can use any variables from Global parameters and Account parameters scopes. There are also additional, service-specific parameters for this service:

selector

This parameter uniquely identifies the account. You will need to pass this parameter to pnmediator if you wish to send a push notification which is account specific (for example, a notification about incoming message which comes from this account). The value is a SHA1 hash with a suffix.

Example: 12869E0E6E553673C54F29105A0647204C416A2A:7C3A0D14

pushToken

This is the identifier needed by Apple and Google push notification services to deliver the push to the specific device and app. The value of this parameter will be a base64 - encoded string of variable length.

Configuration

The following Account XML keys are relevant for Push Token Reporter configuration:

pushTokenReporterUrl

Contains the URL, including URL scheme, of the web service, possibly also with query string.

Example (with query-string):

https://example.com/token/?username=%account[username]%&selector=%selector%&token=%pushToken%&appid=%pushappid%

Example (without query-string):

https://example.com/pushToken/%account[username]%/%selector%/%pushToken%&appid=%pushappid%

pushTokenReporterPostData

If filled in, the app will use POST request to report the token

Example ( for application/x-www-form-urlencoded):

username=%account[username]%&selector=%selector%&token=%pushToken%&appid=%pushappid%

Example ( for application/json ):

{ "username" : "%account[username]%", "token" : "%pushToken%", "selector" : "%selector%", "appId": "%pushappid%" }

pushTokenReporterContentType

Specifies the value of Content-Type header to be sent in the request. If not specified, the app will default to application/x-www-form-urlencoded

Response

The response will be considered successful if the HTTP response code is 2xx. Any responses which have other response code are silently ignored, but the request is considered as failed and the app will try to make the request later again.

There are no response values expected, so the body of the response is not parsed or processed in any way.

Examples

GET method

request:

GET /token/?username=johndow&password=12345678&selector=12869E0E6E553673C54F29105A0647204C416A2A:7C3A0D14&token=QVBBOTFiRzlhcVd2bW54bllCWldHOWh4dnRrZ3pUWFNvcGZpdWZ6bWM2dFAzS2J&appid=com.cloudsoftphone.app HTTP/1.1
Host: example.com
Connection: close
Cache-Control: max-age=0
User-Agent: CloudSoftphone/1.5.6

response:

HTTP/1.1 200 OK
Date: Sun, 15 Mar 2015 00:46:17 GMT
Server: Apache/2.4.7 (Ubuntu)
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 0
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive

POST method, JSON

request:

POST /token/johndow/ HTTP/1.1
Host: example.com
Connection: close
Cache-Control: max-age=0
User-Agent: CloudSoftphone/1.5.6
Content-Type: application/json
Content-Length: 183

{
    "token"    : "QVBBOTFiRzlhcVd2bW54bllCWldHOWh4dnRrZ3pUWFNvcGZpdWZ6bWM2dFAzS2J",
    "appid"    : "com.cloudsoftphone.app",
    "selector" : "12869E0E6E553673C54F29105A0647204C416A2A:7C3A0D14"
}

response:

HTTP/1.1 200 OK
Date: Sun, 15 Mar 2015 00:46:17 GMT
Server: Apache/2.4.7 (Ubuntu)
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 0
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive