Skip to main content
All CollectionsPortal-X Pages
Design | Notifications | Templates
Design | Notifications | Templates

Notify your users of important events

Jason Liang avatar
Written by Jason Liang
Updated over 7 months ago

Using Notification Templates allows you to send short messages that draw users back into your app.

​Create notification templates

You can create these notification templates on the brainCloud portal.

Templates can be linked to Promotions, so they pop when you run a sale. Templates can also be easily linked to Tournament events via the Design | Leaderboards | Tournament Templates | Notifications tab. You can also manually send a notification to All your players or a selected group of players defined in Design | Segmentation | Segments.

  • To Create a new message, click the [+Create] button at the upper-right corner of the templates list screen. The Add Notification panel appears.

  • Enter a Name and a message to send.

  • The messages can be localized to every user-facing language your app chooses to support.

  • You can also substitute arguments in the template. For example, if your app requires sending a reminder for the user to pick up an item at a specific time, the template could be created in this format. "Reminder to pick up {0} at {1}." Where {0}, {1], ..., values are substituted for given text values.

  • Be sure to click [Save] when you are done creating the notification message.

Note: To Send Notifications, ensure you have set up notification certificates for your selected platforms in the Design | Notifications | Settings page.

Once your message is ready, you can test sending the notification. Caution: If your app is Live, you probably do not want to test notifications by sending them to All Users. Define a For Testers Only Segment and select that segment from the dropdown list offered when you hit the Send Now button. More on that on the Segment page.


​Writing the code

Besides manually triggering with the brainCloud portal, you can also schedule cloud jobs, or write a script in your app to trigger the templated notification.

As an example, from your app, can send a notification back to the current end-user, to remind them about an event.

In your client code

  • Add the brainCloud client to your app.

  • Pair the client with the dashboard.

  • Authenticate your user into brainCloud.

  • Write your custom logic that would require a templated notification.

  • Send the push notification using ScheduleRichPushNotificationMinutes.

  • Handle the notification rendering, if required by the given platform.

  • Review other achievement-related calls for your app in the API Reference.

void Start() {
// Unity
GameObject go = new GameObject();
_bc = go.AddComponent<BrainCloudWrapper>();
_bc.WrapperName = _wrapperName; // optionally set a wrapper-name
_bc.Init(); // extra data, such as: _appId, _secret and _appVersion, is taken from the brainCloud Unity Plugin.
DontDestroyOnLoad(go); // keep the brainCloud game object through scene changes

_bc.AuthenticateAnonymous((response, cbObject) => { CustomAppLogic(); });
}

void CustomAppLogic() {
// TODO handle your custom app logic that would require a notification to be triggered
// UserSetReminderFor("coffee", "6pm");

var subsitutionsJson = "{\"0\":\"coffee\", \"1\":\"6 pm\"}";
var minutesFromNow = 60 * 3;
var currentEndUser = _bc.Client.ProfileId;

_bc.PushNotificationService.ScheduleRichPushNotificationMinutes(currentEndUser, 1, subsitutionsJson, minutesFromNow,
(response, cbObject) =>
{
Debug.Log("Notification will occur in " + minutesFromNow + " minutes.");
});
}
Did this answer your question?