Using Segments / Creating Segment in the Push Message API
The Segment feature groups app users based on different parameters.
You can use segments in Push notifications to target the relevant users out of all available users.
Segments can include multiple parameters of different types:
- Application-specific (Tags and Aliases)
- Behavioral (such as "Last Activation" or "Number of products purchased")
- Platform/Devices (such as SDK Version or App Version)
- Regional Settings (Location, Language or Time Zone).
The Push Message API gives you the option to send notifications to relevant user segments, by adding the "segment" field to the payload (otherwise, the message is sent to all available users).
You can either use existing segments, or create new ones.
Using an Existing Segment
To send a notification to an existing segment, simply specify its ID. For example:{ "segment_id": 243}
The segment ID appears at the end of the segment URL: https://engage.appoxee.com/segment/form/{segment id}
To view the segment URL, go to your Appoxee account, select the relevant segment and click Edit.
Creating a New Segment
To create a new segment, define the following attributes:
- name - for example, "Active Users".
- description - for example, "Users who opened the app at least once".
rule(s) – each segment is defined by one or more rules. A rule consists of a field, an operator and an operand.
The following example shows a segment rule that targets users who activated the app at least once:{ "field": " numActivations ", "operator": ">=", "operand": [1] })
The following section, "Creating a Segment Rule", describes the available segment fields, operators and operands you can use to create segment rules.
Request URL
POST
' https://saas.appoxee.com/api/segment'.
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. |
Creating a Segment Rule
To create a segment rule, use the fields, operators and operands listed in the following table:
Field | Operator(s) | Example Operand(s) | Type | Comments |
---|---|---|---|---|
alias | = | ["aliasA","aliasB","aliasC"] | string | The user's unique alias, shared by all the user's devices. |
numActivations | != | ["2"] | integer | The number of times you app was activated (opened) on this device. |
numPurchases | != | ["2"] | integer | The number of purchases made through your app on this device. |
appVersion | != | ["1.0"] | double | The version number of your app installed on the device. |
tags | != | ["tagA","tagB","tagC"] | string | The local tag list, which is specific to each device. |
osNumber | >=< | ["1.5","2.2"] | range | The version number of the Operating System installed on the device. |
size | != | ["1","4","3"] | integer | The size of the devices running your app. Possible sizes are:
|
clientVersion | >=< | ["2.0","3.0"] | range | The client version. |
country | != | [["US","IL","Chicago"]] | array | The device location, in any of the following formats:
|
locale (Also applies to | != | ["en"] | string | The device locale. |
timeZone | != | ["America/New_York"] | string | The device time zone. For a complete list of time zones, see Time Zones. |
regAt | <= > | ["30"] | integer | The number of days that passed since your app was registered on this device. |
lastActiv (Also applies to | <= > | ["30"] | integer | The number of days that passed since your app was last opened on this device. |
Example Request : App version = (android and (osNumber is 3.0 or 2.0)
{ "application_id":"103542", "name": "My Segment", "description": "My first segment", "rules": [ { "field": "appVersion", "operator": "=", "operand": [ "android" ], "case_sensitive": 1 }, { "field": "osNumber", "operator": ">", "operand": [ "3.0", "2.0" ] } ] }
Example : Where alias = yotam or mor
{ "application_id": "1234", "name":"Segment alias is mor or yotam", "rules":[ { "field": "alias ", "operator": "=", "operand": ["mor","yotam"] } ] }
Number of Aliases supported
Please note that we support up to 1000 aliases in a single call