SendRawPushToCustomQuery
Sends a push to users based on custom collection query and the profileIdField storing the user's brainCloud profile Id.
| Service | Operation |
|---|---|
| pushNotification | SEND_RAW_PUSH_TO_CUSTOM_QUERY |
Method Parameters
| Parameter | Description |
|---|---|
| customEntityType | Entity type identifying the applicable custom collection. |
| customQueryJson | JSON query to be applied to the custom collection. |
| profileIdField | Name of field in custom collection that contains the user's brainCloud profile Id. For owned custom collections, this would be ownerId, but for unowned custom collections this would be something like data.bcProfileId. |
| contentJson | JSON containing applicable fcmContent, iosContent and/or facebookContent. At least one is required. |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
var customEntityType = "athletes";
var customQueryJson = {
"data.totalGoals": {
"$gte": 10
}
};
var profileIdField = "ownerId";
var contentJson = {
"fcmContent": {
"notification": {
"body": "content of message",
"title": "message title"
},
"data": {
"customfield1": "customValue1",
"customfield2": "customValue2"
},
"priority": "normal"
},
"iosContent": {
"aps": {
"alert": {
"body": "content of message",
"title": "message title"
},
"badge": 0,
"sound": "gggg"
}
},
"facebookContent": {
"template": "content of message"
}
};
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();
var postResult = pushNotificationProxy.sendRawPushToCustomQuery(customEntityType, customQueryJson, profileIdField, contentJson);
if (postResult.status == 200) {
// Success!
}
{
"service": "pushNotification",
"operation": "SEND_RAW_PUSH_TO_CUSTOM_QUERY",
"data":
{
"customEntityType": "athletes",
"customQueryJson": {
"data.totalGoals": {
"$gte": 10
}
},
"profileIdField": "ownerId",
"contentJson": {
"fcmContent": {
"notification": {
"body": "content of message",
"title": "message title"
},
"data": {
"customfield1": "customValue1",
"customfield2": "customValue2"
},
"priority": "normal"
},
"iosContent": {
"aps": {
"alert": {
"body": "content of message",
"title": "message title"
},
"badge": 0,
"sound": "gggg"
}
},
"facebookContent": {
"template": "content of message"
}
}
}
}
JSON Response
{
"status": 200,
"data": {}
}