<!-- source: docs/api/2_capi/pushnotification/deregisterallpushnotificationdevicetokens.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/pushnotification/deregisterallpushnotificationdevicetokens -->

# DeregisterAllPushNotificationDeviceTokens

Clears the device tokens currently registered to the user.

| Service | Operation |
| ------- | --------- |
| pushNotification | DEREGISTER_ALL |

## Usage

**C#:**

```csharp
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.DeregisterAllPushNotificationDeviceTokens(successCallback, failureCallback);
```

**C++:**

```cpp
_bc->getPushNotificationService()->deregisterAllPushNotificationDeviceTokens(this);
```

**Obj-C:**

```objectivec
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc pushNotificationService] deregisterAllPushNotificationDeviceTokens:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
this; // implements IServerCallback

_bc.getPushNotificationService().deregisterAllPushNotificationDeviceTokens(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()));
}
```

**JavaScript:**

```javascript

_bc.pushNotification.deregisterAllPushNotificationDeviceTokens(result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart

ServerResponse result = await _bc.pushNotificationService.deregisterAllPushNotificationDeviceTokens();

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:deregisterAllPushNotificationDeviceTokens(callback)
```

**GDScript:**

```gdscript
var result = await _bc.push_notification_service.deregister_all_push_notification_device_tokens()

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:deregisterAllPushNotificationDeviceTokens(callback)
```

**Cloud Code:**

```cfscript
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.deregisterAllPushNotificationDeviceTokens();
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "DEREGISTER_ALL",
    "data": {}
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "status": 200,
    "data": null
}
```
</details>


---

<!-- source: docs/api/2_capi/pushnotification/deregisterpushnotificationdevicetoken.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/pushnotification/deregisterpushnotificationdevicetoken -->

# DeregisterPushNotificationDeviceToken

Deregisters the given device token from the server to disable this device from receiving push notifications.

| Service | Operation |
| ------- | --------- |
| pushNotification | DEREGISTER |

## Method Parameters

| Parameter | Description                                                        |
| --------- | ------------------------------------------------------------------ |
| device    | The device platform being deregistered.                            |
| token     | The platform-dependant device token needed for push notifications. |

## Usage

**C#:**

```csharp
Platform deviceType = Platform.iOS;
string deviceToken = "12345";
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.DeregisterPushNotificationDeviceToken(deviceType, deviceToken, successCallback, failureCallback);
```

**C++:**

```cpp
Platform deviceType = Platform::iOS;
const char *deviceToken = "12345";
_bc->getPushNotificationService()->deregisterPushNotificationDeviceToken(deviceType, deviceToken, this);
```

**Obj-C:**

```objectivec
PlatformObjc *deviceType = [PlatformObjc iOS];
NSString *deviceToken = @"12345";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc pushNotificationService] deregisterPushNotificationDeviceToken:deviceType
                deviceToken:deviceToken
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
Platform deviceType = Platform.iOS;
String deviceToken = "12345";
this; // implements IServerCallback

_bc.getPushNotificationService().deregisterPushNotificationDeviceToken(deviceType, deviceToken, 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()));
}
```

**JavaScript:**

```javascript
var deviceType = "IOS";
var deviceToken = "12345";

_bc.pushNotification.deregisterPushNotificationDeviceToken(deviceType, deviceToken, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  platform = PlatformID.iOS;
var  deviceToken = "12345";
​
ServerResponse result = await _bc.pushNotificationService.deregisterPushNotificationDeviceToken(platform:platform, deviceToken:deviceToken);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local deviceType = "IOS"
local deviceToken = "12345"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:deregisterPushNotificationDeviceToken(deviceType, deviceToken, callback)
```

**GDScript:**

```gdscript
var platform = PlatformID.iOS
var device_token = "12345"

var result = await _bc.push_notification_service.deregister_push_notification_device_token(platform, device_token)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local deviceType = "IOS"
local deviceToken = "12345"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:deregisterPushNotificationDeviceToken(deviceType, deviceToken, callback)
```

**Cloud Code:**

```cfscript
var deviceType = "IOS";
var deviceToken = "12345";
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.deregisterPushNotificationDeviceToken(deviceType, deviceToken);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "DEREGISTER",
    "data": {
        "deviceType": "IOS",
        "deviceToken": "12345"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": null,
    "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/pushnotification/index.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/pushnotification -->

# Push Notification

The Push Notification service handles registering device tokens from a user's device and sending push notifications to users.

You will need to correctly configure your push notification settings from the
[Notification Settings page](https://portal.braincloudservers.com/admin/dashboard#/development/pushnotifications) of the brainCloud portal before being able to send notifications.

Templated or normalized push notifications (pre-defined messages with substitutions and possibly localized versions) are configured on
the [Notification Templates](https://portal.braincloudservers.com/admin/dashboard#/development/notifications) page of the brainCloud portal.

> **Tip:** It is possible to send a push notification to oneself. But for group push notification calls, the sender will not receive the notification they sent.


---

<!-- source: docs/api/2_capi/pushnotification/registerpushnotificationdevicetoken.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/pushnotification/registerpushnotificationdevicetoken -->

# RegisterPushNotificationDeviceToken

Registers the given device token from the server to enable this device to receive push notifications.

| Service | Operation |
| ------- | --------- |
| pushNotification | REGISTER |

## Method Parameters

| Parameter | Description                                                        |
| --------- | ------------------------------------------------------------------ |
| platform  | The device platform being registered.                              |
| token     | The platform-dependant device token needed for push notifications. |

## Usage

**C#:**

```csharp
Platform deviceType = Platform.iOS;
string deviceToken = "12345";
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.RegisterPushNotificationDeviceToken(deviceType, deviceToken, successCallback, failureCallback);
```

**C++:**

```cpp
Platform deviceType = Platform::iOS;
const char *deviceToken = "12345";
_bc->getPushNotificationService()->registerPushNotificationDeviceToken(deviceType, deviceToken, this);
```

**Obj-C:**

```objectivec
PlatformObjc *deviceType = [PlatformObjc iOS];
NSString *deviceToken = @"12345";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc pushNotificationService] registerPushNotificationDeviceToken:deviceType
                deviceToken:deviceToken
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
Platform deviceType = Platform.iOS;
String deviceToken = "12345";
this; // implements IServerCallback

_bc.getPushNotificationService().registerPushNotificationDeviceToken(deviceType, deviceToken, 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()));
}
```

**JavaScript:**

```javascript
var deviceType = "IOS";
var deviceToken = "12345";

