Skip to content

Push Notifications

Push Notifications in ChilliConnect allow you to easily send push messages through the Apple Push Notificaitons Service (APNS), Google Cloud Messaging (GCM), or Amazon Device Messaging (ADM). To start sending Push Notifications, there are three things you need to do

  1. Set Push Service Settings - Provide ChilliConnect with the required information from each push service (APNS, GCM, ADM) you wish to send messages through.

  2. Provide Push Tokens - Using an SDK or invoking the API directly, provide ChilliConnect with Push Tokens from the devices that are to receive Push Messages.

  3. Send Push Notifications - Use the ChilliConnect Dashboard to send Push Notifications to either all players of your game, a specific player, or groups of players with our Push Groups feature.

The help sections below explain each of these steps in detail.

Push Settings

From the Game View, select the Push Settings tab to view the Push Settings for each Push Service. The Edit Push Settings button can then be used to update the Push Configuration for a game.

ConnectPushSettingsEdit

Each Push Service has it's own specific settings that must be provided before you can send Push Notifications through ChilliConnect.

ADM Client ID and Client Secret

To send Push Notifications via the Amazon Device Messaging service, your Client ID and Client Secret must be provided to ChilliConnect. These are available from the Amazon Developer Portal.

  • From the portal home page, select the "Apps & Services" button:

  • Select the App for which you want to configure ChilliConnect to send Push Notifications for:

  • Then select the "Device Messaging" menu option:

  • This will display the security profile associated with the application. If you have not yet associated a security profile with your application, you will be prompted to created one.

  • Select the security profile. This will display the security profile details associated with the application.

From this screen, you should copy the Client ID and Client Secret values in to the ChilliConnect settings dialog.

GCM API Key

To send Push Notifications via the Google Cloud Messaging service, your games API Key must be provided to ChilliConnect. This is available from the Google Developers Console. This is only available for games that have been added under the "Game Services" list in the Google Play Developer Console. Note that the Google Play Developer Console and the Google Developers Console are two different portals - the steps below assume starting from the Google Play Developer Console.

  • From the Google Play Developer Console, select Game Services

  • Select the game for which you want to configure ChilliConnect to send Push Notificaitons. If you have not yet addded your game, you will be prompted to do so.

  • While on the default Game Details view, scroll to the bottom of the page to the "API Console Project" heading. This will contain a link to the associated Google Developers Console project for your game - for example, "This game is linked to the API console project called GCM Test App".

  • From the Google Developers Console, select the "APIs" sub-menu underneath "APIs & auth". Then select the "Cloud Messaging for Android" option from the far right.

  • Ensure that the Cloud Messaging for Android API is enabled for your application. If it is not, press the Enable API button.

  • Select the "Credentials" sub-menu underneath "APIs & auth". If you have not already done so, you will be prompted to create new API credentials. Select "Add Credentials" then the "API Key" option and then Server Key when asked for the Key Type. Once you have given the new key a name, the Key value should be displayed.

From this screen, you should copy the Key in to the ChilliConnect settings dialog.

APNS Certificate

To send Push Notifications via the Apple Push Notification service, you must provide a pem certificate to to ChilliConnect. You can create this certificate by following the steps below:

  • Log in to the Apple Developer Center and select the "AppIDs" menu option under the "Identifiers" menu

  • Select the app which you want to configure ChilliConnect to send Push Notificaitons for. This should display a list of all Application Services for that app. Scroll to the bottom of the list and select the Edit option

  • Again, scroll to the bottom of the list and check the "Push Notifications" checkbox. This should change the Push Notifications state to "Configurable". Press the Create Certificate button.

  • Follow the On Screen instructions to create a CSR using the Mac Keychain Access utility.

  • Upload the CSR file on the next step and then download the generated certificate

  • Download the certificate on to a Mac and double click it to open with the KeyChain Access utility.

  • Locate the certificate within the Push Certificates section of KeyChain

  • Right click and choose to export the certificate as a p12 file.

  • Convert the p12 file to a pem file by running this command at the terminal
