SendTemplatedPushNotificationToGroup
Sends a notification to a "group" of user based on a brainCloud portal configured notification template. Includes JSON defining the substitution params to use with the template.
See the Portal documentation for more info.
Example of substitution usage:
Message could be You have won a {2} for entering the {1} contest
.
Substitutions parameter would be { "1" : "User Appreciation", "2", "User Appreciation Prize" }
Service | Operation |
---|---|
pushNotification | SEND_TEMPLATED_TO_GROUP |
Method Parameters
Parameter | Description |
---|---|
groupId | The target group. |
senderId | Optional id of sender. |
notificationTemplateId | The template to use. |
substitutions | Map of substitution positions to strings. |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- 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.
var groupId = "group1";
var senderId = "playerId";
var notificationTemplateId = 1;
var substitutions = {
"0": "value0",
"1": "value1"
};
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();
var postResult = pushNotificationProxy.sendTemplatedPushNotificationToGroup(groupId, senderId, notificationTemplateId, substitutions);
if (postResult.status == 200) {
// Success!
}
{
"service": "pushNotification",
"operation": "SEND_TEMPLATED_TO_GROUP",
"data": {
"groupId": "group1",
"senderId": "playerId",
"notificationTemplateId": 1,
"substitutions": {
"0": "value0",
"1": "value1"
}
}
}
JSON Response
{
"packetId": 1,
"messageResponses": [
{
"status": 200,
"data": null
}
]
}