_bc.pushNotification.registerPushNotificationToken(deviceType, deviceToken, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  devicePlatform = PlatformID.iOS;
var  deviceToken = "12345";
​
ServerResponse result = await _bc.pushNotificationService.registerPushNotificationToken(platform:devicePlatform, deviceToken:deviceToken);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local deviceType = "IOS"
local deviceToken = "12345"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:registerPushNotificationDeviceToken(deviceType, deviceToken, callback)
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
local deviceType = "IOS"
local deviceToken = "12345"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:registerPushNotificationDeviceToken(deviceType, deviceToken, callback)
```

**Cloud Code:**

```cfscript
var deviceType = "IOS";
var deviceToken = "12345";
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.registerPushNotificationDeviceToken(deviceType, deviceToken);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "REGISTER",
    "data": {
        "deviceType": "IOS",
        "deviceToken": "12345"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": null,
    "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/pushnotification/schedulenormalizedpushnotificationminutes.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/pushnotification/schedulenormalizedpushnotificationminutes -->

# 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

**C#:**

```csharp
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);
```

**C++:**

```cpp
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);
```

**Obj-C:**

```objectivec
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];
```

**Java:**

```java
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()));
}
```

**JavaScript:**

```javascript
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));
});
```

**Dart:**

```dart
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}");
}
```

**Roblox:**

```lua
local profileId = "kjhkjhgfkjshgkjh"
local alertContentJson = {
    body = "content of message",
    title = "message title"
}
local customDataJson = {
    field1 = "value1",
    field2 = "value2"
}
local minutesFromNow = 1

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:scheduleNormalizedPushNotificationMinutes(profileId, alertContentJson, customDataJson, minutesFromNow, callback)
```

**GDScript:**

```gdscript
var profile_id = "kjhkjhgfkjshgkjh"
var alert_content_json = {
    "body": "content of message",
    "title": "message title"
}
var custom_data_json = {
    "field1": "value1",
    "field2": "value2"
}
var minutes_from_now = 1

var result = await _bc.push_notification_service.schedule_normalized_push_notification_minutes(profile_id, alert_content_json, custom_data_json, minutes_from_now)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local profileId = "kjhkjhgfkjshgkjh"
local alertContentJson = { body = "content of message", title = "message title" }
local customDataJson = { field1 = "value1", field2 = "value2" }
local minutesFromNow = 1

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:scheduleNormalizedPushNotificationMinutes(profileId, alertContentJson, customDataJson, minutesFromNow, callback)
```

**Cloud Code:**

```cfscript
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!
}
```

**Raw:**

```r
{
    "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]]"
    }
}
```


---

<!-- source: docs/api/2_capi/pushnotification/schedulenormalizedpushnotificationutc.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/pushnotification/schedulenormalizedpushnotificationutc -->

# ScheduleNormalizedPushNotificationUTC

Schedules a normalized push notification to a user at a future absolute 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            |
| startTime    | Time to send notification (UTC) |

## Usage

**C#:**

```csharp
string profileId = "kjhkjhgfkjshgkjh";
string alertContentJson = "{\"body\":\"content of message\",\"title\":\"message title\"}";
string customDataJson = "{\"field1\":\"value1\",\"field2\":\"value2\"}";
int startTime = 1437579786000;
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.ScheduleNormalizedPushNotificationUTC(profileId, alertContentJson, customDataJson, startTime, successCallback, failureCallback);
```

**C++:**

```cpp
const char *profileId = "kjhkjhgfkjshgkjh";
const char *alertContentJson = "{\"body\":\"content of message\",\"title\":\"message title\"}";
const char *customDataJson = "{\"field1\":\"value1\",\"field2\":\"value2\"}";
int startTime = 1437579786000;
_bc->getPushNotificationService()->scheduleNormalizedPushNotificationUTC(profileId, alertContentJson, customDataJson, startTime, this);
```

**Obj-C:**

```objectivec
NSString *profileId = @"kjhkjhgfkjshgkjh";
NSString *alertContentJson = @"{\"body\":\"content of message\",\"title\":\"message title\"}";
NSString *customDataJson = @"{\"field1\":\"value1\",\"field2\":\"value2\"}";
int startTime = 1437579786000;
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc pushNotificationService] scheduleNormalizedPushNotificationUTC:profileId
           alertContentJson:alertContentJson
             customDataJson:customDataJson
                  startTime:startTime
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String profileId = "kjhkjhgfkjshgkjh";
String alertContentJson = "{\"body\":\"content of message\",\"title\":\"message title\"}";
String customDataJson = "{\"field1\":\"value1\",\"field2\":\"value2\"}";
int startTime = 1437579786000;
this; // implements IServerCallback

_bc.getPushNotificationService().scheduleNormalizedPushNotificationUTC(profileId, alertContentJson, customDataJson, startTime, 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()));
}
```

**JavaScript:**

```javascript
var profileId = "kjhkjhgfkjshgkjh";
var alertContentJson = {
    "body": "content of message",
    "title": "message title"
};
var customDataJson = {
    "field1": "value1",
    "field2": "value2"
};
var startTime = 1437579786000;

_bc.pushNotification.scheduleNormalizedPushNotificationUTC(profileId, alertContentJson, customDataJson, startTime, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  profileId = "kjhkjhgfkjshgkjh";
var  alertContentJson = {
    "body": "content of message",
    "title": "message title"
};
var  customDataJson = {
    "field1": "value1",
    "field2": "value2"
};
var  startTime = 1437579786000;

ServerResponse result = await _bc.pushNotificationService.scheduleNormalizedPushNotificationUTC(profileId:profileId, alertContent:alertContentJson, customData:customDataJson, startTime:startTime);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local profileId = "kjhkjhgfkjshgkjh"
local alertContentJson = {
    body = "content of message",
    title = "message title"
}
local customDataJson = {
    field1 = "value1",
    field2 = "value2"
}
local startTime = 1437579786000

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:scheduleNormalizedPushNotificationUTC(profileId, alertContentJson, customDataJson, startTime, callback)
```

**GDScript:**

```gdscript
var profile_id = "kjhkjhgfkjshgkjh"
var alert_content_json = {
    "body": "content of message",
    "title": "message title"
}
var custom_data_json = {
    "field1": "value1",
    "field2": "value2"
}
var start_time = 1437579786000

var result = await _bc.push_notification_service.schedule_normalized_push_notification_utc(profile_id, alert_content_json, custom_data_json, start_time)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local profileId = "kjhkjhgfkjshgkjh"
local alertContentJson = { body = "content of message", title = "message title" }
local customDataJson = { field1 = "value1", field2 = "value2" }
local startTime = 1437579786000

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:scheduleNormalizedPushNotificationUTC(profileId, alertContentJson, customDataJson, startTime, callback)
```

**Cloud Code:**

```cfscript
var profileId = "kjhkjhgfkjshgkjh";
var alertContentJson = {
    "body": "content of message",
    "title": "message title"
};
var customDataJson = {
    "field1": "value1",
    "field2": "value2"
};
var startTime = 1437579786000;
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.scheduleNormalizedPushNotificationUTC(profileId, alertContentJson, customDataJson, startTime);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "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]]"
    }
}
```


---

<!-- source: docs/api/2_capi/pushnotification/schedulerawpushnotificationminutes.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/pushnotification/schedulerawpushnotificationminutes -->

# ScheduleRawPushNotificationMinutes

Schedules a raw push notification to a user at a future relative time.

| Service | Operation |
| ------- | --------- |
| pushNotification | SCHEDULE_RAW_NOTIFICATION |

## Method Parameters
Parameter | Description
--------- | -----------
profileId | Identifies the user to send to
fcmContent | FCM dependent content
iosContent | IOS (APNS) dependent content
facebookContent | Facebook dependent content
minutes | Minutes in the future to send notification

## Usage

**C#:**

```csharp
string profileId = "kjhkjhgfkjshgkjh";
string fcmContent = "{\"notification\":{\"body\":\"content of message\",\"title\":\"message title\"},\"data\":{\"customfield1\":\"customValue1\",\"customfield2\":\"customValue2\"},\"priority\":\"normal\"}";
string iosContent = "{\"aps\":{\"alert\":{\"body\":\"content of message\",\"title\":\"message title\"},\"badge\":0,\"sound\":\"gggg\"}}";
string facebookContent = "{\"template\":\"content of message\"}";
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.PushNotification.ScheduleRawPushNotificationMinutes(profileId, fcmContent, iosContent, facebookContent, minutesFromNow, successCallback, failureCallback);
```

**C++:**

```cpp
const char *profileId = "kjhkjhgfkjshgkjh";
const char *fcmContent = "{\"notification\":{\"body\":\"content of message\",\"title\":\"message title\"},\"data\":{\"customfield1\":\"customValue1\",\"customfield2\":\"customValue2\"},\"priority\":\"normal\"}";
const char *iosContent = "{\"aps\":{\"alert\":{\"body\":\"content of message\",\"title\":\"message title\"},\"badge\":0,\"sound\":\"gggg\"}}";
const char *facebookContent = "{\"template\":\"content of message\"}";
int minutesFromNow = 1;

_bc->getPushNotification()->scheduleRawPushNotificationMinutes(profileId, fcmContent, iosContent, facebookContent, minutesFromNow, this);
```

**Obj-C:**

```objectivec
NSString *profileId = @"kjhkjhgfkjshgkjh";
NSString *fcmContent = @"{\"notification\":{\"body\":\"content of message\",\"title\":\"message title\"},\"data\":{\"customfield1\":\"customValue1\",\"customfield2\":\"customValue2\"},\"priority\":\"normal\"}";
NSString *iosContent = @"{\"aps\":{\"alert\":{\"body\":\"content of message\",\"title\":\"message title\"},\"badge\":0,\"sound\":\"gggg\"}}";
NSString *facebookContent = "{\"template\":\"content of message\"}";
int minutesFromNow = 1;
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc pushNotificationService] scheduleRawPushNotificationMinutes:profileId
                 fcmContent:fcmContent
                 iosContent:iosContent
            facebookContent:facebookContent
             minutesFromNow:minutesFromNow
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String profileId = "kjhkjhgfkjshgkjh";
String fcmContent = "{\"notification\":{\"body\":\"content of message\",\"title\":\"message title\"},\"data\":{\"customfield1\":\"customValue1\",\"customfield2\":\"customValue2\"},\"priority\":\"normal\"}";
String iosContent = "{\"aps\":{\"alert\":{\"body\":\"content of message\",\"title\":\"message title\"},\"badge\":0,\"sound\":\"gggg\"}}";
String facebookContent = "{\"template\":\"content of message\"}";
int minutesFromNow = 1;
this; // implements IServerCallback

_bc.getPushNotification().scheduleRawPushNotificationMinutes(profileId, fcmContent, iosContent, facebookContent, 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()));
}
```

**JavaScript:**

```javascript
var profileId = "kjhkjhgfkjshgkjh";
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 minutesFromNow = 1;

_bc.pushNotification.scheduleRawPushNotificationMinutes(profileId, fcmContent, iosContent, facebookContent, minutesFromNow, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  profileId = "kjhkjhgfkjshgkjh";
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  minutesFromNow = 1;

ServerResponse result = await _bc.pushNotificationService.scheduleRawPushNotificationMinutes(profileId:profileId, fcmContent:fcmContent, iosContent:iosContent, facebookContent:facebookContent, minutesFromNow:minutesFromNow);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local profileId = "kjhkjhgfkjshgkjh"
local fcmContent = {
    notification = {
        body = "content of message",
        title = "message title"
    },
    data = {
        customfield1 = "customValue1",
        customfield2 = "customValue2"
    },
    priority = "normal"
}
local iosContent = {
    aps = {
        alert = {
            body = "content of message",
            title = "message title"
        },
        badge = 0,
        sound = "gggg"
    }
}
local facebookContent = {
    template = "content of message"
}
local minutesFromNow = 1

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:scheduleRawPushNotificationMinutes(profileId, fcmContent, iosContent, facebookContent, minutesFromNow, callback)
```

**GDScript:**

```gdscript
var profile_id = "kjhkjhgfkjshgkjh"
var fcm_content = {
    "notification": {
        "body": "content of message",
        "title": "message title"
    },
    "data": {
        "customfield1": "customValue1",
        "customfield2": "customValue2"
    },
    "priority": "normal"
}
var ios_content = {
    "aps": {
        "alert": {
            "body": "content of message",
            "title": "message title"
        },
        "badge": 0,
        "sound": "gggg"
    }
}
var facebook_content = {
    "template": "content of message"
}
var minutes_from_now = 1

var result = await _bc.push_notification_service.schedule_raw_push_notification_minutes(profile_id, fcm_content, ios_content, facebook_content, minutes_from_now)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local profileId = "kjhkjhgfkjshgkjh"
local fcmContent = {
    notification = { body = "content of message", title = "message title" },
    data = { customfield1 = "customValue1", customfield2 = "customValue2" },
    priority = "normal"
}
local iosContent = {
    aps = {
        alert = { body = "content of message", title = "message title" },
        badge = 0,
        sound = "gggg"
    }
}
local facebookContent = { template = "content of message" }
local minutesFromNow = 1

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:scheduleRawPushNotificationMinutes(profileId, fcmContent, iosContent, facebookContent, minutesFromNow, callback)
```

**Cloud Code:**

```cfscript
var profileId = "kjhkjhgfkjshgkjh";
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 minutesFromNow = 1;
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.scheduleRawPushNotificationMinutes(profileId, fcmContent, iosContent, facebookContent, minutesFromNow);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SCHEDULE_RAW_NOTIFICATION",
    "data": {
        "profileId": "kjhkjhgfkjshgkjh",
        "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"
        },
        "minutesFromNow": 1
    }
}
```


---

<!-- source: docs/api/2_capi/pushnotification/schedulerawpushnotificationutc.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/pushnotification/schedulerawpushnotificationutc -->

# ScheduleRawPushNotificationUTC

Schedules a raw push notification to a user at a future absolute time.

| Service | Operation |
| ------- | --------- |
| pushNotification | SCHEDULE_RAW_NOTIFICATION |

## Method Parameters
Parameter | Description
--------- | -----------
profileId | Identifies the user to send to
fcmContent | FCM dependent content
iosContent | IOS (APNS) dependent content
facebookContent | Facebook dependent content
startTime | Time to send notification (UTC)

## Usage

**C#:**

```csharp
string profileId = "kjhkjhgfkjshgkjh";
string fcmContent = "{\"notification\":{\"body\":\"content of message\",\"title\":\"message title\"},\"data\":{\"customfield1\":\"customValue1\",\"customfield2\":\"customValue2\"},\"priority\":\"normal\"}";
string iosContent = "{\"aps\":{\"alert\":{\"body\":\"content of message\",\"title\":\"message title\"},\"badge\":0,\"sound\":\"gggg\"}}";
string facebookContent = "{\"template\":\"content of message\"}";
int startTime = 1437579786000;
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.PushNotification.ScheduleRawPushNotificationUTC(profileId, fcmContent, iosContent, facebookContent, startTime, successCallback, failureCallback);
```

**C++:**

```cpp
const char *profileId = "kjhkjhgfkjshgkjh";
const char *fcmContent = "{\"notification\":{\"body\":\"content of message\",\"title\":\"message title\"},\"data\":{\"customfield1\":\"customValue1\",\"customfield2\":\"customValue2\"},\"priority\":\"normal\"}";
const char *iosContent = "{\"aps\":{\"alert\":{\"body\":\"content of message\",\"title\":\"message title\"},\"badge\":0,\"sound\":\"gggg\"}}";
const char *facebookContent = "{\"template\":\"content of message\"}";
int startTime = 1437579786000;

_bc->getPushNotification()->scheduleRawPushNotificationUTC(profileId, fcmContent, iosContent, facebookContent, startTime, this);
```

**Obj-C:**

```objectivec
NSString *profileId = @"kjhkjhgfkjshgkjh";
NSString *fcmContent = @"{\"notification\":{\"body\":\"content of message\",\"title\":\"message title\"},\"data\":{\"customfield1\":\"customValue1\",\"customfield2\":\"customValue2\"},\"priority\":\"normal\"}";
NSString *iosContent = @"{\"aps\":{\"alert\":{\"body\":\"content of message\",\"title\":\"message title\"},\"badge\":0,\"sound\":\"gggg\"}}";
NSString *facebookContent = "{\"template\":\"content of message\"}";
int startTime = 1437579786000;
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc pushNotificationService] scheduleRawPushNotificationUTC:profileId
                 fcmContent:fcmContent
                 iosContent:iosContent
            facebookContent:facebookContent
            startTime:startTime
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String profileId = "kjhkjhgfkjshgkjh";
String fcmContent = "{\"notification\":{\"body\":\"content of message\",\"title\":\"message title\"},\"data\":{\"customfield1\":\"customValue1\",\"customfield2\":\"customValue2\"},\"priority\":\"normal\"}";
String iosContent = "{\"aps\":{\"alert\":{\"body\":\"content of message\",\"title\":\"message title\"},\"badge\":0,\"sound\":\"gggg\"}}";
String facebookContent = "{\"template\":\"content of message\"}";
int startTime = 1437579786000;
this; // implements IServerCallback

_bc.getPushNotification().scheduleRawPushNotificationUTC(profileId, fcmContent, iosContent, facebookContent, startTime, 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()));
}
```

**JavaScript:**

```javascript
var profileId = "kjhkjhgfkjshgkjh";
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 startTime = 1437579786000;

_bc.pushNotification.scheduleRawPushNotificationUTC(profileId, fcmContent, iosContent, facebookContent, startTime, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  profileId = "kjhkjhgfkjshgkjh";
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  startTime = 1437579786000;

ServerResponse result = await _bc.pushNotificationService.scheduleRawPushNotificationUTC(profileId:profileId, fcmContent:fcmContent, iosContent:iosContent, facebookContent:facebookContent, startTime:startTime);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local profileId = "kjhkjhgfkjshgkjh"
local fcmContent = {
    notification = {
        body = "content of message",
        title = "message title"
    },
    data = {
        customfield1 = "customValue1",
        customfield2 = "customValue2"
    },
    priority = "normal"
}
local iosContent = {
    aps = {
        alert = {
            body = "content of message",
            title = "message title"
        },
        badge = 0,
        sound = "gggg"
    }
}
local facebookContent = {
    template = "content of message"
}
local startTime = 1437579786000

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:scheduleRawPushNotificationUTC(profileId, fcmContent, iosContent, facebookContent, startTime, callback)
```

**GDScript:**

```gdscript
var profile_id = "kjhkjhgfkjshgkjh"
var fcm_content = {
    "notification": {
        "body": "content of message",
        "title": "message title"
    },
    "data": {
        "customfield1": "customValue1",
        "customfield2": "customValue2"
    },
    "priority": "normal"
}
var ios_content = {
    "aps": {
        "alert": {
            "body": "content of message",
            "title": "message title"
        },
        "badge": 0,
        "sound": "gggg"
    }
}
var facebook_content = {
    "template": "content of message"
}
var start_time = 1437579786000

var result = await _bc.push_notification_service.schedule_raw_push_notification_utc(profile_id, fcm_content, ios_content, facebook_content, start_time)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local profileId = "kjhkjhgfkjshgkjh"
local fcmContent = {
    notification = { body = "content of message", title = "message title" },
    data = { customfield1 = "customValue1", customfield2 = "customValue2" },
    priority = "normal"
}
local iosContent = {
    aps = {
        alert = { body = "content of message", title = "message title" },
        badge = 0,
        sound = "gggg"
    }
}
local facebookContent = { template = "content of message" }
local startTime = 1437579786000

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:scheduleRawPushNotificationUTC(profileId, fcmContent, iosContent, facebookContent, startTime, callback)
```

**Cloud Code:**

```cfscript
var profileId = "kjhkjhgfkjshgkjh";
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 startTime = 1437579786000;
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.scheduleRawPushNotificationUTC(profileId, fcmContent, iosContent, facebookContent, startTime);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
// N/A
```


---

<!-- source: docs/api/2_capi/pushnotification/schedulerichpushnotificationminutes.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/pushnotification/schedulerichpushnotificationminutes -->

# ScheduleRichPushNotificationMinutes

Schedules a rich push notification to a user at a future relative time.

| Service | Operation |
| ------- | --------- |
| pushNotification | SCHEDULE_RICH_NOTIFICATION |

## Method Parameters

| Parameter              | Description                                                    |
| ---------------------- | -------------------------------------------------------------- |
| profileId              | Identifies the user to send to                                 |
| notificationTemplateId | Id of the notification template                                |
| substitutions          | JSON defining the substitution params to use with the template |
| minutesFromNow         | Minutes in the future to send notification                     |

## Usage

**C#:**

```csharp
string profileId = "kjhkjhgfkjshgkjh";
int notificationTemplateId = 1;
string substitutionJson = "{\"0\":\"value0\",\"1\":\"value1\"}";
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.PushNotification.ScheduleRichPushNotificationMinutes(profileId, notificationTemplateId, substitutionJson, minutesFromNow, successCallback, failureCallback);
```

**C++:**

```cpp
const char *profileId = "kjhkjhgfkjshgkjh";
int notificationTemplateId = 1;
const char *substitutionJson = "{\"0\":\"value0\",\"1\":\"value1\"}";
int minutesFromNow = 1;

_bc->getPushNotification()->scheduleRichPushNotificationMinutes(profileId, notificationTemplateId, substitutionJson, minutesFromNow, this);
```

**Obj-C:**

```objectivec
NSString *profileId = @"kjhkjhgfkjshgkjh";
int notificationTemplateId = 1;
NSString *substitutionJson = @"{\"0\":\"value0\",\"1\":\"value1\"}";
int minutesFromNow = 1;
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc pushNotificationService] scheduleRichPushNotificationMinutes:profileId
     notificationTemplateId:notificationTemplateId
           substitutionJson:substitutionJson
             minutesFromNow:minutesFromNow
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String profileId = "kjhkjhgfkjshgkjh";
int notificationTemplateId = 1;
String substitutionJson = "{\"0\":\"value0\",\"1\":\"value1\"}";
int minutesFromNow = 1;
this; // implements IServerCallback

_bc.getPushNotification().scheduleRichPushNotificationMinutes(profileId, notificationTemplateId, substitutionJson, 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()));
}
```

**JavaScript:**

```javascript
var profileId = "kjhkjhgfkjshgkjh";
var notificationTemplateId = 1;
var substitutionJson = {
    "0": "value0",
    "1": "value1"
};
var minutesFromNow = 1;

_bc.pushNotification.scheduleRichPushNotificationMinutes(profileId, notificationTemplateId, substitutionJson, minutesFromNow, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  profileId = "kjhkjhgfkjshgkjh";
var  notificationTemplateId = 1;
var  substitutionJson = {
    "0": "value0",
    "1": "value1"
};
var  minutesFromNow = 1;

ServerResponse result = await _bc.pushNotificationService.scheduleRichPushNotificationMinutes(profileId:profileId, notificationTemplateId:notificationTemplateId, substitution:substitutionJson, minutesFromNow:minutesFromNow);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local profileId = "kjhkjhgfkjshgkjh"
local notificationTemplateId = 1
local substitutionJson = {
    ["0"] = "value0",
    ["1"] = "value1"
}
local minutesFromNow = 1

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:scheduleRichPushNotificationMinutes(profileId, notificationTemplateId, substitutionJson, minutesFromNow, callback)
```

**GDScript:**

```gdscript
var profile_id = "kjhkjhgfkjshgkjh"
var notification_template_id = 1
var substitution_json = {
    "0": "value0",
    "1": "value1"
}
var minutes_from_now = 1

var result = await _bc.push_notification_service.schedule_rich_push_notification_minutes(profile_id, notification_template_id, substitution_json, minutes_from_now)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local profileId = "kjhkjhgfkjshgkjh"
local notificationTemplateId = 1
local substitutionJson = { ["0"] = "value0", ["1"] = "value1" }
local minutesFromNow = 1

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:scheduleRichPushNotificationMinutes(profileId, notificationTemplateId, substitutionJson, minutesFromNow, callback)
```

**Cloud Code:**

```cfscript
var profileId = "kjhkjhgfkjshgkjh";
var notificationTemplateId = 1;
var substitutionJson = {
    "0": "value0",
    "1": "value1"
};
var minutesFromNow = 1;
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.scheduleRichPushNotificationMinutes(profileId, notificationTemplateId, substitutionJson, minutesFromNow);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SCHEDULE_RICH_NOTIFICATION",
    "data": {
        "profileId": "kjhkjhgfkjshgkjh",
        "notificationTemplateId": 1,
        "substitutions": {
            "0": "value0",
            "1": "value1"
        },
        "startDateUTC": "[[#ts+60000]]"
    }
}
```


---

<!-- source: docs/api/2_capi/pushnotification/schedulerichpushnotificationutc.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/pushnotification/schedulerichpushnotificationutc -->

# ScheduleRichPushNotificationUTC

Schedules a rich push notification to a user at a future absolute time.

| Service | Operation |
| ------- | --------- |
| pushNotification | SCHEDULE_RICH_NOTIFICATION |

## Method Parameters

| Parameter              | Description                                                    |
| ---------------------- | -------------------------------------------------------------- |
| profileId              | Identifies the user to send to                                 |
| notificationTemplateId | Id of the notification template                                |
| substitutions          | JSON defining the substitution params to use with the template |
| startTime              | Time to send notification (UTC)                                |

## Usage

**C#:**

```csharp
string profileId = "kjhkjhgfkjshgkjh";
int notificationTemplateId = 1;
string substitutionJson = "{\"0\":\"value0\",\"1\":\"value1\"}";
int startTime = 1437579786000;
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.PushNotification.scheduleRichPushNotificationUTC(profileId, notificationTemplateId, substitutionJson, startTime, successCallback, failureCallback);
```

**C++:**

```cpp
const char *profileId = "kjhkjhgfkjshgkjh";
int notificationTemplateId = 1;
const char *substitutionJson = "{\"0\":\"value0\",\"1\":\"value1\"}";
int startTime = 1437579786000;

_bc->getPushNotification()->scheduleRichPushNotificationUTC(profileId, notificationTemplateId, substitutionJson, startTime, this);
```

**Obj-C:**

```objectivec
NSString *profileId = @"kjhkjhgfkjshgkjh";
int notificationTemplateId = 1;
NSString *substitutionJson = @"{\"0\":\"value0\",\"1\":\"value1\"}";
int startTime = 1437579786000;
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc pushNotificationService] scheduleRichPushNotificationUTC:profileId
     notificationTemplateId:notificationTemplateId
           substitutionJson:substitutionJson
                  startTime:startTime
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String profileId = "kjhkjhgfkjshgkjh";
int notificationTemplateId = 1;
String substitutionJson = "{\"0\":\"value0\",\"1\":\"value1\"}";
int startTime = 1437579786000;
this; // implements IServerCallback

_bc.getPushNotification().scheduleRichPushNotificationUTC(profileId, notificationTemplateId, substitutionJson, startTime, 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()));
}
```

**JavaScript:**

```javascript
var profileId = "kjhkjhgfkjshgkjh";
var notificationTemplateId = 1;
var substitutionJson = {
    "0": "value0",
    "1": "value1"
};
var startTime = 1437579786000;

_bc.pushNotification.scheduleRichPushNotificationUTC(profileId, notificationTemplateId, substitutionJson, startTime, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  profileId = "kjhkjhgfkjshgkjh";
var  notificationTemplateId = 1;
var  substitutionJson = {
    "0": "value0",
    "1": "value1"
};
var  startTime = 1437579786000;

ServerResponse result = await _bc.pushNotificationService.scheduleRichPushNotificationUTC(profileId:profileId, notificationTemplateId:notificationTemplateId, substitution:substitutionJson, startTime:startTime);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local profileId = "kjhkjhgfkjshgkjh"
local notificationTemplateId = 1
local substitutionJson = {
    ["0"] = "value0",
    ["1"] = "value1"
}
local startTime = 1437579786000

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:scheduleRichPushNotificationUTC(profileId, notificationTemplateId, substitutionJson, startTime, callback)
```

**GDScript:**

```gdscript
var profile_id = "kjhkjhgfkjshgkjh"
var notification_template_id = 1
var substitution_json = {
    "0": "value0",
    "1": "value1"
}
var start_time = 1437579786000

var result = await _bc.push_notification_service.schedule_rich_push_notification_utc(profile_id, notification_template_id, substitution_json, start_time)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local profileId = "kjhkjhgfkjshgkjh"
local notificationTemplateId = 1
local substitutionJson = { ["0"] = "value0", ["1"] = "value1" }
local startTime = 1437579786000

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:scheduleRichPushNotificationUTC(profileId, notificationTemplateId, substitutionJson, startTime, callback)
```

**Cloud Code:**

```cfscript
var profileId = "kjhkjhgfkjshgkjh";
var notificationTemplateId = 1;
var substitutionJson = {
    "0": "value0",
    "1": "value1"
};
var startTime = 1437579786000;
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.scheduleRichPushNotificationUTC(profileId, notificationTemplateId, substitutionJson, startTime);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SCHEDULE_RICH_NOTIFICATION",
    "data": {
        "profileId": "kjhkjhgfkjshgkjh",
        "notificationTemplateId": 1,
        "substitutions": {
            "0": "value0",
            "1": "value1"
        },
        "startDateUTC": "[[#ts+60000]]"
    }
}
```


---

<!-- source: docs/api/2_capi/pushnotification/sendnormalizedpushnotification.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/pushnotification/sendnormalizedpushnotification -->

# SendNormalizedPushNotification

Sends a notification to a user consisting of alert content and custom data.

| Service | Operation |
| ------- | --------- |
| pushNotification | SEND_NORMALIZED |

## Method Parameters

| Parameter        | Description                                           |
| ---------------- | ----------------------------------------------------- |
| toProfileId      | The profileId of the user to receive the notification |
| alertContentJson | Body and title of alert                               |
| customDataJson   | Optional custom data                                  |

## Usage

**C#:**

```csharp
string toProfileId = "profile1";
string alertContentJson = "{\"body\":\"content of message\",\"title\":\"message title\"}";
string customDataJson = "{\"field1\":\"value1\",\"field2\":\"value2\"}";
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.SendNormalizedPushNotification(toProfileId, alertContentJson, customDataJson, successCallback, failureCallback);
```

**C++:**

```cpp
const char *toProfileId = "profile1";
const char *alertContentJson = "{\"body\":\"content of message\",\"title\":\"message title\"}";
const char *customDataJson = "{\"field1\":\"value1\",\"field2\":\"value2\"}";
_bc->getPushNotificationService()->sendNormalizedPushNotification(toProfileId, alertContentJson, customDataJson, this);
```

**Obj-C:**

```objectivec
NSString *toProfileId = @"profile1";
NSString *alertContentJson = @"{\"body\":\"content of message\",\"title\":\"message title\"}";
NSString *customDataJson = @"{\"field1\":\"value1\",\"field2\":\"value2\"}";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc pushNotificationService] sendNormalizedPushNotification:toProfileId
           alertContentJson:alertContentJson
             customDataJson:customDataJson
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String toProfileId = "profile1";
String alertContentJson = "{\"body\":\"content of message\",\"title\":\"message title\"}";
String customDataJson = "{\"field1\":\"value1\",\"field2\":\"value2\"}";
this; // implements IServerCallback

_bc.getPushNotificationService().sendNormalizedPushNotification(toProfileId, alertContentJson, customDataJson, 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()));
}
```

**JavaScript:**

```javascript
var toProfileId = "profile1";
var alertContentJson = {
    "body": "content of message",
    "title": "message title"
};
var customDataJson = {
    "field1": "value1",
    "field2": "value2"
};

_bc.pushNotification.sendNormalizedPushNotification(toProfileId, alertContentJson, customDataJson, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  toProfileId = "profile1";
var  alertContentJson = {
    "body": "content of message",
    "title": "message title"
};
var  customDataJson = {
    "field1": "value1",
    "field2": "value2"
};

ServerResponse result = await _bc.pushNotificationService.sendNormalizedPushNotification(profileId:toProfileId, alertContent:alertContentJson, customData:customDataJson);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local toProfileId = "profile1"
local alertContentJson = {
    body = "content of message",
    title = "message title"
}
local customDataJson = {
    field1 = "value1",
    field2 = "value2"
}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:sendNormalizedPushNotification(toProfileId, alertContentJson, customDataJson, callback)
```

**GDScript:**

```gdscript
var to_profile_id = "profile1"
var alert_content_json = {
    "body": "content of message",
    "title": "message title"
}
var custom_data_json = {
    "field1": "value1",
    "field2": "value2"
}

var result = await _bc.push_notification_service.send_normalized_push_notification(to_profile_id, alert_content_json, custom_data_json)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local toProfileId = "profile1"
local alertContentJson = { body = "content of message", title = "message title" }
local customDataJson = { field1 = "value1", field2 = "value2" }

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:sendNormalizedPushNotification(toProfileId, alertContentJson, customDataJson, callback)
```

**Cloud Code:**

```cfscript
var toProfileId = "profile1";
var alertContentJson = {
    "body": "content of message",
    "title": "message title"
};
var customDataJson = {
    "field1": "value1",
    "field2": "value2"
};
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.sendNormalizedPushNotification(toProfileId, alertContentJson, customDataJson);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SEND_NORMALIZED",
    "data": {
        "toProfileId": "profile1",
        "alertContent": {
            "body": "content of message",
            "title": "message title"
        },
        "customData": {
            "field1": "value1",
            "field2": "value2"
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": null,
    "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/pushnotification/sendnormalizedpushnotificationbatch.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/pushnotification/sendnormalizedpushnotificationbatch -->

# SendNormalizedPushNotificationBatch

Sends a notification to a list of users consisting of alert content and custom data.

| Service | Operation |
| ------- | --------- |
| pushNotification | SEND_NORMALIZED_BATCH |

## Method Parameters

| Parameter        | Description             |
| ---------------- | ----------------------- |
| profileIds       | Target user list        |
| alertContentJson | Body and title of alert |
| customDataJson   | Optional custom data    |

## Usage

**C#:**

```csharp
string[] profileIds = { "a-profile-id", "another-profile-id" };
string alertContentJson = "{\"body\":\"content of message\",\"title\":\"message title\"}";
string customDataJson = "{\"field1\":\"value1\",\"field2\":\"value2\"}";
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.SendNormalizedPushNotificationBatch(profileIds, alertContentJson, customDataJson, successCallback, failureCallback);
```

**C++:**

```cpp
std::vector<std::string> profileIds;
profileIds.push_back("a-profile-id");
profileIds.push_back("another-profile-id");
const char *alertContentJson = "{\"body\":\"content of message\",\"title\":\"message title\"}";
const char *customDataJson = "{\"field1\":\"value1\",\"field2\":\"value2\"}";
_bc->getPushNotificationService()->sendNormalizedPushNotificationBatch(profileIds, alertContentJson, customDataJson, this);
```

**Obj-C:**

```objectivec
NSArray *profileIds = @[ @"a-profile-id", @"another-profile-id" ];
NSString *alertContentJson = @"{\"body\":\"content of message\",\"title\":\"message title\"}";
NSString *customDataJson = @"{\"field1\":\"value1\",\"field2\":\"value2\"}";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc pushNotificationService] sendNormalizedPushNotificationBatch:profileIds
           alertContentJson:alertContentJson
             customDataJson:customDataJson
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String[] profileIds = { "a-profile-id", "another-profile-id" };
String alertContentJson = "{\"body\":\"content of message\",\"title\":\"message title\"}";
String customDataJson = "{\"field1\":\"value1\",\"field2\":\"value2\"}";
this; // implements IServerCallback

_bc.getPushNotificationService().sendNormalizedPushNotificationBatch(profileIds, alertContentJson, customDataJson, 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()));
}
```

**JavaScript:**

```javascript
var profileIds = [ "a-profile-id", "another-profile-id" ];
var alertContentJson = {
    "body": "content of message",
    "title": "message title"
};
var customDataJson = {
    "field1": "value1",
    "field2": "value2"
};

