SendRichPushNotification
Sends a notification to a user based on a brainCloud portal configured notification template.
Service | Operation |
---|---|
pushNotification | SEND_RICH |
Method Parameters
Parameter | Description |
---|---|
toId | The profileId of the user to receive the notification |
notificationTemplateId | Id of the notification template |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string toProfileId = "profile1";
int notificationTemplateId = 1;
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};
_bc.PushNotificationService.SendRichPushNotification(toProfileId, notificationTemplateId, successCallback, failureCallback);
const char *toProfileId = "profile1";
int notificationTemplateId = 1;
_bc->getPushNotificationService()->sendRichPushNotification(toProfileId, notificationTemplateId, this);
NSString *toProfileId = @"profile1";
int notificationTemplateId = 1;
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc pushNotificationService] sendRichPushNotification:toProfileId
notificationTemplateId:notificationTemplateId
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String toProfileId = "profile1";
int notificationTemplateId = 1;
this; // implements IServerCallback
_bc.getPushNotificationService().sendRichPushNotification(toProfileId, notificationTemplateId, this);
public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
System.out.print(String.format("Failed | %d %d %s", statusCode, reasonCode, jsonError.toString()));
}
var toProfileId = "profile1";
var notificationTemplateId = 1;
_bc.pushNotification.sendRichPushNotification(toProfileId, notificationTemplateId, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var toProfileId = "profile1";
var notificationTemplateId = 1;
ServerResponse result = await _bc.pushNotificationService.sendRichPushNotification(profileId:toProfileId, notificationTemplateId:notificationTemplateId);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var toProfileId = "profile1";
var notificationTemplateId = 1;
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();
var postResult = pushNotificationProxy.sendRichPushNotification(toProfileId, notificationTemplateId);
if (postResult.status == 200) {
// Success!
}
{
"service": "pushNotification",
"operation": "SEND_RICH",
"data": {
"toProfileId": "profile1",
"notificationTemplateId": 1,
"substitutions": {
"0": "value0",
"1": "value1"
}
}
}
JSON Response
{
"status": 200,
"data": null
}