Chapter 6. $fh.push
$fh.push(message, options, callback(err, res))
Send a push message from the cloud to registered clients.
6.1. Example
Push a message to all devices in all client apps of the associated project
var message = {
alert: "hello from FH"
}, options = {
broadcast: true
};
$fh.push(message, options,
function (err, res) {
if (err) {
console.log(err.toString());
} else {
console.log("status : " + res.status);
}
});
Push a message for specific deviceType in a specific client app
var message = {
alert: "hello from FH"
},
options = {
apps: ["3uzl1ebi6utciy56majgqlj8"], // list of App IDs
criteria: {
deviceType: "android"
}
};
$fh.push(message, options,
function (err, res) {
if (err) {
console.log(err.toString());
} else {
console.log("status : " + res.status);
}
});
6.2. Parameters
6.2.1. Notification
messageObject-
alertString — The main message -
soundString — (iOS only) The name of a sound file in the app bundle, ordefault -
badgeString — The number to display as the badge of the app icon -
userDataObject — Any extra user data to be passed
-
6.2.2. iOS-specific
message.apnsObject — Options specific to the Apple Push Notification Service-
titleString — A short string describing the purpose of the notification -
actionString — The label of the action button -
urlArgsArray — (Safari only) Values that are paired with the placeholders inside the urlFormatString value of your website.json file -
titleLocKeyString — (iOS only) The key to a title string in the Localizable.strings file for the current localization -
titleLocArgsArray — (iOS only) Variable string values to appear in place of the format specifiers in title-loc-key -
actionCategoryString — The identifier of the action category for the interactive notification -
contentAvailableNumber — (iOS only) Informs the application that new content is available by delivering a silent notification. The only possible value is1.
-
6.2.3. Windows-specific
message.windowsObject — Options specific to the Windows platform (Windows Notification Service and Microsoft Push Notification Service)-
typeString — The type of message to send. Possible values:toast,raw,badgeortile. -
durationString — Duration a Toast message is displayed. Possible values:longorshort. -
badgeString — The glyph to use as the notification badge, instead of a number. Possible values:none,activity,alert,available,away,busy,newMessage,paused,playing,unavailable,errororattention. For more information on badge types, see official documentation. For numeric values, use themessage.badgeparameter. -
tileTypeString — The tile template, for example,TileSquareText02orTileWideBlockAndText02. See the tile template catalog for all possible values. -
imagesArray — List of images displayed on tiles. Either a path to a local file (for example,Assets/image.png) or a URL (for example,http://host/image.png). The number of elements needs to match the number of images required by the chosen tileType. -
textFieldsArray — List of texts displayed on tiles. The number of elements needs to match the number of text fields required by the chosen tileType.
-
6.2.4. Other configuration
-
optionsObject options.configObject-
ttlNumber — (APNS and GCM only) The time to live in seconds.
-
6.2.5. Selection of client apps in project
One of the options — broadcast or apps — must be set manually, there is no default value.
-
options.broadcastBoolean — when set totrue, notification will be sent to all client apps in the project which contains the sending cloud app -
options.appsArray — list of client app IDs to send the notification to
6.2.6. Filtering recipients
options.criteriaObject — Criteria for selection of notification recipients.
See Sending Notifications for details about these criteria.-
aliasArray — list of user-specific identifiers -
categoriesArray — list of categories -
deviceTypeArray — list of device types -
variantsArray — list of variant IDs
-
6.2.7. Response handling
-
callback(err, res)Function — callback invoked after the message is pushed to the integrated push server. Iferris set, it contains any possible error response. Parameterrescontains the normal server response.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.