_bc.pushNotification.sendNormalizedPushNotificationBatch(profileIds, alertContentJson, customDataJson, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  profileIds = [ "a-profile-id", "another-profile-id" ];
var  alertContentJson = {
    "body": "content of message",
    "title": "message title"
};
var  customDataJson = {
    "field1": "value1",
    "field2": "value2"
};

ServerResponse result = await _bc.pushNotificationService.sendNormalizedPushNotificationBatch(profileIds:profileIds, alertContent:alertContentJson, customData:customDataJson);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local profileIds = { "a-profile-id", "another-profile-id" }
local alertContentJson = {
    body = "content of message",
    title = "message title"
}
local customDataJson = {
    field1 = "value1",
    field2 = "value2"
}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:sendNormalizedPushNotificationBatch(profileIds, alertContentJson, customDataJson, callback)
```

**GDScript:**

```gdscript
var profile_ids = [ "a-profile-id", "another-profile-id" ]
var alert_content_json = {
    "body": "content of message",
    "title": "message title"
}
var custom_data_json = {
    "field1": "value1",
    "field2": "value2"
}

var result = await _bc.push_notification_service.send_normalized_push_notification_batch(profile_ids, alert_content_json, custom_data_json)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local profileIds = { "a-profile-id", "another-profile-id" }
local alertContentJson = { body = "content of message", title = "message title" }
local customDataJson = { field1 = "value1", field2 = "value2" }

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:sendNormalizedPushNotificationBatch(profileIds, alertContentJson, customDataJson, callback)
```

**Cloud Code:**

```cfscript
var profileIds = [ "a-profile-id", "another-profile-id" ];
var alertContentJson = {
    "body": "content of message",
    "title": "message title"
};
var customDataJson = {
    "field1": "value1",
    "field2": "value2"
};
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.sendNormalizedPushNotificationBatch(profileIds, alertContentJson, customDataJson);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SEND_NORMALIZED_BATCH",
    "data": {
        "profileIds": [
            "the-profile-id",
            "another-profile-id"
        ],
        "alertContent": {
            "body": "content of message",
            "title": "message title"
        },
        "customData": {
            "field1": "value1",
            "field2": "value2"
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": null,
    "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/pushnotification/sendnormalizedpushnotificationtogroup.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/pushnotification/sendnormalizedpushnotificationtogroup -->

# SendNormalizedPushNotificationToGroup

Sends a notification to a "group" of user consisting of alert content and custom data.

| Service | Operation |
| ------- | --------- |
| pushNotification | SEND_NORMALIZED_TO_GROUP |

## Method Parameters

| Parameter        | Description             |
| ---------------- | ----------------------- |
| groupId          | Target group ID         |
| alertContentJson | Body and title of alert |
| customDataJson   | Optional custom data    |

## Usage

**C#:**

```csharp
string groupId = "group1";
string alertContentJson = "{\"body\":\"content of message\",\"title\":\"message title\"}";
string customDataJson = "{\"field1\":\"value1\",\"field2\":\"value2\"}";
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.SendNormalizedPushNotificationToGroup(groupId, alertContentJson, customDataJson, successCallback, failureCallback);
```

**C++:**

```cpp
const char *groupId = "group1";
const char *alertContentJson = "{\"body\":\"content of message\",\"title\":\"message title\"}";
const char *customDataJson = "{\"field1\":\"value1\",\"field2\":\"value2\"}";
_bc->getPushNotificationService()->sendNormalizedPushNotificationToGroup(groupId, alertContentJson, customDataJson, this);
```

**Obj-C:**

```objectivec
NSString *groupId = @"group1";
NSString *alertContentJson = @"{\"body\":\"content of message\",\"title\":\"message title\"}";
NSString *customDataJson = @"{\"field1\":\"value1\",\"field2\":\"value2\"}";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc pushNotificationService] sendNormalizedPushNotificationToGroup:groupId
           alertContentJson:alertContentJson
             customDataJson:customDataJson
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String groupId = "group1";
String alertContentJson = "{\"body\":\"content of message\",\"title\":\"message title\"}";
String customDataJson = "{\"field1\":\"value1\",\"field2\":\"value2\"}";
this; // implements IServerCallback

_bc.getPushNotificationService().sendNormalizedPushNotificationToGroup(groupId, alertContentJson, customDataJson, 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()));
}
```

**JavaScript:**

```javascript
var groupId = "group1";
var alertContentJson = {
    "body": "content of message",
    "title": "message title"
};
var customDataJson = {
    "field1": "value1",
    "field2": "value2"
};

_bc.pushNotification.sendNormalizedPushNotificationToGroup(groupId, alertContentJson, customDataJson, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  groupId = "group1";
var  alertContentJson = {
    "body": "content of message",
    "title": "message title"
};
var  customDataJson = {
    "field1": "value1",
    "field2": "value2"
};

ServerResponse result = await _bc.pushNotificationService.sendNormalizedPushNotificationToGroup(groupId:groupId, alertContent:alertContentJson, customData:customDataJson);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local groupId = "group1"
local alertContentJson = {
    body = "content of message",
    title = "message title"
}
local customDataJson = {
    field1 = "value1",
    field2 = "value2"
}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:sendNormalizedPushNotificationToGroup(groupId, alertContentJson, customDataJson, callback)
```

**GDScript:**

```gdscript
var group_id = "group1"
var alert_content_json = {
    "body": "content of message",
    "title": "message title"
}
var custom_data_json = {
    "field1": "value1",
    "field2": "value2"
}

var result = await _bc.push_notification_service.send_normalized_push_notification_to_group(group_id, alert_content_json, custom_data_json)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local groupId = "group1"
local alertContentJson = { body = "content of message", title = "message title" }
local customDataJson = { field1 = "value1", field2 = "value2" }

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:sendNormalizedPushNotificationToGroup(groupId, alertContentJson, customDataJson, callback)
```

**Cloud Code:**

```cfscript
var groupId = "group1";
var alertContentJson = {
    "body": "content of message",
    "title": "message title"
};
var customDataJson = {
    "field1": "value1",
    "field2": "value2"
};
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.sendNormalizedPushNotificationToGroup(groupId, alertContentJson, customDataJson);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SEND_NORMALIZED_TO_GROUP",
    "data": {
        "groupId": "group1",
        "alertContent": {
            "body": "content of message",
            "title": "message title"
        },
        "customData": {
            "field1": "value1",
            "field2": "value2"
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": null,
    "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/pushnotification/sendrawpushnotification.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/pushnotification/sendrawpushnotification -->

# SendRawPushNotification

Sends a notification to a user consisting of raw platform dependent content.

| Service | Operation |
| ------- | --------- |
| pushNotification | SEND_RAW |

## Method Parameters

| Parameter       | Description                                           |
| --------------- | ----------------------------------------------------- |
| toProfileId     | The profileId of the user to receive the notification |
| fcmContent      | FCM dependent content                                 |
| iosContent      | IOS (APNS) dependent content                          |
| facebookContent | Facebook dependent content                            |

## Usage

**C#:**

```csharp
string toProfileId = "profile1";
string fcmContent = "{\"notification\":{\"body\":\"content of message\",\"title\":\"message title\"},\"data\":{\"customfield1\":\"customValue1\",\"customfield2\":\"customValue2\"},\"priority\":\"normal\"}";
string iosContent = "{\"aps\":{\"alert\":{\"body\":\"content of message\",\"title\":\"message title\"},\"badge\":0,\"sound\":\"gggg\"}}";
string facebookContent = "{\"template\":\"content of message\"}";
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.SendRawPushNotification(toProfileId, fcmContent, iosContent, facebookContent, successCallback, failureCallback);
```

**C++:**

```cpp
const char *toProfileId = "profile1";
const char *fcmContent = "{\"notification\":{\"body\":\"content of message\",\"title\":\"message title\"},\"data\":{\"customfield1\":\"customValue1\",\"customfield2\":\"customValue2\"},\"priority\":\"normal\"}";
const char *iosContent = "{\"aps\":{\"alert\":{\"body\":\"content of message\",\"title\":\"message title\"},\"badge\":0,\"sound\":\"gggg\"}}";
const char *facebookContent = "{\"template\":\"content of message\"}";
_bc->getPushNotificationService()->sendRawPushNotification(toProfileId, fcmContent, iosContent, facebookContent, this);
```

**Obj-C:**

```objectivec
NSString *toProfileId = @"profile1";
NSString *fcmContent = @"{\"notification\":{\"body\":\"content of message\",\"title\":\"message title\"},\"data\":{\"customfield1\":\"customValue1\",\"customfield2\":\"customValue2\"},\"priority\":\"normal\"}";
NSString *iosContent = @"{\"aps\":{\"alert\":{\"body\":\"content of message\",\"title\":\"message title\"},\"badge\":0,\"sound\":\"gggg\"}}";
NSString *facebookContent = @"{\"template\":\"content of message\"}";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc pushNotificationService] sendRawPushNotification:toProfileId
                 fcmContent:fcmContent
                 iosContent:iosContent
            facebookContent:facebookContent
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String toProfileId = "profile1";
String fcmContent = "{\"notification\":{\"body\":\"content of message\",\"title\":\"message title\"},\"data\":{\"customfield1\":\"customValue1\",\"customfield2\":\"customValue2\"},\"priority\":\"normal\"}";
String iosContent = "{\"aps\":{\"alert\":{\"body\":\"content of message\",\"title\":\"message title\"},\"badge\":0,\"sound\":\"gggg\"}}";
String facebookContent = "{\"template\":\"content of message\"}";
this; // implements IServerCallback

_bc.getPushNotificationService().sendRawPushNotification(toProfileId, fcmContent, iosContent, facebookContent, 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()));
}
```

**JavaScript:**

```javascript
var toProfileId = "profile1";
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"
};

