Constants

all

all

Select all, to do a broadcast.

Used in both audience and deviceTypes.

AUTOBADGE_FORMAT

AUTOBADGE_FORMAT

DEVICE_TOKEN_FORMAT

DEVICE_TOKEN_FORMAT

PIN_FORMAT

PIN_FORMAT

UUID_FORMAT

UUID_FORMAT

Functions

absoluteDate()

absoluteDate(  $resolution,   $start,   $end) : array

Produces a time specifier that represents an absolute amount of time, such as from 2012-01-01 12:00 to 2012-01-01 12:00

Parameters

$resolution

string Valid time resolution

$start

string Beginning of absolute window

$end

string End of absolute window

Throws

\InvalidArgumentException

Returns

array

acceptableResolution()

acceptableResolution(  $resolution) : boolean

Checks to see if the supplied resolution matches an allowable resolution Allowed resolutions:

minutes hours days weeks months years

Parameters

$resolution

Returns

boolean

alias()

alias(string  $alias) 

Select a single alias.

Parameters

string $alias

amazon()

amazon(  $alert = null,   $consolidation_key = null,   $expires_after = null,   $title = null,   $summary = null,   $extra = null,   $style = null,   $sound = null) : array

Amazon specific platform override payload.

Parameters

$alert

string: Amazon format alert.

$consolidation_key

string: Similar to GCM’s collapse_key.

$expires_after

int: An integer value indicating the number of seconds that ADM will retain the message if the device is offline. The valid range is 60 - 2678400 (1 minute to 31 days), inclusive. Can also be an absolute ISO UTC timestamp, in which case the same validation rules apply, with the time period calculated relative to the time of the API call.

$title

string: Title of the notification.

$summary

string: Summary of the notification.

$extra

array: A set of key/value pairs to include in the push payload sent to the device.

$style

array: Android/Amazon advanced styles.

$sound

string: A sound file name included in the application’s resources.

Returns

array

amazonChannel()

amazonChannel(  $uuid) : array

Select a single Amazon Channel

Parameters

$uuid

Throws

\InvalidArgumentException

Returns

array

and_()

and_() 

Select an audience that matches all of the given selectors.

Pass in any number of selectors as arguments.

android()

android(  $alert = null,   $collapseKey = null,   $timeToLive = null,   $deliveryPriority = null,   $delayWhileIdle = null,   $extra = null,   $style = null,   $title = null,   $summary = null,   $sound = null,   $priority = null,   $category = null,   $visibility = null,   $publicNotification = null,   $localOnly = false,   $wearable = null) : array

Android specific platform override payload.

Parameters

$alert

string: Android format alert.

$collapseKey

string

$timeToLive

int|string: Specifies the expiration time for the message.

$deliveryPriority

string: Defaults to normal if not provided. Sets the GCM priority.

$delayWhileIdle

boolen

$extra

array: A set of key/value pairs to include in the push payload sent to the device.

$style

array: Android/Amazon advanced styles.

$title

string: Title of the notification.

$summary

string: Summary of the notification.

$sound

string: A sound file name included in the application’s resources.

$priority

int: In the range from -2 to 2, inclusive. Used to help determine notification sort order.

$category

string: Optional string from the following list: "alarm", "call", "email", "err", "event", "msg", "promo", "recommendation", "service", "social", "status", "sys", and "transport". It is used to help determine notification sort order.

$visibility

int: Optional integer in the range from -1 to 1 inclusive.

$publicNotification

Object: A notification to show on the lock screen instead of the redacted one.

$localOnly
$wearable

Object

Returns

array

androidChannel()

androidChannel(  $uuid) : array

Select a single Android Channel

Parameters

$uuid

Throws

\InvalidArgumentException

Returns

array

apid()

apid(  $uuid) : array

Select a single Android APID

Parameters

$uuid

Throws

\InvalidArgumentException

Returns

array

deviceToken()

deviceToken(string  $token) : array

Select a single iOS device token

Parameters

string $token

Throws

\InvalidArgumentException

Returns

array

deviceTypes()

deviceTypes() : array

Device Type specifier.

Throws

\InvalidArgumentException

Returns

array

inAppMessage()

inAppMessage(  $alert,   $displayType,   $expiry = null,   $display = null,   $actions = null,   $interactive = null,   $extra = null) : array

In-App Message object

Parameters

$alert
$displayType
$expiry
$display
$actions
$interactive
$extra

Returns

array

ios()

ios(  $alert = null,   $badge = null,   $sound = null,   $contentAvailable = false,   $extra = null,   $expiry = null,   $priority = null,   $category = null,   $interactive = null,   $mutableContent = false,   $mediaAttachment = null,   $title = null,   $subtitle = null,   $collapseId = null) : array

