Represents a push notification sent directly from MOCA Console.
A Notification is composed of three components: The trigger, the action and the audience. The action is what is executed when the experience is triggered.
The Notification Object
Name | Type | Obligatory? | Description |
---|---|---|---|
createdAt | long | Autogenerated | Creation date (timestamp UTC). |
updatedAt | long | Autogenerated | Last updated time (timestamp UTC). |
notificationId | string | Autogenerated | Notification identifier. |
campaignId | string | Yes | The campaign id this Notification belongs to. |
config.name | string | Yes | Name of the Notification. |
trigger | Trigger | Yes | Trigger object that defines when the experience is triggered. |
audience | Audience | Yes | Audience object defining the target users of this Notification. |
action | Action | Yes | Action object that defines what happens when the experience is triggered. |
options | object | No | Additional parameters used to define behavior |
status | object | Autogenerated | Current status of the notification. |
Options
The following parameters can be used to modify the behavior of a Notification:
Name | Type | Default value | Description |
---|---|---|---|
draft | boolean | true | Indicates whether the Notification is a draft or if it is ready to be sent to all targeted devices. |
dryRun | boolean | false | Indicates whether the push notification is effectively sent or just simulated. Useful to evaluate if configuration is correct and to see how many users will receive the notification. |
Status
Notifications have a live cycle, composed of the following states:
- Draft: The notification is in edit mode and can be modified as many times as necessary before being sent.
- Pending: The notification has been marked as ready. Our servers will queue the notification once the trigger is evaluated positively.
- Enqueued: The notification is queued and waiting to be sent.
- Sending: The notification is currently being sent to all targeted devices.
- Completed: The notification has been successfully sent.
- Cancelled: The notification was marked as ready, but has since been cancelled. It won't be sent unless it is marked as ready again.
- Failed: There was a problem while sending the notification.
When a notification is being sent, and after it has completed, the following stats are available:
Name | Type | Description |
---|---|---|
status | Status | The current status of the notification. |
execTimeMs | long | The elapsed processing time. Available only after the Notification has been completely sent. |
requestedDevices | int | Number of devices requested. |
processedDevices | int | Number of devices MOCA has correctly identified. |
targetDevices | int | Actual number of devices that the notification is targeted to after discarding uninstalled app instances and expired tokens. |
sentMessages | int | Actual number of messages sent to GCM/APNS. |
{
"createdAt": 1494587968146,
"updatedAt": 1494587968146,
"notificationId": "SFvZPd2CSuu1mUrecUN6Mg",
"appId": "IXa7Bl9oRo6c7zQ5aQIzlg",
"campaignId": "A1d0sNtdQwaMpAKsX99cMQ",
"config": {
"name": "Visit invitation"
},
"trigger": {
"@type": "TimeTrigger",
"time": 1494586642000
},
"audience": {
"type": "Query",
"query": "{ \"$all\": [ { \"lang\": \"en\" }, { \"os\": \"Android\" } ] }"
},
"action": {
"@type": "OpenUrlAction",
"contentType": "text/x-url",
"content": {
"default": "http://www.mocaplatform.com"
},
"bgAlert": {
"default": "Come visit us at MOCA!"
}
},
"options": {
"draft": false
},
"statusReport": {
"status": "Completed",
"execTimeMs": 531,
"requestedDevices": 11,
"processedDevices": 11,
"targetDevices": 11,
"sentMessages": 7
}
}