_bc.pushNotification.sendRawPushNotification(toProfileId, fcmContent, iosContent, facebookContent, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  toProfileId = "profile1";
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"
};

ServerResponse result = await _bc.pushNotificationService.sendRawPushNotification(profileId:toProfileId, fcmContent:fcmContent, iosContent:iosContent, facebookContent:facebookContent);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local toProfileId = "profile1"
local fcmContent = {
    notification = {
        body = "content of message",
        title = "message title"
    },
    data = {
        customfield1 = "customValue1",
        customfield2 = "customValue2"
    },
    priority = "normal"
}
local iosContent = {
    aps = {
        alert = {
            body = "content of message",
            title = "message title"
        },
        badge = 0,
        sound = "gggg"
    }
}
local facebookContent = {
    template = "content of message"
}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:sendRawPushNotification(toProfileId, fcmContent, iosContent, facebookContent, callback)
```

**GDScript:**

```gdscript
var to_profile_id = "profile1"
var fcm_content = {
    "notification": {
        "body": "content of message",
        "title": "message title"
    },
    "data": {
        "customfield1": "customValue1",
        "customfield2": "customValue2"
    },
    "priority": "normal"
}
var ios_content = {
    "aps": {
        "alert": {
            "body": "content of message",
            "title": "message title"
        },
        "badge": 0,
        "sound": "gggg"
    }
}
var facebook_content = {
    "template": "content of message"
}