iOS/APNS specific platform override payload.

Parameters

$alert

string|array: iOS format alert.

$badge

int|string: An integer badge value or an autobadge string.

$sound

string: A sound file to play.

$contentAvailable

bool: If true, pass on the content_available command for Newsstand iOS applications.

$extra

array: A set of key/value pairs to include in the push payload sent to the device.

$expiry

int|string: The expiry time for APNS to cease trying to deliver a push.

$priority

int: Sets the APNS priority of the delivery.

$category

string: Sets the APNs category for the push.

$interactive

Object: Conforms to the standard interactive object specifications.

$mutableContent

boolean: When set to true, content may be modified by an extension.

$mediaAttachment

JSON: Specifies a media attachment to be handled by the UA Media Attachment Extension.

$title

string: Sets the title of the notification.

$subtitle

string: Displays below the title of the notification.

$collapseId

Throws

\InvalidArgumentException

for invalid values.

Returns

array

iosChannel()

iosChannel(  $uuid) : array

Select a single iOS Channel

Parameters

$uuid

Throws

\InvalidArgumentException

Returns

array

location()

location(  $date, array  $locationOpts) : array

Select a location expression.

Location expressions are made up of either an id or an alias and a time period specifier. Use one of the date specifier functions to return a properly formatted time specifier

Parameters

$date

A date range specifier, created by either recentDate or absoluteDate.

array $locationOpts

An array containing either id and value, or an alias and value, e.g. array("id"=>"4oFkxX7RcUdirjtaenEQIV") or array("us_zip": "94103").

Returns

array

message()

message(  $title,   $body,   $content_type = null,   $content_encoding = null,   $expiry = null,   $extra = null,   $icons = null) : array

Message Center Object

Parameters

$title

string

$body

string

$content_type

string: A string denoting the MIME type of the data in body.

$content_encoding

string: A string denoting encoding type of the data in body. For example, utf-8 or base64.

$expiry

int|timestamp: The expiry time for a rich app page to delete a message from the user’s inbox. Can be an integer encoding number of seconds from now, or an absolute timestamp in ISO UTC format. An integer value of 0 is equivalent to no expiry set.

$extra

string: A JSON dictionary of string values. Values for each entry may only be strings. If an API user wishes to pass structured data in an extra key, it must be properly JSON-encoded as a string.

$icons

string: JSON dictionary of string key and value pairs. At this time, only one key, "list_icon", is supported. Values must be URI/URLs to the icon resources. For resources hosted by UA, use the following URI format ua:<resource-id>. For example: "icons" : { "list_icon" : "ua:9bf2f510-050e-11e3-9446-14dae95134d2" }

Returns

array

mpns()

mpns(  $uuid) : array

Select a single Windows Phone 8 APID

Parameters

$uuid

Throws

\InvalidArgumentException

Returns

array

mpnsPayload()

mpnsPayload(  $alert = null,   $toast = null,   $tile = null) : array

MPNS specific platform override payload.

Must include exactly one of alert, toast, or tile.

Parameters

$alert
$toast
$tile

Throws

\InvalidArgumentException

Returns

array

namedUser()

namedUser(string  $namedUser) 

Select a single named user.

Parameters

string $namedUser

not_()

not_(  $child) 

Select audience members that do not match the given selector.

Parameters

$child

notification()

notification(  $alert,   $overrides = array()) : array

Creates a notification payload.

Parameters

$alert

string Global alert for all device types. Use null for no alert.

$overrides

array Optional array of platform overrides.

Throws

\InvalidArgumentException

If result payload is empty.

Returns

array

or_()

or_() 

Select an audience that matches one of the given selectors.

Pass in any number of selectors as arguments.

recentDate()

recentDate(  $resolution,   $lengthOfTime) : array

Produces a time specifier that represents relative amount of time, such as "the past three days"

Parameters

$resolution

string Valid time resolution, e.g. minutes or weeks.

$lengthOfTime

string Amount of time

Throws

\InvalidArgumentException

If the resolution is not recognized

Returns

array

scheduledTime()

scheduledTime(  $target) 

Parameters

$target

segment()

segment(string  $segment) 

Select a single segment.

Parameters

string $segment

tag()

tag(string  $tag) 

Select a single tag.

Parameters

string $tag

wns()

wns(  $uuid) : array

Select a single Windows 8 APID

Parameters

$uuid

Throws

\InvalidArgumentException

Returns

array

wnsPayload()

wnsPayload(  $alert = null,   $toast = null,   $tile = null,   $badge = null) : array

WNS specific platform override payload.

Must include exactly one of alert, toast, tile, or badge.

Parameters

$alert
$toast
$tile
$badge

Throws

\InvalidArgumentException

Returns

array