openssl pkcs12 -in apns-certificate.p12 -out certificate-for-chilli.pem -nodes -clcerts

Upload the pem file to the ChilliConnect. If you generated a certificate for Development you will also need to check the Sandbox option when uploading the certificate to ChilliConnect.

Push Tokens

Once you have configured the required Push Services, the next step is to start sending Push Tokens from players devices. The actual format of a Push Token is service specific, but they can all be added to ChilliConnect using the RegisterToken method of the Push Notifications API. Push Tokens are recorded against the currently logged in player. A player's Push Tokens can be viewed by first searching for a particular player using the Search function, selecting them, and viewing the Details tab.

Players can have multiple Push Tokens per-service and can also have tokens for multiple services at the same time. To retrieve the Push Token from within your game, you should consult the vendor documentation for each platform. As a starting point, some links to resources have been provided below:

APNS iOS Developer Library
GCM Google Developers
ADM Amazon Developer Console

Push Groups

As well as recording Push Tokens against a Player you may also record up to 10 Push Groups. Push Groups are arbitrary groups that you define that allow you target specific sub sets of your player base. Groups for a player are set using the SetPushGroups method of the Push Notifications API. Groups can be anything you want and do not need to be defined up front. For example, you may wish to target players that are at a specific level in your game, or have completed a specific challenge. Push Groups allow you top identify these players and specifically target them with Push Notifications. A players' Push Groups can be viewed alongside the Push Tokens on the Player View.

Player Push

To send a Push Notification to a single player, press the Send Push Notification button from the Player View.

You can specify a title, body and data of the message to send as well as what services the message should be sent through. Only services where the player has a Push Token, and the relevant Push Settings have been provided will be enabled.

Bulk Push

To send a Push Notification to more players select the Push from the Live Ops menu. This will display the Push Notifications view listing all previously sent and in progress Push Notifications.

To send a new Push Notification press the New Push Notification button.

In the second step of the wizard after specifying the Message to be sent you can choose the segment criteria to filter which Players will receive it. A message can be sent to All Players, those assigned to an AB Test or AB Test and Test Group, a Location white/black list, or attributed to a Push Group.

The final step is to review the number of messages that will be sent and check the confirmation box.

Your Push Notification will then be added to a queue and become visible in the Push Notifications list.

Cloud Script Push

As well as using the ChilliConnect Dashboard to send Push Notifications for sales, marketing and player support purposes, notifications can also be sent programmatically using Cloud Code scripts, allowing you integrate Push with your game mechanics. There are several use cases in which this can be useful - for example, informing a player when a friend has beaten their high score, or notifying a player when it is their turn in a turn based multiplayer game.

To send a Push Notification from a Cloud Code Script, the SendToPlayer or SendToChilliConnectIds methods can be used.

The SendToChilliConnectIds method takes a list of ChilliConnectIDs and optional title, message and data attributes:

var messageSent = false;

var sendTo = ChilliConnect.Request.ChilliConnectID;
var leaderboardKey = ChilliConnect.Request.LeaderboardKey;

var senderDetails = ChilliConnect.PlayerAccounts.getPlayerDetails();

var title = "Oh noes";
var message = senderDetails.DisplayName + " just beat your high score :( Strike back!"
var data = {"LeaderboardKey" : leaderboardKey};

try {
    ChilliConnect.PushNotifications.sendToChilliConnectIds([sendTo], message, ["GCM"], title, data);
    messageSent = true;
}
catch( e)
{
    ChilliConnect.Logger.error("Error:" + e );
}

return { "Sent" : messageSent };

Payload Format

Messages sent with a body (with or without title) will be sent as Alert and Notification types for APNS and GCM respectively. If a message only contains data it will be sent as Silent or Data type for APNS/GCM.

Data is not supported for ADM messages and the Message you provide to ChilliConnect will be placed in a "message" key of the actual Push Message payload.