var result = await _bc.push_notification_service.send_raw_push_notification(to_profile_id, fcm_content, ios_content, facebook_content)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local toProfileId = "profile1"
local fcmContent = {
    notification = { body = "content of message", title = "message title" },
    data = { customfield1 = "customValue1", customfield2 = "customValue2" },
    priority = "normal"
}
local iosContent = {
    aps = {
        alert = { body = "content of message", title = "message title" },
        badge = 0,
        sound = "gggg"
    }
}
local facebookContent = { template = "content of message" }

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:sendRawPushNotification(toProfileId, fcmContent, iosContent, facebookContent, callback)
```

**Cloud Code:**

```cfscript
var toProfileId = "profile1";
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 pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.sendRawPushNotification(toProfileId, fcmContent, iosContent, facebookContent);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SEND_RAW",
    "data": {
        "toProfileId": "profile1",
        "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"
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": null,
    "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/pushnotification/sendrawpushnotificationbatch.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/pushnotification/sendrawpushnotificationbatch -->

# SendRawPushNotificationBatch

Sends a notification to a list of users consisting of raw message content.

| Service | Operation |
| ------- | --------- |
| pushNotification | SEND_RAW_BATCH |

## Method Parameters
Parameter | Description
--------- | -----------
profileIds | Target user list
alertContentJson | Body and title of alert
customDataJson | Optional custom data

## Usage

**C#:**

```csharp
string[] profileIds = { "a-profile-id", "another-profile-id" };
string fcmContent = "{\"notification\":{\"body\":\"content of message\",\"title\":\"message title\"},\"data\":{\"customfield1\":\"customValue1\",\"customfield2\":\"customValue2\"},\"priority\":\"normal\"}";
string iosContent = "{\"aps\":{\"alert\":{\"body\":\"content of message\",\"title\":\"message title\"},\"badge\":0,\"sound\":\"gggg\"}}";
string facebookContent = "{\"template\":\"content of message\"}";
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.SendRawPushNotificationBatch(profileIds, fcmContent, iosContent, facebookContent, successCallback, failureCallback);
```

**C++:**

```cpp
std::vector<std::string> profileIds;
profileIds.push_back("a-profile-id");
profileIds.push_back("another-profile-id");
const char *fcmContent = "{\"notification\":{\"body\":\"content of message\",\"title\":\"message title\"},\"data\":{\"customfield1\":\"customValue1\",\"customfield2\":\"customValue2\"},\"priority\":\"normal\"}";
const char *iosContent = "{\"aps\":{\"alert\":{\"body\":\"content of message\",\"title\":\"message title\"},\"badge\":0,\"sound\":\"gggg\"}}";
const char *facebookContent = "{\"template\":\"content of message\"}";
_bc->getPushNotificationService()->sendRawPushNotificationBatch(profileIds, fcmContent, iosContent, facebookContent, this);
```

**Obj-C:**

```objectivec
NSArray *profileIds = @[ @"a-profile-id", @"another-profile-id" ];
NSString *fcmContent = @"{\"notification\":{\"body\":\"content of message\",\"title\":\"message title\"},\"data\":{\"customfield1\":\"customValue1\",\"customfield2\":\"customValue2\"},\"priority\":\"normal\"}";
NSString *iosContent = @"{\"aps\":{\"alert\":{\"body\":\"content of message\",\"title\":\"message title\"},\"badge\":0,\"sound\":\"gggg\"}}";
NSString *facebookContent = @"{\"template\":\"content of message\"}";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc pushNotificationService] sendRawPushNotificationBatch:profileIds
                 fcmContent:fcmContent
                 iosContent:iosContent
            facebookContent:facebookContent
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String[] profileIds = { "a-profile-id", "another-profile-id" };
String fcmContent = "{\"notification\":{\"body\":\"content of message\",\"title\":\"message title\"},\"data\":{\"customfield1\":\"customValue1\",\"customfield2\":\"customValue2\"},\"priority\":\"normal\"}";
String iosContent = "{\"aps\":{\"alert\":{\"body\":\"content of message\",\"title\":\"message title\"},\"badge\":0,\"sound\":\"gggg\"}}";
String facebookContent = "{\"template\":\"content of message\"}";
this; // implements IServerCallback

_bc.getPushNotificationService().sendRawPushNotificationBatch(profileIds, fcmContent, iosContent, facebookContent, 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()));
}
```

**JavaScript:**

```javascript
var profileIds = [ "a-profile-id", "another-profile-id" ];
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"
};

_bc.pushNotification.sendRawPushNotificationBatch(profileIds, fcmContent, iosContent, facebookContent, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  profileIds = [ "a-profile-id", "another-profile-id" ];
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"
};

ServerResponse result = await _bc.pushNotificationService.sendRawPushNotificationBatch(profileIds:profileIds, fcmContent:fcmContent, iosContent:iosContent, facebookContent:facebookContent);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local profileIds = { "a-profile-id", "another-profile-id" }
local fcmContent = {
    notification = {
        body = "content of message",
        title = "message title"
    },
    data = {
        customfield1 = "customValue1",
        customfield2 = "customValue2"
    },
    priority = "normal"
}
local iosContent = {
    aps = {
        alert = {
            body = "content of message",
            title = "message title"
        },
        badge = 0,
        sound = "gggg"
    }
}
local facebookContent = {
    template = "content of message"
}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:sendRawPushNotificationBatch(profileIds, fcmContent, iosContent, facebookContent, callback)
```

**GDScript:**

```gdscript
var profile_ids = [ "a-profile-id", "another-profile-id" ]
var fcm_content = {
    "notification": {
        "body": "content of message",
        "title": "message title"
    },
    "data": {
        "customfield1": "customValue1",
        "customfield2": "customValue2"
    },
    "priority": "normal"
}
var ios_content = {
    "aps": {
        "alert": {
            "body": "content of message",
            "title": "message title"
        },
        "badge": 0,
        "sound": "gggg"
    }
}
var facebook_content = {
    "template": "content of message"
}

var result = await _bc.push_notification_service.send_raw_push_notification_batch(profile_ids, fcm_content, ios_content, facebook_content)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local profileIds = { "a-profile-id", "another-profile-id" }
local fcmContent = {
    notification = { body = "content of message", title = "message title" },
    data = { customfield1 = "customValue1", customfield2 = "customValue2" },
    priority = "normal"
}
local iosContent = {
    aps = {
        alert = { body = "content of message", title = "message title" },
        badge = 0,
        sound = "gggg"
    }
}
local facebookContent = { template = "content of message" }

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:sendRawPushNotificationBatch(profileIds, fcmContent, iosContent, facebookContent, callback)
```

**Cloud Code:**

```cfscript
var profileIds = [ "a-profile-id", "another-profile-id" ];
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 pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.sendRawPushNotificationBatch(profileIds, fcmContent, iosContent, facebookContent);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SEND_RAW_BATCH",
    "data": {
        "profileIds": [
            "the-profile-id",
            "another-profile-id"
        ],
        "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"
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "status": 200,
    "data": null
}
```
</details>


---

<!-- source: docs/api/2_capi/pushnotification/sendrawpushnotificationtogroup.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/pushnotification/sendrawpushnotificationtogroup -->

# SendRawPushNotificationToGroup

Sends a notification to a "group" of user consisting of raw message content.

| Service | Operation |
| ------- | --------- |
| pushNotification | SEND_RAW_TO_GROUP |

## Method Parameters
Parameter | Description
--------- | -----------
groupId | Target group ID
fcmContent | FCM dependent content
iosContent | IOS (APNS) dependent content
facebookContent | Facebook dependent content

## Usage

**C#:**

```csharp
string groupId = "group1";
string fcmContent = "{\"notification\":{\"body\":\"content of message\",\"title\":\"message title\"},\"data\":{\"customfield1\":\"customValue1\",\"customfield2\":\"customValue2\"},\"priority\":\"normal\"}";
string iosContent = "{\"aps\":{\"alert\":{\"body\":\"content of message\",\"title\":\"message title\"},\"badge\":0,\"sound\":\"gggg\"}}";
string facebookContent = "{\"template\":\"content of message\"}";
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.SendRawPushNotificationToGroup(groupId, fcmContent, iosContent, facebookContent, successCallback, failureCallback);
```

**C++:**

```cpp
const char *groupId = "group1";
const char *fcmContent = "{\"notification\":{\"body\":\"content of message\",\"title\":\"message title\"},\"data\":{\"customfield1\":\"customValue1\",\"customfield2\":\"customValue2\"},\"priority\":\"normal\"}";
const char *iosContent = "{\"aps\":{\"alert\":{\"body\":\"content of message\",\"title\":\"message title\"},\"badge\":0,\"sound\":\"gggg\"}}";
const char *facebookContent = "{\"template\":\"content of message\"}";
_bc->getPushNotificationService()->sendRawPushNotificationToGroup(groupId, fcmContent, iosContent, facebookContent, this);
```

**Obj-C:**

```objectivec
NSString *groupId = @"group1";
NSString *fcmContent = @"{\"notification\":{\"body\":\"content of message\",\"title\":\"message title\"},\"data\":{\"customfield1\":\"customValue1\",\"customfield2\":\"customValue2\"},\"priority\":\"normal\"}";
NSString *iosContent = @"{\"aps\":{\"alert\":{\"body\":\"content of message\",\"title\":\"message title\"},\"badge\":0,\"sound\":\"gggg\"}}";
NSString *facebookContent = @"{\"template\":\"content of message\"}";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc pushNotificationService] sendRawPushNotificationToGroup:groupId
                 fcmContent:fcmContent
                 iosContent:iosContent
            facebookContent:facebookContent
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String groupId = "group1";
String fcmContent = "{\"notification\":{\"body\":\"content of message\",\"title\":\"message title\"},\"data\":{\"customfield1\":\"customValue1\",\"customfield2\":\"customValue2\"},\"priority\":\"normal\"}";
String iosContent = "{\"aps\":{\"alert\":{\"body\":\"content of message\",\"title\":\"message title\"},\"badge\":0,\"sound\":\"gggg\"}}";
String facebookContent = "{\"template\":\"content of message\"}";
this; // implements IServerCallback

_bc.getPushNotificationService().sendRawPushNotificationToGroup(groupId, fcmContent, iosContent, facebookContent, 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()));
}
```

**JavaScript:**

```javascript
var groupId = "group1";
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"
};

_bc.pushNotification.sendRawPushNotificationToGroup(groupId, fcmContent, iosContent, facebookContent, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  groupId = "group1";
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"
};

ServerResponse result = await _bc.pushNotificationService.sendRawPushNotificationToGroup(groupId:groupId, fcmContent:fcmContent, iosContent:iosContent, facebookContent:facebookContent);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local groupId = "group1"
local fcmContent = {
    notification = {
        body = "content of message",
        title = "message title"
    },
    data = {
        customfield1 = "customValue1",
        customfield2 = "customValue2"
    },
    priority = "normal"
}
local iosContent = {
    aps = {
        alert = {
            body = "content of message",
            title = "message title"
        },
        badge = 0,
        sound = "gggg"
    }
}
local facebookContent = {
    template = "content of message"
}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:sendRawPushNotificationToGroup(groupId, fcmContent, iosContent, facebookContent, callback)
```

**GDScript:**

```gdscript
var group_id = "group1"
var fcm_content = {
    "notification": {
        "body": "content of message",
        "title": "message title"
    },
    "data": {
        "customfield1": "customValue1",
        "customfield2": "customValue2"
    },
    "priority": "normal"
}
var ios_content = {
    "aps": {
        "alert": {
            "body": "content of message",
            "title": "message title"
        },
        "badge": 0,
        "sound": "gggg"
    }
}
var facebook_content = {
    "template": "content of message"
}

var result = await _bc.push_notification_service.send_raw_push_notification_to_group(group_id, fcm_content, ios_content, facebook_content)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local groupId = "group1"
local fcmContent = {
    notification = { body = "content of message", title = "message title" },
    data = { customfield1 = "customValue1", customfield2 = "customValue2" },
    priority = "normal"
}
local iosContent = {
    aps = {
        alert = { body = "content of message", title = "message title" },
        badge = 0,
        sound = "gggg"
    }
}
local facebookContent = { template = "content of message" }

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:sendRawPushNotificationToGroup(groupId, fcmContent, iosContent, facebookContent, callback)
```

**Cloud Code:**

```cfscript
var groupId = "group1";
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 pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.sendRawPushNotificationToGroup(groupId, fcmContent, iosContent, facebookContent);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SEND_RAW_TO_GROUP",
    "data": {
        "groupId": "group1",
        "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"
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "status": 200,
    "data": null
}
```
</details>


---

<!-- source: docs/api/2_capi/pushnotification/sendrawpushtocustomquery.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/pushnotification/sendrawpushtocustomquery -->

# 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

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
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!
}
```

**Raw:**

```r
{
  "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"
      }
    }
  }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {},
    "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/pushnotification/sendrichpushnotification.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/pushnotification/sendrichpushnotification -->

