ScheduleNormalizedPushNotificationMinutes
Schedules a normalized push notification to a user at a future relative time.
Service | Operation |
---|---|
pushNotification | SCHEDULE_NORMALIZED_NOTIFICATION |
Method Parameters
Parameter | Description |
---|---|
profileId | Identifies the user to send to |
alertContent | Body and title of alert |
customData | Optional custom data |
minutesFromNow | Minutes in the future to send notification |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string profileId = "kjhkjhgfkjshgkjh";
string alertContentJson = "{\"body\":\"content of message\",\"title\":\"message title\"}";
string customDataJson = "{\"field1\":\"value1\",\"field2\":\"value2\"}";
int minutesFromNow = 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.ScheduleNormalizedPushNotificationMinutes(profileId, alertContentJson, customDataJson, minutesFromNow, successCallback, failureCallback);
const char *profileId = "kjhkjhgfkjshgkjh";
const char *alertContentJson = "{\"body\":\"content of message\",\"title\":\"message title\"}";
const char *customDataJson = "{\"field1\":\"value1\",\"field2\":\"value2\"}";
int minutesFromNow = 1;
_bc->getPushNotificationService()->scheduleNormalizedPushNotificationMinutes(profileId, alertContentJson, customDataJson, minutesFromNow, this);
NSString *profileId = @"kjhkjhgfkjshgkjh";
NSString *alertContentJson = @"{\"body\":\"content of message\",\"title\":\"message title\"}";
NSString *customDataJson = @"{\"field1\":\"value1\",\"field2\":\"value2\"}";
int minutesFromNow = 1;
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc pushNotificationService] scheduleNormalizedPushNotificationMinutes:profileId
alertContentJson:alertContentJson
customDataJson:customDataJson
minutesFromNow:minutesFromNow
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String profileId = "kjhkjhgfkjshgkjh";
String alertContentJson = "{\"body\":\"content of message\",\"title\":\"message title\"}";
String customDataJson = "{\"field1\":\"value1\",\"field2\":\"value2\"}";
int minutesFromNow = 1;
this; // implements IServerCallback
_bc.getPushNotificationService().scheduleNormalizedPushNotificationMinutes(profileId, alertContentJson, customDataJson, minutesFromNow, 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 profileId = "kjhkjhgfkjshgkjh";
var alertContentJson = {
"body": "content of message",
"title": "message title"
};
var customDataJson = {
"field1": "value1",
"field2": "value2"
};
var minutesFromNow = 1;
_bc.pushNotification.scheduleNormalizedPushNotificationMinutes(profileId, alertContentJson, customDataJson, minutesFromNow, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var profileId = "kjhkjhgfkjshgkjh";
var alertContentJson = {
"body": "content of message",
"title": "message title"
};
var customDataJson = {
"field1": "value1",
"field2": "value2"
};
var minutesFromNow = 1;
ServerResponse result = await _bc.pushNotificationService.scheduleNormalizedPushNotificationMinutes(profileId:profileId, alertConten:alertContentJson, customData:customDataJson, minutesFromNow:minutesFromNow);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var profileId = "kjhkjhgfkjshgkjh";
var alertContentJson = {
"body": "content of message",
"title": "message title"
};
var customDataJson = {
"field1": "value1",
"field2": "value2"
};
var minutesFromNow = 1;
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();
var postResult = pushNotificationProxy.scheduleNormalizedPushNotificationMinutes(profileId, alertContentJson, customDataJson, minutesFromNow);
if (postResult.status == 200) {
// Success!
}
{
"service": "pushNotification",
"operation": "SCHEDULE_NORMALIZED_NOTIFICATION",
"data": {
"profileId": "kjhkjhgfkjshgkjh",
"alertContent": {
"body": "content of message",
"title": "message title"
},
"customData": {
"field1": "value1",
"field2": "value2"
},
"startDateUTC": "[[#ts+60000]]"
}
}