Notifications

Overview

The notification service enables administrators or publishers to send text based notifications to players. Notifications can be sent from service to service or from service to client application. Notifications are sent using REST API and are relayed through a WebSocket connection, to ensure that they’re received in real-time. The main features of our Notification service are listed below.

  • Synchronous and Asynchronous notifications allow you to time your notifications to arrive when players need them. Synchronous notifications are sent immediately to a player who’s online, and may include party or battle invitations. Asynchronous notifications can be scheduled to be sent to players when they log into your game, and can be used for game announcements or promotions.

  • Freeform and Template notification types allow you control the content of your notifications. Freeform notifications can be used for ad-hoc cases where the publishers need to send a notifications instantly to their players. Templated notifications include draft and localization features that are suitable for more planned use cases, such as game updates or promotional announcements.

  • Notification Topics can group notifications of similar types to keep them organized.

How It Works

Creating a Notifications Topic From the Admin Portal

  1. Select the Notifications sub menu and click Topic to open the Notification Topics page.
  2. Click the New Topic button to open the Add New Topic modal.
  3. Input the topic name in the Topic box.
  4. Input the topic description in the Description box.
  5. Click Add to add a new topic or click Cancel to cancel the process.The new topic will be updated in the Notification Topics panel.
  6. The newly created topic will be visible in the Notification Topics panel. You can view and edit the topic by clicking the Edit button or delete the topic by clicking the Delete button.

Sending Freeform Notifications from the Admin Portal

You can send freeform notifications from admin portal. By default, sending freeform notifications to single user from admin portal utilize synchronous notifications. You have to make sure the targeted user is online in order to retrieve the message. However, the broadcast feature (sending to all users in a namespace) does not require the user to be online. Please continue to the steps below to use our freeform notification feature.

How to Send a Freeform Notifications from the Admin Portal

  1. In the Admin Portal Notification sidebar menu, click Template and after that click the Send Freeform button to open the Send Freeform window.
  2. In the Send Freeform window, select which type of user you are going to send the template to. If you select Single User, you need to input the desired user full User ID. If you select All User, automatically the freeform will be delivered to all users in the selected namespace.
  3. Then, select which topic to address the notification template from the Topic dropdown list.
  4. After that, type your message in the Notification Message box.
  5. Once you are done, click the Send button to send the notification template. If you click the Cancel button, you will cancel the process.

Sending Templated Notifications From the Admin Portal

Similar with the freeform notifications, template notifications utilize synchronous method to send notifications to single user. You have to make sure the targeted user is online in order to retrieve the message. However, the broadcast feature (sending to all users in a namespace) does not require the user to be online. In order to send a templated notifications, you need to create a template. You can create a template from Admin Portal, in doing so, please see the steps below:

How to Create a Notifications Template

  1. Select the Notification sub-menu and click Template to open the Notification Templates page. Select the New Template button to open the Add New Template window.
  2. Input the template name in the Template box.
  3. Select language you are going to use from the Language dropdown menu.
  4. Input the message in the Notification Message box.
  5. Click Add to add the new template or click Cancel to cancel the process.
  6. If you click the Add button, the newly created template will appear in the Notification Templates page.
  7. You can click the View button to open the Template Localization page or click Delete to delete the template.
  8. If you click View, the Template Localization page will appear.
  9. Click the New Language button to open the Add Template Language modal and add a new language for your template.
  10. Select the additional language from the Language dropdown list.
  11. Input message in the Notification Message box.
  12. Click Add to add the additional language setting or click Cancel to cancel the process.
  13. After that, click the View button to open the draft page or click the Delete button to delete the template localization.
  14. Click View to open the draft page where you can manage your notifications message. The Draft panel is where you draft the message and the Published panel is to show the published notifications message. The message in the Draft panel need to be published first by clicking the Publish button before sending the notifications. The notifications in the Published panel is ready to send messages.

After you have created a template for your notifications, now you can send some templated notifications for your users. In doing so, please see the steps below.

How to Send Templated Notifications From the Admin Portal

  1. In the Admin Portal Notification sidebar menu, click Template and after that click the Send Template button to open the Send Template window.
  2. In the Send Template window, select which type of user you are going to send the template to. If you select Single User, you need to input the desired user full User ID. If you select All User, automatically the freeform will be delivered to all users in the selected namespace.
  3. Select which topic to address the notifications template from the Topic dropdown list.
  4. Select which template you are going to use from the Template dropdown list.
  5. Select which template localization you are going to use from the Template Localization dropdown list.
  6. After that, type your message in the Notification Message box.
  7. Once you are done, click the Send button to send the notifications template. If you click the Cancel button, you will cancel the process.

Retrieving Notifications from the SDK

You can retrieve notifications from game by two ways: synchronously and asynchronously.

Getting Synchronous Notifications

To retrieve a synchronous notifications using the SDK, you need to add the notifications delegate.

public static void OnReceiveNotification(Result<Notification> result)
{
Debug.Log(result.IsError);
Debug.Log("There is an incoming notification.");
Debug.Log(result.Value.payload);
}
public static void Main(string[] args)
{
var lobby = AccelBytePlugin.GetLobby();
lobby.OnNotification += OnReceiveNotification;
lobby.Connect();
}

You can also filter the notification by topic.

public static void OnReceiveNotification(Result<Notification> result)
{
Debug.Log(result.IsError);
Debug.Log("There is an incoming notification.");
switch(result.Value.topic){
case "INGAME" : Debug.Log("Game notification: " + result.Value.payload); break;
case "EVENT" : Debug.Log("Event notification: " + result.Value.payload); break;
}
}

Getting Asynchronous Notifications

To get an asynchronous notifications, you just need to call get asynchronous function and all the stored notifications will be sent to your notifications delegate.

lobby.PullAsyncNotifications(result =>
{
Debug.Log(result.IsError);
});

What’s Next?

  • Check out the API Reference to learn more about Notification Services.