# 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

**C#:**

```csharp
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);
```

**C++:**

```cpp
const char *toProfileId = "profile1";
int notificationTemplateId = 1;
_bc->getPushNotificationService()->sendRichPushNotification(toProfileId, notificationTemplateId, this);
```

**Obj-C:**

```objectivec
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];
```

**Java:**

```java
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()));
}
```

**JavaScript:**

```javascript
var toProfileId = "profile1";
var notificationTemplateId = 1;

_bc.pushNotification.sendRichPushNotification(toProfileId, notificationTemplateId, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
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}");
}
```

**Roblox:**

```lua
local toProfileId = "profile1"
local notificationTemplateId = 1

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:sendRichPushNotification(toProfileId, notificationTemplateId, callback)
```

**GDScript:**

```gdscript
var to_profile_id = "profile1"
var notification_template_id = 1

var result = await _bc.push_notification_service.send_rich_push_notification(to_profile_id, notification_template_id)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local toProfileId = "profile1"
local notificationTemplateId = 1

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:sendRichPushNotification(toProfileId, notificationTemplateId, callback)
```

**Cloud Code:**

```cfscript
var toProfileId = "profile1";
var notificationTemplateId = 1;
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.sendRichPushNotification(toProfileId, notificationTemplateId);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SEND_RICH",
    "data": {
        "toProfileId": "profile1",
        "notificationTemplateId": 1,
        "substitutions": {
            "0": "value0",
            "1": "value1"
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": null,
    "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/pushnotification/sendrichpushnotificationwithparams.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/pushnotification/sendrichpushnotificationwithparams -->

# SendRichPushNotificationWithParams

Sends a notification to a user based on a brainCloud portal configured notification template and includes JSON defining the substitution params to use with the template.

The format of the parameterized string is based on the MessageFormat java class.

A typical parameterized string could be "Hello {1}, welcome to the {0} game."".

The substitution values are passed via a JSON structure as follows:

`{ "1" : "George Smith", "0" : "Poker Pirates" }`

Note that the key of the JSON object is the substitution variable number and the value is the substitution value.

The resulting string would be "Hello George Smith, welcome to the Poker Pirates game.".

| Service | Operation |
| ------- | --------- |
| pushNotification | SEND_RICH |

## Method Parameters

| Parameter              | Description                                                    |
| ---------------------- | -------------------------------------------------------------- |
| toProfileId            | The profileId of the user to receive the notification          |
| notificationTemplateId | Id of the notification template                                |
| substitutionJson       | JSON defining the substitution params to use with the template |

## Usage

**C#:**

```csharp
string toProfileId = "profile1";
int notificationTemplateId = 1;
string substitutionJson = "{\"0\":\"value0\",\"1\":\"value1\"}";
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.SendRichPushNotificationWithParams(toProfileId, notificationTemplateId, substitutionJson, successCallback, failureCallback);
```

**C++:**

```cpp
const char *toProfileId = "profile1";
int notificationTemplateId = 1;
const char *substitutionJson = "{\"0\":\"value0\",\"1\":\"value1\"}";
_bc->getPushNotificationService()->sendRichPushNotificationWithParams(toProfileId, notificationTemplateId, substitutionJson, this);
```

**Obj-C:**

```objectivec
NSString *toProfileId = @"profile1";
int notificationTemplateId = 1;
NSString *substitutionJson = @"{\"0\":\"value0\",\"1\":\"value1\"}";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc pushNotificationService] sendRichPushNotificationWithParams:toProfileId
     notificationTemplateId:notificationTemplateId
           substitutionJson:substitutionJson
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String toProfileId = "profile1";
int notificationTemplateId = 1;
String substitutionJson = "{\"0\":\"value0\",\"1\":\"value1\"}";
this; // implements IServerCallback

_bc.getPushNotificationService().sendRichPushNotificationWithParams(toProfileId, notificationTemplateId, substitutionJson, 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()));
}
```

**JavaScript:**

```javascript
var toProfileId = "profile1";
var notificationTemplateId = 1;
var substitutionJson = {
    "0": "value0",
    "1": "value1"
};

