send

PushNotification.send(pushAPIKey, messageData)

Parameters

This method has the following parameters:

Argument

Description

pushApiKey

String with unique key, issued by server.

messageData

Notification message data object.

Examples

The following example sends a Push Notification to all devices:

Apperyio.PN.send("ffbe3bb4-3ea0-4ee6-b9db-587e43cfdb31", {
    payload:    {
        "message": "Notification sample",
    },
});
The following examples send a Push Notification to all devices and also includes custom data:
Apperyio.PN.send("ffbe3bb4-3ea0-4ee6-b9db-587e43cfdb31", {
    payload:    {
        "message": "Notification sample",
        "customData": {"name1":"value1", "name2":"value2"}
    },
});
The following example sends push notifications to the devices using channels. Badge (iOS parameter only) is specified.
Apperyio.PN.send("ffbe3bb4-3ea0-4ee6-b9db-587e43cfdb31", {
    payload:    {
        "message": "Notification sample",
        "badge": 1
    }, 
    filter: {"channels": {"$in":[1,2]}},
    schedule: {
        scheduledTime: 1484870400000,
        // Use timeZone or userDeviceTimeZone but not both
        timeZone: 120
        //useDeviceTimeZone:true
    }
});