Push Notifications over HTTP¶
The HTTP gateway for pushes allows you to send Push Notifications directly. It accepts POST requests and formats a message that is then transferred to Acrobits’s Push Notification Mediator Service and then to the device.
The address of the gateway is https://pnm.cloudsoftphone.com/pnm2. It accepts only HTTP POST requests and expects application/x-www-form-urlencoded body type. In the POST requests it accepts the following parameters.
Required parameters are verb, AppId, DeviceToken. Leaving any of these parameters out will produce a HTTP 400 error.
- Type of the message. The most important one is NotifyTextMessage and NotifyGenericTextMessage. See Message Types and additional parameters for more information.
- Application ID. This parameter is required
- Identifies the device that will receive the Push. This parameter is required.
You need to properly urlencode the values. For example if your DeviceToken contains plus (+) you need to replace it with %2B.
This message type is used to notify user about incoming messages. It notifies the app that there are new messages available for fetching using the Fetch Messages. When the app receives this type of push message, it runs the fetch web service in the background and when the new messages are fetched, the notification about them is presented to user.
This verb needs additional parameter Selector which identifies the user’s account. It is reported in the same way as DeviceToken.
The simplest message type which is used to show a text notification to user. The app doesn’t process this message in other way other than displaying the text on screen. This can be used for various marketing messages, reminders etc.
The additional parameter Message contains the text to be displayed. See the example below.
Send a simple text notification:
wget https://pnm.cloudsoftphone.com/pnm2 --post-data="verb=NotifyGenericTextMessage&Message=Hello%20World&DeviceToken=QVBBOTFiSEQ0KX05PclRXZXlRdTVaNUJXT3BZVmpBMmxR&AppId=cz.acrobits.softphone.cloudphone" -O -
Send NotifyTextMessage notification to let the app know about new incoming messages:
wget https://pnm.cloudsoftphone.com/pnm2 --post-data="verb=NotifyTextMessage&DeviceToken=LA7U4xm7MqZCVqFPhf4Dz2sILOJ9iVGh0eeTBOyKDRs=&AppId=com.cloudsoftphone.app" -O -