_bc.pushNotification.sendRichPushNotificationWithParams(toProfileId, notificationTemplateId, substitutionJson, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  toProfileId = "profile1";
var  notificationTemplateId = 1;
var  substitutionJson = {
    "0": "value0",
    "1": "value1"
};

ServerResponse result = await _bc.pushNotificationService.sendRichPushNotificationWithParams(profileId:toProfileId, notificationTemplateId:notificationTemplateId, substitution:substitutionJson);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local toProfileId = "profile1"
local notificationTemplateId = 1
local substitutionJson = {
    ["0"] = "value0",
    ["1"] = "value1"
}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:sendRichPushNotificationWithParams(toProfileId, notificationTemplateId, substitutionJson, callback)
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
local toProfileId = "profile1"
local notificationTemplateId = 1
local substitutionJson = { ["0"] = "value0", ["1"] = "value1" }

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:sendRichPushNotificationWithParams(toProfileId, notificationTemplateId, substitutionJson, callback)
```

**Cloud Code:**

```cfscript
var toProfileId = "profile1";
var notificationTemplateId = 1;
var substitutionJson = {
    "0": "value0",
    "1": "value1"
};
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.sendRichPushNotificationWithParams(toProfileId, notificationTemplateId, substitutionJson);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SEND_RICH",
    "data": {
        "toProfileId": "profile1",
        "notificationTemplateId": 1,
        "substitutions": {
            "0": "value0",
            "1": "value1"
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": null,
    "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/pushnotification/sendsimplepushnotification.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/pushnotification/sendsimplepushnotification -->

# SendSimplePushNotification

Sends a simple push notification based on the passed in message.

| Service | Operation |
| ------- | --------- |
| pushNotification | SEND_SIMPLE |

## Method Parameters

| Parameter   | Description                                            |
| ----------- | ------------------------------------------------------ |
| toProfileId | The profileId of the user to receive the notification. |
| message     | The content of the message.                            |

## Usage

**C#:**

```csharp
string toProfileId = "profile1";
string message = "Hello World";
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.SendSimplePushNotification(toProfileId, message, successCallback, failureCallback);
```

**C++:**

```cpp
const char *toProfileId = "profile1";
const char *message = "Hello World";
_bc->getPushNotificationService()->sendSimplePushNotification(toProfileId, message, this);
```

**Obj-C:**

```objectivec
NSString *toProfileId = @"profile1";
NSString *message = @"Hello World";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc pushNotificationService] sendSimplePushNotification:toProfileId
                    message:message
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String toProfileId = "profile1";
String message = "Hello World";
this; // implements IServerCallback

_bc.getPushNotificationService().sendSimplePushNotification(toProfileId, message, 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()));
}
```

**JavaScript:**

```javascript
var toProfileId = "profile1";
var message = "Hello World";

_bc.pushNotification.sendSimplePushNotification(toProfileId, message, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  toProfileId = "profile1";
var  message = "Hello World";

ServerResponse result = await _bc.pushNotificationService.sendSimplePushNotification(profileId:toProfileId, message:message);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local toProfileId = "profile1"
local message = "Hello World"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:sendSimplePushNotification(toProfileId, message, callback)
```

**GDScript:**

```gdscript
var to_profile_id = "profile1"
var message = "Hello World"

var result = await _bc.push_notification_service.send_simple_push_notification(to_profile_id, message)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local toProfileId = "profile1"
local message = "Hello World"

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:sendSimplePushNotification(toProfileId, message, callback)
```

**Cloud Code:**

```cfscript
var toProfileId = "profile1";
var message = "Hello World";
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.sendSimplePushNotification(toProfileId, message);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SEND_SIMPLE",
    "data": {
        "toProfileId": "profile1",
        "message": "Hello World"
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": null,
    "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/pushnotification/sendtemplatedpushnotificationtogroup.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/pushnotification/sendtemplatedpushnotificationtogroup -->

# 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.

The format of the parameterized string is based on the MessageFormat java class.

A typical parameterized string could be "Hello {1}, welcome to the {0} game."".

The substitution values are passed via a JSON structure as follows:

`{ "1" : "George Smith", "0" : "Poker Pirates" }`

Note that the key of the JSON object is the substitution variable number and the value is the substitution value.

The resulting string would be "Hello George Smith, welcome to the Poker Pirates game.".

| Service | Operation |
| ------- | --------- |
| pushNotification | SEND_TEMPLATED_TO_GROUP |

## Method Parameters

| Parameter              | Description                                                    |
| ---------------------- | -------------------------------------------------------------- |
| groupId                | Target group ID                                                |
| notificationTemplateId | Id of the notification template                                |
| substitutionJson       | JSON defining the substitution params to use with the template |

## Usage

**C#:**

```csharp
string groupId = "group1";
int notificationTemplateId = 1;
string substitutionsJson = "{\"0\":\"value0\",\"1\":\"value1\"}";
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.SendTemplatedPushNotificationToGroup(groupId, notificationTemplateId, substitutionsJson, successCallback, failureCallback);
```

**C++:**

```cpp
const char *groupId = "group1";
int notificationTemplateId = 1;
const char *substitutionsJson = "{\"0\":\"value0\",\"1\":\"value1\"}";
_bc->getPushNotificationService()->sendTemplatedPushNotificationToGroup(groupId, notificationTemplateId, substitutionsJson, this);
```

**Obj-C:**

```objectivec
NSString *groupId = @"group1";
int notificationTemplateId = 1;
NSString *substitutionsJson = @"{\"0\":\"value0\",\"1\":\"value1\"}";
BCCompletionBlock successBlock;      // define callback
BCErrorCompletionBlock failureBlock; // define callback

[[_bc pushNotificationService] sendTemplatedPushNotificationToGroup:groupId
     notificationTemplateId:notificationTemplateId
          substitutionsJson:substitutionsJson
            completionBlock:successBlock
       errorCompletionBlock:failureBlock
                   cbObject:nil];
```

**Java:**

```java
String groupId = "group1";
int notificationTemplateId = 1;
String substitutionsJson = "{\"0\":\"value0\",\"1\":\"value1\"}";
this; // implements IServerCallback

_bc.getPushNotificationService().sendTemplatedPushNotificationToGroup(groupId, notificationTemplateId, substitutionsJson, 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()));
}
```

**JavaScript:**

```javascript
var groupId = "group1";
var notificationTemplateId = 1;
var substitutionsJson = {
    "0": "value0",
    "1": "value1"
};

_bc.pushNotification.sendTemplatedPushNotificationToGroup(groupId, notificationTemplateId, substitutionsJson, result =>
{
    var status = result.status;
    console.log(status + " : " + JSON.stringify(result, null, 2));
});
```

**Dart:**

```dart
var  groupId = "group1";
var  notificationTemplateId = 1;
var  substitutionsJson = {
    "0": "value0",
    "1": "value1"
};

ServerResponse result = await _bc.pushNotificationService.sendTemplatedPushNotificationToGroup(groupId:groupId, notificationTemplateId:notificationTemplateId, substitutions:substitutionsJson);

if (result.statusCode == 200) {
    print("Success");
} else {
    print("Failed ${result.error['status_message'] ?? result.error}");
}
```

**Roblox:**

```lua
local groupId = "group1"
local notificationTemplateId = 1
local substitutionsJson = {
    ["0"] = "value0",
    ["1"] = "value1"
}

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:sendTemplatedPushNotificationToGroup(groupId, notificationTemplateId, substitutionsJson, callback)
```

**GDScript:**

```gdscript
var group_id = "group1"
var notification_template_id = 1
var substitutions_json = {
    "0": "value0",
    "1": "value1"
}

var result = await _bc.push_notification_service.send_templated_push_notification_to_group(group_id, notification_template_id, substitutions_json)

if result.status == 200:
	print("Success")
else:
	print("Failed: %s" % result.status_message)
```

**Lua:**

```lua
local groupId = "group1"
local notificationTemplateId = 1
local substitutionJson = { ["0"] = "value0", ["1"] = "value1" }

local callback = function(success, response)
    if success then
        print("Success")
    else
        print("Failed | " .. tostring(response.status_message))
    end
end

_bc.pushNotification:sendTemplatedPushNotificationToGroup(groupId, notificationTemplateId, substitutionJson, callback)
```

**Cloud Code:**

```cfscript
var groupId = "group1";
var notificationTemplateId = 1;
var substitutionsJson = {
    "0": "value0",
    "1": "value1"
};
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.sendTemplatedPushNotificationToGroup(groupId, notificationTemplateId, substitutionsJson);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SEND_TEMPLATED_TO_GROUP",
    "data": {
        "groupId": "group1",
        "notificationTemplateId": 1,
        "substitutions": {
            "0": "value0",
            "1": "value1"
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": null,
    "status": 200
}
```

</details>


---

<!-- source: docs/api/2_capi/pushnotification/sysgetnotificationtemplates.md -->
<!-- url: https://docs.braincloudservers.com/api/capi/pushnotification/sysgetnotificationtemplates -->

# SysGetNotificationTemplates

Returns an array of the notification templates defined - with the text for the specified language.

| Service | Operation |
| ------- | --------- |
| pushNotification | SYS_GET_NOTIFICATION_TEMPLATES |

## Method Parameters
Parameter | Description
--------- | -----------
defaultLanguageCode | The language code (lowercase) to be used for returning the default message text.

## Usage

**C#:**

```csharp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**C++:**

```cpp
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Obj-C:**

```objectivec
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Java:**

```java
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**JavaScript:**

```javascript
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Dart:**

```dart
// Cloud Code only. To view example, switch to the Cloud Code tab
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- Cloud Code only. To view example, switch to the Cloud Code tab
```

**Cloud Code:**

```cfscript
var defaultLanguageCode = "en";
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.sysGetNotificationTemplates(defaultLanguageCode);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SYS_GET_NOTIFICATION_TEMPLATES",
    "data": {
        "defaultLanguageCode": "en",
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "pushTemplates": 
        [
            {
                "notificationTemplateId" : 1,
                "name" : "awesomeSaleNotification",
                "defaultMessage" : "This is english text!",
                "updatedAt" : 1591730181151
            },
            {

                "notificationTemplateId" : 2,
                "name" : "anotherNotification",
                "message" : "This is another notification",
                "updatedAt" : 1591734121222
            }
        ]
    },
    "status": 200
}
```
</details>


---

<!-- source: docs/api/4_s2s/pushnotification/getallsegments.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/pushnotification/getallsegments -->

# GetAllSegments

Gets the end-user segments for your app.

Segments are manually created on the brainCloud portal, on the **Design | Segmentation | Segments** page.

### Results

| Name        | Description                                                  |
| ----------- | ------------------------------------------------------------ |
| segmentId   | Unique id for the segmentId                                  |
| name        | Readable name of the segmentId                               |
| testersOnly | If segement only applies to end-users flagged as testersOnly |
| description | Readable description of the segment                          |

| Service | Operation |
| ------- | --------- |
| pushNotification | GET_ALL_SEGMENTS |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.getAllSegments();
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "GET_ALL_SEGMENTS",
    "data": {}
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "packetId": 1,
    "messageResponses": [
        {
            "data": {
                "segments": [
                    {
                        "segmentId": 3,
                        "name": "New End-Users",
                        "testersOnly": false,
                        "description": "People that was started in the last 10 days."
                    },
                    {
                        "segmentId": 4,
                        "name": "Recurring End-Users",
                        "testersOnly": false,
                        "description": "People that have been active and have an account older than 10 days."
                    },
                    {
                        "segmentId": 5,
                        "name": "In-Active End-Users",
                        "testersOnly": false,
                        "description": "People that have been in-active and have an account older than 10 days."
                    }
                ]
            },
            "status": 200
        }
    ]
}
```

</details>


---

<!-- source: docs/api/4_s2s/pushnotification/index.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/pushnotification -->

# Push Notifications

This service allows you to send push notifications in the context of an app rather than a user


---

<!-- source: docs/api/4_s2s/pushnotification/schedulenormalizedpushnotifications.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/pushnotification/schedulenormalizedpushnotifications -->

# ScheduleNormalizedPushNotifications

Schedules normalized notifications based on user local time.

### Results

| Name             | Description                                     |
| ---------------- | ----------------------------------------------- |
| notificationJobs | Number of notification jobs/time zones targeted |

| Service | Operation |
| ------- | --------- |
| pushNotification | SCHEDULE_NORMALIZED_NOTIFICATIONS |

## Method Parameters

| Parameter       | Description                                                                             |
| --------------- | --------------------------------------------------------------------------------------- |
| alertContent    | Body and title of message in JSON format.                                               |
| customData      | Custom attributes of message.                                                           |
| segmentCodeList | List of target segment codes. Required, unless the deprecated `segmentIdList` is given. |
| segmentIdList   | Deprecated: list of target segment ids. Use `segmentCodeList` instead.                  |
| localTime       | The scheduled local arrival time.                                                       |
| minimizeJobs    | Optional flag to cause the server to scan players time zones to reduce scope.           |
| startDateUTC    | Optional base date for local time calculation.                                          |

> **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

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var alertContent = {
    "body": "content of message",
    "title": "message title"
};
var customData = {
    "field1": "value1",
    "field2": "value2"
};
var segments = [
    "high_spenders",
    "lapsed_30d"
];
var localTime = "15:00";
var minimizeJobs = true;
var startDateUTC = 1437579786000;
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.scheduleNormalizedPushNotifications(alertContent, customData, segments, localTime, minimizeJobs, startDateUTC);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SCHEDULE_NORMALIZED_NOTIFICATIONS",
    "data": {
        "alertContent": {
            "body": "content of message",
            "title": "message title"
        },
        "customData": {
            "field1": "value1",
            "field2": "value2"
        },
        "segmentCodeList": [
            "high_spenders",
            "lapsed_30d"
        ],
        "localTime": "15:00",
        "minimizeJobs": true,
        "startDateUTC": 1437579786000
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "packetId": 1,
    "messageResponses": [
        {
            "data": {
                "notificationJobs": 3
            },
            "status": 200
        }
    ]
}
```

</details>


---

<!-- source: docs/api/4_s2s/pushnotification/schedulerawpushnotifications.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/pushnotification/schedulerawpushnotifications -->

# ScheduleRawPushNotifications

Schedules raw notifications based on user local time.

### Results

| Name             | Description                                     |
| ---------------- | ----------------------------------------------- |
| notificationJobs | Number of notification jobs/time zones targeted |

| Service | Operation |
| ------- | --------- |
| pushNotification | SCHEDULE_RAW_NOTIFICATIONS |

## Method Parameters

| Parameter       | Description                                                                             |
| --------------- | --------------------------------------------------------------------------------------- |
| fcmContent      | FCM dependent message content.                                                          |
| iosContent      | IOS dependent message content.                                                          |
| facebookContent | Facebook dependent message content.                                                     |
| segmentCodeList | List of target segment codes. Required, unless the deprecated `segmentIdList` is given. |
| segmentIdList   | Deprecated: list of target segment ids. Use `segmentCodeList` instead.                  |
| localTime       | The scheduled local arrival time.                                                       |
| minimizeJobs    | Optional flag to cause the server to scan players time zones to reduce scope.           |
| startDateUTC    | Optional base date for local time calculation.                                          |

> **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

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
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 = [
  1,
  2
];
var localTime = "15:00";
var minimizeJobs = true;
var startDateUTC = 1437579786000;
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.scheduleRawPushNotifications(fcmContent, iosContent, facebookContent, segments, localTime, minimizeJobs, startDateUTC);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SCHEDULE_RAW_NOTIFICATIONS",
    "data": {
        "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"
        },
        "segmentCodeList": [
            "high_spenders",
            "lapsed_30d"
        ],
        "localTime": "15:00",
        "minimizeJobs": true,
        "startDateUTC": 1437579786000
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "packetId": 1,
    "messageResponses": [
        {
            "data": {
                "notificationJobs": 5
            },
            "status": 200
        }
    ]
}
```

</details>


---

<!-- source: docs/api/4_s2s/pushnotification/schedulerichpushnotifications.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/pushnotification/schedulerichpushnotifications -->

# ScheduleRichPushNotifications

Schedules rich notifications based on user local time.

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" }`

### Results

| Name             | Description                                     |
| ---------------- | ----------------------------------------------- |
| notificationJobs | Number of notification jobs/time zones targeted |

| Service | Operation |
| ------- | --------- |
| pushNotification | SCHEDULE_RICH_NOTIFICATIONS |

## Method Parameters

| Parameter              | Description                                                                             |
| ---------------------- | --------------------------------------------------------------------------------------- |
| notificationTemplateId | Identifies the template that will determine the message content.                        |
| segmentCodeList        | List of target segment codes. Required, unless the deprecated `segmentIdList` is given. |
| segmentIdList          | Deprecated: list of target segment ids. Use `segmentCodeList` instead.                  |
| substitutions          | Positional message substitution values.                                                 |
| startDateUTC           | Optional base date for local time calculation.                                          |
| localTime              | The scheduled local arrival time.                                                       |
| minimizeJobs           | Optional flag to cause the server to scan players time zones to reduce scope.           |

