Push Message API
The Push Message API is used to send the following types of messages:
- Push notifications - app-related, plain text notifications (as opposed to a Rich messages).
A Push notification is pushed to the device's screen, without the need to open the relevant application.
Push notifications are used to inform the users of app-related events, such as content updates, new messages and other events that may interest them.
Push notifications also allow the app to display a Badge on the app's icon (for example, the number of unread messages).
Note that the user has the option to disable Push Notifications.
- Rich message - app-related messages, whose content is rich (as opposed to a Push notification, whose content is plain text).
A Rich Message is used to engage the user with eye-catching content, such as YouTube videos, HTML messages etc.
Rich Messages are sent to the in-app Inbox, so to enable such messages you must enable the Inbox feature (see Inbox).
Note that users cannot disable Rich messages (as opposed to Push notifications, which users can choose to disable).
All request data must be sent as an HTTPS POST request in the JSON format.
Push Message Request
Request URL
POST
'https://saas.appoxee.com/api/v3/message?finalize=1'.
Request Header
The request header must include the following authentication parameters, used to log into Appoxee:
Name | Value |
---|---|
X-ACCOUNT_CODE | Your Appoxee account code. In case you don't have an account code add your Appoxee user name here as well |
X-USERNAME | Your Appoxee user name. |
X-PASSWORD | Your Appoxee password. |
Request Body
Argument | Description | |
---|---|---|
campaign_id | Mandatory | Specify the campaign this message belongs to in one of the following ways:
|
application_id | Mandatory | Application ID can be found in the dashboard - enter the app settings page and copy the suffix of the URL of that page - this is the application ID |
name | Mandatory | The name of the message you are creating |
description | Mandatory | A description for the message you are creating |
sound | Optional | Specify the name of the sound to be played with the message. To use the default sound file, set this argument to "default". NOTE: If this argument is not specified in the payload, the message will have no sound. |
type | Mandatory | Specify the type of this message by entering one of the following values:
|
frequency | Mandatory for Periodic Messages (type=3) | If the message type is 3 (periodic), you are required to specify the notification frequency:
For example, to send a periodic notification on a weekly basis, use the following arguments:
|
content_type | Mandatory | The type of content included in this notification:
|
inbox_title | Mandatory for Rich Messages (content_type=2 or 3) | The message title displayed in the inbox. |
inbox_description | Mandatory for Rich Messages (content_type=2 or 3) | The message content displayed in the inbox. |
push_body | Mandatory for Push Messages (content_type=1 or 3) | The message body displayed in the push notification. |
push_badge | Optional for Push Messages (content_type=1 or 3) | The number displayed in the push notification badge. when not used no badge will be sent and the badge will remain the same on the device |
schedule_type | Mandatory | Specify when to send the notification:
|
timezone | Mandatory for Time Zone Schedules (schedule_type = 2) | Specify the timezone according to which this notification will be sent. For example, to set the timezone to New York time, use the following syntax: “America/New_York” For a complete list of time zones, see Time Zones. |
overdue | Mandatory for Local Schedules (schedule_type = 1) | Determines how to handle the notification in case it is overdue for the user's local time zone:
|
schedule_date | Mandatory for Local & Time Zone Schedules (schedule_type = 1 or 2) | The date and time on which to send this notification, specified in the UNIX time stamp format. For example: 138490242 |
expire_date | Optional (By default, the message does NOT expire) | The date and time after which this notification expires and must not be sent (by default, a message does NOT expire). If this property is enabled, you are required to specify the expiration date in the UNIX time stamp format. For example: 138490242 Appoxee does not send expired messages. If a message sent by Appoxee expired before the user received it (for example, it the user's device was turned off during the relevant time frame), the Push notification service (APNS for iOS devices and GCM for Android devices) makes sure the expired message is not delivered. |
expire_timezone | Mandatory only when expire_date is set | Specify the timezone according to which this notification will expire. For example, to set the timezone to New York time, use the following syntax: “America/New_York” For a complete list of time zones, see Time Zones. |
content_units | Mandatory for Rich Messages (content_type=2 or 3) | Defines the content of rich text messages as either text (HTML) or a link (URL). This parameter must specify the content of all supported devices (listed in the Application Information page of your Appoxee account). The devices are defined by their size:
|
segments | Optional | A segment groups app users based on different parameters. Segments can include multiple parameters of different types:
You can either use existing segments, or create new ones. To use an existing segment, send its ID. For example: { "segment_id": 243} To create a new segment, you need to define the following attributes:
For a list of the available fields, see Segment Fields For example: { "name": "My Segment", "description": "My first segment", "rules": [ { "field": "appVersion", "operator": "=", "operand": [ "1" ] } ] } This code creates a new segment called “My Segment” that includes all users whose app version number is 1. For information on how to work with segments, see Using Segments / Creating Segment in the Push Message API. NOTE: If this field is not included in the payload, the message is sent to all available users. |
payload | Optional | To add extra fields to a push message use this field as follows: "payload" : { "custom_key1" : "custom_value1" , "custom_key2" : "custom_value2" , } |
Example Request
{ "campaign_id": 1 (existing campaign id), "application_id": 1, "sound": "", "name": "", "description": "", "type": 0, "content_type": 1, "inbox_title": "title", "inbox_description": "description", "push_body": "body", "push_badge": 1, "schedule_type":0, "timezone": "Asia/Jerusalem", "overdue": 0, "schedule_date": 1345645282, "expire_date" : 1645645282, "content_units": [ { "size": "iphone4", "body": "[html code]" },(second value is “body or “url”) { "size": "iphone5", "url": "http://yahoo.com" }, (second value is “body or “url”) { "size": "ipad", "url": "http://google.com" } (second value is “body or “url”) ], "segments": (optional - can send the id of an existing segment or create a new one or both) [ { "name": "My Segment", "description": "My first segment", "rules": [ { "field": "appVersion", "operator": "=", "operand": [ "2.44" ], "case_sensitive": 1 }, { "field": "osNumber", "operator": "=", "operand": [ "8.0", "8.01" ] } ] }, { "name": "Another Segment ", "description": "My first segment", "rules": [ { "field": "appVersion", "operator": "=", "operand": [ "2.44" ], "case_sensitive": 1 }, { "field": "osNumber", "operator": ">", "operand": [ "5.1" ] } ] }, { "segment_id": 243 }, { "segment_id": 319 } ] }
{ "campaign_id":"161156", "application_id":"103012", "sound":"default", "name":"Test name", "description":"Test description", "type":0, "content_type":1, "push_body":"Test message (body)", "push_badge":1, "schedule_type":0, "segments":[ { "name":"Segment A", "description":"My A segment", "rules":[ {"field":"alias", "operator":"=", "operand":["66473138"]} ] }], "payload":{"apx_dpl":"myapp://product/4", "banner":"1234"} }
Response
HTTP Response Header
HTTP Header Field | Value |
---|---|
Status Code |
|
HTTP Response Body
The response body includes a description of the request result in JSON format.
The API call has one of the following results:
Response Result | Returns | Example |
---|---|---|
metadata | Contains the "error" parameter:
| { "error": "false" } |
payload | The properties of the new message object created by this Push request. Use the "id" value to access the message object in the following location: | "payload": |