SendRawToSegments
This operation sends a raw message to targetted segments.
Results
| Name | Description |
|---|---|
| estimatedTargets | Estimate number of targeted users |
| Service | Operation |
|---|---|
| pushNotification | SEND_RAW_TO_SEGMENTS |
Method Parameters
| Parameter | Description |
|---|---|
| segmentCodeList | List of target segment codes. Omit to send to all users. |
| segmentIdList | Deprecated: list of target segment ids. Use segmentCodeList instead. |
| fcmContent | FCM dependent message content. |
| iosContent | IOS dependent message content. |
| facebookContent | Facebook dependent message content. |
warning
segmentIdList is deprecated. Use segmentCodeList instead. Segment ids are assigned separately in each environment, so the same id can refer to a different segment after an app is copied or promoted, and new apps reject segment ids in cloud code.
Usage
http://localhost:3000
- C#
- C++
- Obj-C
- Java
- JavaScript
- Dart
- Roblox
- GDScript
- Lua
- Cloud Code
- Raw
// S2S call: to view example, switch to the Cloud Code or Raw tab.
// S2S call: to view example, switch to the Cloud Code or Raw tab.
// S2S call: to view example, switch to the Cloud Code or Raw tab.
// S2S call: to view example, switch to the Cloud Code or Raw tab.
// S2S call: to view example, switch to the Cloud Code or Raw tab.
// S2S call: to view example, switch to the Cloud Code or Raw tab.
-- N/A
N/A
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
var fcmContent = {
"notification": {
"body": "content of message",
"title": "message title"
},
"data": {
"customfield1": "customValue1",
"customfield2": "customValue2"
},
"priority": "normal"
};
var iosContent = {
"aps": {
"alert": {
"body": "content of message",
"title": "message title"
},
"badge": 0,
"sound": "gggg"
}
};
var facebookContent = {
"template": "content of message"
};
var segments = [
"high_spenders",
"lapsed_30d"
];
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();
var postResult = pushNotificationProxy.sendRawToSegments(fcmContent, iosContent, facebookContent, segments);
if (postResult.status == 200) {
// Success!
}
{
"service": "pushNotification",
"operation": "SEND_RAW_TO_SEGMENTS",
"data": {
"segmentCodeList": [
"high_spenders",
"lapsed_30d"
],
"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
{
"packetId": 1,
"messageResponses": [
{
"data": {
"estimatedTargets": 1234
},
"status": 200
}
]
}