Last Updated: 7/19/2021, 5:51:46 AM

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

# Permissions

Make sure you’re authorized to use our services and have the following permissions (opens new window) before you attempt to manage players’ notifications:

Usage Resource Action
Create a Notification Topic ADMIN:NAMESPACE:{namespace}:NOTIFICATION Create
Send a Freeform Notification to a User ADMIN:NAMESPACE:{namespace}:NOTIFICATION Create
Create a Notification Template ADMIN:NAMESPACE:{namespace}:NOTIFICATION Create
Send a Templated Notification ADMIN:NAMESPACE:{namespace}:NOTIFICATION Create

# Managing Notifications in the Admin Portal

The Admin Portal gives community managers and game admins an easy way to manage players’ notifications.

# Create a Notification Topic

To create or maintain notification topics in the Admin Portal, follow the steps below.

  1. In the Game Management section of the Admin Portal, go to the Push Notifications section and click the Topics menu. Then click the New Topic button to add a new topic.

notification

  1. The Add New Topic form appears. Fill in the required fields as seen below

notification

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

notification

# Send a Freeform Notification

By default, sending freeform notifications to individual players from the Admin Portal utilizes synchronous notification. This means that the targeted player must be online to retrieve the message. However, the broadcast feature does not require the player to be online as it sends the message to all players in a namespace, regardless of online status.

  1. On the Template page of the Admin Portal, click the Send Freeform button.

notification

  1. 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 target player’s User ID. If you select All User, the notification will be delivered to all players in the selected namespace.

notificationnotification

When you’re done, click the Send button to send the notification template or click the Cancel button to cancel the process.

# Create a Notification Template

Template notifications utilize an asynchronous method to send a notification to either a single player or to all players. To send a templated notification, create a template by following the steps below.

  1. On the Templates page of the Admin Portal, click the New Template button.

notification

  1. Fill in the Add New Template form with the required fields.

    notification

    • Input the template’s name in the Template field with the appropriate format.
    • Select the template’s Language from the dropdown menu.
    • Input the Notification Message.

Click the Add button. The newly created template will appear on the Notification Templates page.

  1. On the Templates page, you can choose your newly created template and click the View button to open the Template Localization page.

notification

  1. Here you can create a draft of the notification message before you publish it.

notification

After you have created a template for your notification, you are ready to send templated notifications to players.

# Send a Templated Notification

  1. On the Template page of the Admin Portal, click the Send Template button.

notification

  1. In the Send Template window, select which type of player you are going to send the notification to. If you select Single User, you need to input the player’s User ID. If you select All User, the notification will be delivered to all players in the selected namespace.

notificationnotification

When you’re done, click the Send button to send the notification or click the Cancel button to cancel the process.

# Managing Notifications with the SDK

Notifications can be retrieved either synchronously or asynchronously.

# Get Synchronous Notifications

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

You can also filter notifications by topic.

# Get Asynchronous Notifications

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

# Managing Notifications using API

You can also use our API endpoints to manage players’ notifications

# Create a Notification Topic

You can create a notification topic using the API. To do so, follow the steps below:

  1. Use the Create New Notification Topic: POST - /lobby/v1/admin/notification/namespaces/{namespace}/topics (opens new window) endpoint.
  2. Input the Namespace where the configuration belongs.
  3. Fill out the Request Body:
    • Input the Description of the notification.
    • Input the Topic Name with the notification topic. The topic should be alphabets, uppercase, and no space allowed. Only underscore allowed. For example, TOPIC_TEST.

Upon a successful request, the notification topic will be created and will return a 204 response code with no content. (opens new window)

# Send a Freeform Notification to a User

You can send a notification to a user. There are two types of notification: sync and async. Async messages will be stored in the database if the receiver is offline. using the API. To do so, follow the steps below:

  1. Use the Send Freeform Notification To A User: POST - ​/lobby​/v1​/admin​/notification​/namespaces​/{namespace}​/users​/{userId}​/freeform​/notify (opens new window) endpoint.
  2. Input the Namespace where the configuration belongs.
  3. Input the User ID of the user you want to send the notification.
  4. Input the Notification Type. Input with true if the type is async and false if the type is sync.
  5. Fill out the Request Body:
    • Input the Message of the notification.
    • Input the Topic Name with the notification topic. The topic should be alphabets, uppercase, and no space allowed. Only underscore allowed. For example, TOPIC_TEST.

Upon a successful request, the freeform notification will be sent and will return a 204 response code with no content. (opens new window)

# Create a Notification Template

You can create a notification topic using the API. To do so, follow the steps below:

  1. Use the Create New Notification Template: POST - /notification/namespaces/{namespace}/templates (opens new window) endpoint.
  2. Input the Namespace where the configuration belongs.
  3. Fill out the Request Body:
    • Input the Template Content with the content of the notification template.
    • Input the Template Language with the language of the notification content.
    • Input the Template Slug with the title of the template.

Upon a successful request, the notification topic will be created and will return a 204 response code with no content (opens new window).

# Send a Templated Notification

You can send a notification to a user. There are two types of notification: sync and async. Async messages will be stored in the database if the receiver is offline. using the API. To do so, follow the steps below:

  1. Use the Send Freeform Notification To A User: POST - ​/lobby​/v1​/admin​/notification​/namespaces​/{namespace}​/users​/{userId}​/freeform​/notify (opens new window) endpoint.
  2. Input the Namespace where the configuration belongs.
  3. Input the User ID of the user you want to send the notification.
  4. Input the Notification Type. Input with true if the type is async and false if the type is sync.
  5. Fill out the Request Body:
    • Input the Template Content with the content of the notification template.
    • Input the Template Language with the language of the notification content.
    • Input the Template Slug with the title of the template.
    • Input the Topic Name of the Notification.

Upon a successful request, the freeform notification will be sent and will return a 204 response code with no content. (opens new window)