> **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

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var notificationTemplateId = 1;
var substitutions = {
    "0": "value0",
    "1": "value1"
};
var segments = [
    "high_spenders",
    "lapsed_30d"
];
var localTime = "15:00";
var minimizeJobs = true;
var startDateUTC = 1437579786000;
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.scheduleRichPushNotifications(notificationTemplateId, substitutions, segments, localTime, minimizeJobs, startDateUTC);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SCHEDULE_RICH_NOTIFICATIONS",
    "data": {
        "notificationTemplateId": 1,
        "segmentCodeList": [
            "high_spenders",
            "lapsed_30d"
        ],
        "substitutions": {
            "0": "value0",
            "1": "value1"
        },
        "startDateUTC": 1437579786000,
        "localTime": "15:00",
        "minimizeJobs": true
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "packetId": 1,
    "messageResponses": [
        {
            "data": {
                "notificationJobs": 4
            },
            "status": 200
        }
    ]
}
```

</details>


---

<!-- source: docs/api/4_s2s/pushnotification/sendnormalizedpushnotificationbatch.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/pushnotification/sendnormalizedpushnotificationbatch -->

# SendNormalizedPushNotificationBatch

Sends a notification to a list of users consisting of alert content and custom data.

| Service | Operation |
| ------- | --------- |
| pushNotification | SEND_NORMALIZED_BATCH |

## Method Parameters

| Parameter    | Description              |
| ------------ | ------------------------ |
| profileIds   | Target list of users.    |
| alertContent | Body and title of alert. |
| customData   | Optional custom data.    |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var profileIds = "the-profile-id,another-profile-id";
var alertContent = {
    "body": "content of message",
    "title": "message title"
};
var customData = {
    "field1": "value1",
    "field2": "value2"
};
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.sendNormalizedPushNotificationBatch(profileIds, alertContent, customData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SEND_NORMALIZED_BATCH",
    "data": {
        "profileIds": [
            "the-profile-id",
            "another-profile-id"
        ],
        "alertContent": {
            "body": "content of message",
            "title": "message title"
        },
        "customData": {
            "field1": "value1",
            "field2": "value2"
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "packetId": 1,
    "messageResponses": [
        {
            "data": null,
            "status": 200
        }
    ]
}
```

</details>


---

<!-- source: docs/api/4_s2s/pushnotification/sendnormalizedpushnotificationtogroup.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/pushnotification/sendnormalizedpushnotificationtogroup -->

# SendNormalizedPushNotificationToGroup

Sends a notification to a "group" of user consisting of alert content and custom data.

See the Portal documentation for more info.

| Service | Operation |
| ------- | --------- |
| pushNotification | SEND_NORMALIZED_TO_GROUP |

## Method Parameters

| Parameter    | Description              |
| ------------ | ------------------------ |
| groupId      | The target group.        |
| senderId     | Optional id of sender.   |
| alertContent | Body and title of alert. |
| customData   | Optional custom data.    |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var groupId = "group1";
var senderId = "playerId";
var alertContent = {
    "body": "content of message",
    "title": "message title"
};
var customData = {
    "field1": "value1",
    "field2": "value2"
};
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.sendNormalizedPushNotificationToGroup(groupId, senderId, alertContent, customData);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SEND_NORMALIZED_TO_GROUP",
    "data": {
        "groupId": "group1",
        "senderId": "playerId",
        "alertContent": {
            "body": "content of message",
            "title": "message title"
        },
        "customData": {
            "field1": "value1",
            "field2": "value2"
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "packetId": 1,
    "messageResponses": [
        {
            "data": null,
            "status": 200
        }
    ]
}
```

</details>


---

<!-- source: docs/api/4_s2s/pushnotification/sendnormalizedtosegments.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/pushnotification/sendnormalizedtosegments -->

# SendNormalizedToSegments

This operation sends a normalized message to multiple user targets.

### Results

| Name             | Description                       |
| ---------------- | --------------------------------- |
| estimatedTargets | Estimate number of targeted users |

| Service | Operation |
| ------- | --------- |
| pushNotification | SEND_NORMALIZED_TO_SEGMENTS |

## Method Parameters

| Parameter       | Description                                                            |
| --------------- | ---------------------------------------------------------------------- |
| alertContent    | Body and title of message in JSON format.                              |
| customData      | Custom parameters to include in message.                               |
| segmentCodeList | List of target segment codes. Omit to send to all users.               |
| segmentIdList   | Deprecated: list of target segment ids. Use `segmentCodeList` instead. |

> **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

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var alertContent = {
    "body": "content of message",
    "title": "message title"
};
var customData = {
    "field1": "value1",
    "field2": "value2"
};
var segments = [
    "high_spenders",
    "lapsed_30d"
];
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.sendNormalizedToSegments(alertContent, customData, segments);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SEND_NORMALIZED_TO_SEGMENTS",
    "data": {
        "alertContent": {
            "body": "content of message",
            "title": "message title"
        },
        "customData": {
            "field1": "value1",
            "field2": "value2"
        },
        "segmentCodeList": [
            "high_spenders",
            "lapsed_30d"
        ]
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "packetId": 1,
    "messageResponses": [
        {
            "data": {
                "estimatedTargets": 1234
            },
            "status": 200
        }
    ]
}
```

</details>


---

<!-- source: docs/api/4_s2s/pushnotification/sendrawpushnotificationbatch.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/pushnotification/sendrawpushnotificationbatch -->

# SendRawPushNotificationBatch

Sends a notification to a list of users consisting of raw message content.

| Service | Operation |
| ------- | --------- |
| pushNotification | SEND_RAW_BATCH |

## Method Parameters

| Parameter       | Description                         |
| --------------- | ----------------------------------- |
| profileIds      | Target list of users.               |
| fcmContent      | FCM dependent message content.      |
| iosContent      | IOS dependent message content.      |
| facebookContent | Facebook dependent message content. |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var profileIds = [
    "the-profile-id",
    "another-profile-id"
];
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 pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.sendRawPushNotificationBatch(profileIds, fcmContent, iosContent, facebookContent);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SEND_RAW_BATCH",
    "data": {
        "profileIds": [
            "the-profile-id",
            "another-profile-id"
        ],
        "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"
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "packetId": 1,
    "messageResponses": [
        {
            "data": null,
            "status": 200
        }
    ]
}
```

</details>


---

<!-- source: docs/api/4_s2s/pushnotification/sendrawpushnotificationtogroup.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/pushnotification/sendrawpushnotificationtogroup -->

# SendRawPushNotificationToGroup

Sends a notification to a "group" of user consisting of raw message content.

See the Portal documentation for more info.

| Service | Operation |
| ------- | --------- |
| pushNotification | SEND_RAW_TO_GROUP |

## Method Parameters

| Parameter       | Description                         |
| --------------- | ----------------------------------- |
| groupId         | The target group.                   |
| senderId        | Optional id of sender.              |
| fcmContent      | FCM dependent message content.      |
| iosContent      | IOS dependent message content.      |
| facebookContent | Facebook dependent message content. |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var groupId = "group1";
var senderId = "playerId";
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 pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.sendRawPushNotificationToGroup(groupId, senderId, fcmContent, iosContent, facebookContent);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SEND_RAW_TO_GROUP",
    "data": {
        "groupId": "group1",
        "senderId": "playerId",
        "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"
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "packetId": 1,
    "messageResponses": [
        {
            "data": null,
            "status": 200
        }
    ]
}
```

</details>


---

<!-- source: docs/api/4_s2s/pushnotification/sendrawtosegments.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/pushnotification/sendrawtosegments -->

# 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

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
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!
}
```

**Raw:**

```r
{
    "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"
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "packetId": 1,
    "messageResponses": [
        {
            "data": {
                "estimatedTargets": 1234
            },
            "status": 200
        }
    ]
}
```

</details>


---

<!-- source: docs/api/4_s2s/pushnotification/sendrichtosegments.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/pushnotification/sendrichtosegments -->

# SendRichToSegments

This operation sends a template based message to multiple user targets.

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" }`

### Results

| Name             | Description                       |
| ---------------- | --------------------------------- |
| estimatedTargets | Estimate number of targeted users |

| Service | Operation |
| ------- | --------- |
| pushNotification | SEND_RICH_TO_SEGMENTS |

## Method Parameters

| Parameter              | Description                                                            |
| ---------------------- | ---------------------------------------------------------------------- |
| notificationTemplateId | Identifies the template that will determine the message content.       |
| segmentCodeList        | List of target segment codes. Omit to send to all users.               |
| segmentIdList          | Deprecated: list of target segment ids. Use `segmentCodeList` instead. |
| substitutions          | Positional message substitution values.                                |

> **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

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var notificationTemplateId = 1;
var substitutions = {
    "0": "value0",
    "1": "value1"
};
var segments = [
    "high_spenders",
    "lapsed_30d"
];
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.sendRichToSegments(notificationTemplateId, substitutions, segments);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SEND_RICH_TO_SEGMENTS",
    "data": {
        "notificationTemplateId": 1,
        "segmentCodeList": [
            "high_spenders",
            "lapsed_30d"
        ],
        "substitutions": {
            "0": "value0",
            "1": "value1"
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "packetId": 1,
    "messageResponses": [
        {
            "data": {
                "estimatedTargets": 1234
            },
            "status": 200
        }
    ]
}
```

</details>


---

<!-- source: docs/api/4_s2s/pushnotification/sendsimple.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/pushnotification/sendsimple -->

# SendSimple

This operation sends a simple message to multiple user targets.

### Results

| Name             | Description                        |
| ---------------- | ---------------------------------- |
| estimatedTargets | Estimate number of targeted users. |

| Service | Operation |
| ------- | --------- |
| pushNotification | SEND_SIMPLE |

## Method Parameters

| Parameter       | Description                                                            |
| --------------- | ---------------------------------------------------------------------- |
| message         | The content of the message.                                            |
| segmentCodeList | List of target segment codes. Omit to send to all users.               |
| segmentIdList   | Deprecated: list of target segment ids. Use `segmentCodeList` instead. |

> **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

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var message = "Hello World";
var segments = [
    "high_spenders",
    "lapsed_30d"
];
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.sendSimplePushNotification(message, segments);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SEND_SIMPLE",
    "data": {
        "message": "Hello World",
        "segmentCodeList": [
            "high_spenders",
            "lapsed_30d"
        ]
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "packetId": 1,
    "messageResponses": [
        {
            "data": {
                "estimatedTargets": 1234
            },
            "status": 200
        }
    ]
}
```

</details>


---

<!-- source: docs/api/4_s2s/pushnotification/sendtemplatedpushnotificationtogroup.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/pushnotification/sendtemplatedpushnotificationtogroup -->

# 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

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
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!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SEND_TEMPLATED_TO_GROUP",
    "data": {
        "groupId": "group1",
        "senderId": "playerId",
        "notificationTemplateId": 1,
        "substitutions": {
            "0": "value0",
            "1": "value1"
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "packetId": 1,
    "messageResponses": [
        {
            "data": null,
            "status": 200
        }
    ]
}
```

</details>


---

<!-- source: docs/api/4_s2s/pushnotification/sysgetnotificationtemplates.md -->
<!-- url: https://docs.braincloudservers.com/api/s2s/pushnotification/sysgetnotificationtemplates -->

# SysGetNotificationTemplates

Returns an array of the notification templates defined - with the text for the specified language.

| Service | Operation |
| ------- | --------- |
| pushNotification | SYS_GET_NOTIFICATION_TEMPLATES |

## Method Parameters

| Parameter           | Description                                                                      |
| ------------------- | -------------------------------------------------------------------------------- |
| defaultLanguageCode | The language code (lowercase) to be used for returning the default message text. |

## Usage

**C#:**

```csharp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**C++:**

```cpp
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Obj-C:**

```objectivec
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Java:**

```java
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**JavaScript:**

```javascript
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Dart:**

```dart
// S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Roblox:**

```lua
-- N/A
```

**GDScript:**

```gdscript
N/A
```

**Lua:**

```lua
-- S2S call: to view example, switch to the Cloud Code or Raw tab.
```

**Cloud Code:**

```cfscript
var defaultLanguageCode = "en";
var pushNotificationProxy = bridge.getPushNotificationServiceProxy();

var postResult = pushNotificationProxy.sysGetNotificationTemplates(defaultLanguageCode);
if (postResult.status == 200) {
    // Success!
}
```

**Raw:**

```r
{
    "service": "pushNotification",
    "operation": "SYS_GET_NOTIFICATION_TEMPLATES",
    "data": {
        "defaultLanguageCode": "en",
        }
    }
}
```

<details>
<summary>JSON Response</summary>

```json
{
    "data": {
        "pushTemplates": [
            {
                "notificationTemplateId": 1,
                "name": "awesomeSaleNotification",
                "defaultMessage": "This is english text!",
                "updatedAt": 1591730181151
            },
            {
                "notificationTemplateId": 2,
                "name": "anotherNotification",
                "message": "This is another notification",
                "updatedAt": 1591734121222
            }
        ]
    },
    "status": 200
}
```

</details>
