Getting Started

Install the Gameball React Native SDK into your app

The Gameball Android and iOS package, enables you to use the show Gameball customer profile in your app, track app customer events, integrate referrals and display Gameball's in-app push notifications.

Installation

Follow the below steps to start installing react native SDK package to your app

  • Install package using npm

npm install --save react-native-gameball
  • Install prerequisite packages using npm

npm install react-native-modal react-native-push-notification-popup

react-native-modal and react-native-push-notification-popup packages are required to use gameball package.

Fetch API is used for network communications, conversion of response to json is needed in order to read the response res => res.json()

Initialization

In order to use Gameball SDK, apply the below step to the main JS file (index or app).

Import Gameball Widget

import {GameballWidget} from ‘react-native-gameball’;

Initialize Gameball Widget

GameballWidget.init({api, lang, shop, platform, deepLinks })

Parameter

Type

Required

Description

api

string

Required

Client API key

lang

string

Optional

Your platform language preference to view Gameball Widget with.

Note: The language provided should be as per configured languages in your account. If not provided the Gameball profile widget will be shown with your account default language

Example: "en", "fr".

shop

string

Optional

Shopify store name with myshopify.com domain. Used if your app is a mobile app for a shopify store connected to Gameball

platform

string

Optional

Platform used, for example (shopify)

deeplinks

string []

Optional

apiPrefix

string

Optional

Api url prefix

widgetUrlPrefix

string

Optional

Widget url prefix

Register Customer

Register player method is used to create or update customers at Gameball. It is called when your login network call is successful.

First, import Gameball SDK as follows:

import {GameballSDK} from 'react-native-gameball';

then

GameballSDK.registerPlayer({
      "playerUniqueId": playerId,
      "playerTypeId": playerTypeId,
      "deviceToken": playerDeviceToken,
      "referrerCode":referrerCode,
      "playerAttributes": {
        "displayName": "Alex",
        "email": "example@example.com",
        "gender": "m",
        "mobileNumber": "01099999999",
        "dateOfBirth": "2019-08-18T10:11:34.478Z",
        "joinDate": "2019-08-18T10:11:34.478Z" 
       }
}).then(res => res.json()).then(jsonResponse => {...}) // on success

Once the APIKey and playerUniqueId have been registered, Gameball views can be made visible to the user.

Param

Type

Required

Description

playerUniqueId

String

Required

PlayerUniqueId is a unique ID for you customer, for example UUID or username. The PlayerUniqueId is to be provided by the client and must be unique for each customer.

playerTypeId

Integer

Optional

Each customer type has an ID

playerAttributes

Object

Optional

PlayerAttributes is a builder class which you will use to add or update your customer info to Gameball. Player object is described in Object Reference section.

deviceToken

String

Optional

Mobile device token used for push notifications. Note: Should be sent along with osType

referrerCode

String

Optional

Referring customer's referral code. This is used in case of referral, where the customer to be created is referred by the customer having this code.

email

String

Optional

Customer's email address

mobile

String

Optional

Customer's mobile number

Choose an Unchangeable Player Unique ID

Gameball customer gets created using theplayerUniqueId. It is highly recommended to have the unique ID as an identifier that would NEVER be changed. If this unique ID changes for a given customer, you risk losing all original data for that customer, hence losing their points and rewards on Gameball. Accordingly, it is NOT recommended to use email address or mobile number as the unique ID as both can be changed by the customer at anytime.

Last updated