Log In

Overview

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

NameTypeObligatory?Description
createdAtlongAutogeneratedCreation date (timestamp UTC).
updatedAtlongAutogeneratedLast updated time (timestamp UTC).
notificationIdstringAutogeneratedNotification identifier.
campaignIdstringYesThe campaign id this Notification belongs to.
config.namestringYesName of the Notification.
triggerTriggerYesTrigger object that defines when the experience is triggered.
audienceAudienceYesAudience object defining the target users of this Notification.
actionActionYesAction object that defines what happens when the experience is triggered.
optionsobjectNoAdditional parameters used to define behavior
statusobjectAutogeneratedCurrent status of the notification.

Options

The following parameters can be used to modify the behavior of a Notification:

NameTypeDefault valueDescription
draftbooleantrueIndicates whether the Notification is a draft or if it is ready to be sent to all targeted devices.
dryRunbooleanfalseIndicates 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:

NameTypeDescription
statusStatusThe current status of the notification.
execTimeMslongThe elapsed processing time. Available only after the Notification has been completely sent.
requestedDevicesintNumber of devices requested.
processedDevicesintNumber of devices MOCA has correctly identified.
targetDevicesintActual number of devices that the notification is targeted to after discarding uninstalled app instances and expired tokens.
sentMessagesintActual 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
  }
}