Event

Gameball event API endpoint allows you to record your player's actions in order to track their journey within Gameball widget.

The event APIs help you record any actions your user performs, along with any properties or metadata that describe the action. For further elaboration on events, check this article in our Help Center.

Each action is known as an event. Each event has a name, like place_order, and metadata, for example a place_order event might have properties like amount or source. Calling events is one of the first steps to getting started with Gameball.

The event API call accepts a collection of event to help tracking multiple user actions. Event object is described in Object Reference.

Events can be sent along with points reward and points redemption using Actions Composite API endpoint.

Event

POST /integrations/event

The API call is used to send an event to Gameball where the received event will be evaluated and counted toward player challenges

Headers

NameTypeDescription

APIKey

string

Client API Key

Request Body

NameTypeDescription

events

object

Collection of player events to be sent to Gameball.

playerUniqueId

string

Player unique identifier used to uniquely identify the player on Gameball.

playerAttributes

object

An object containing all of the attributes of the player. Player object is described in Object Reference section.

{}

In case the player doesn't exist on Gameball before sending the Event API call, the player will be created automatically on Gameball.

Usage Examples

Example One

The below represents events done by a player with playerUniqueId “player123” on two events:

  1. Event “place_order”: (An event that has 2 metadata keys)

    1. total_amount: Total money paid by the player

    2. category: Type of products being bought by player

  2. Event review: (An event with no metadata)

curl -X POST -H 'apiKey: 807b041b7d35425988e354e1f6bce186' -d '{
  "events": {
    "place_order": {    // Events with metadata
      "total_amount": "100",
      "category": [
          "electronics",
          "cosmetics"
      ]
    },
    "review": { } // For events with no metadata
  },
  "playerUniqueId": "player123"
  }' -v -i 'https://api.gameball.co/api/v2.0/integrations/event'

Example Two

The below example shows how playerAttributes object can be sent with the request to create or update player data, while triggering an event:

  1. Event reserve: An event with one metadata key

    1. rooms: Types of rooms booked by player, 1 for standard and 2 for deluxe rooms

Note: All attributes inside the playerAttributes object are optional, if the values of any attributes shown below are unavailable, remove the attribute from the playerAttributes object.

curl -X POST -H 'apiKey: 807b041b7d35425988e354e1f6bce186' -d '{
"events": {
            "reserve": {
                "rooms": 2
            }
        },
"playerUniqueId": "player123",
"playerAttributes": {
    "displayName": "Jon Snow",
    "email": "jon.snow@example.com",
    "dateOfBirth": "1980-09-19T00:00:00.000Z",
    "joinDate": "2019-09-19T21:06:29.158Z"
  }' -v -i 'https://api.gameball.co/api/v2.0/integrations/event'

Example Three

The below example shows how playerAttributes object including custom attributes object can be sent with the request to create or update player data, while triggering an event:

  1. Event reserve: An event with one metadata key

    1. rooms: Types of rooms booked by player, 1 for standard and 2 for deluxe rooms

Note: All attributes inside the playerAttributes object are optional, if the values of any attributes shown below are unavailable, remove the attribute from the playerAttributes object.

curl -X POST -H 'apiKey: 807b041b7d35425988e354e1f6bce186' -d '{
"events": {
            "reserve": {
                "rooms": 2
            }
        },
"playerUniqueId": "player123",
"playerAttributes": {
    "displayName": "Jon Snow",
    "email": "jon.snow@example.com",
    "dateOfBirth": "1980-09-19T00:00:00.000Z",
    "joinDate": "2019-09-19T21:06:29.158Z",
    "custom": {
         "location":"Miami",
         "graduationDate":"2018-07-04T21:06:29.158Z",
         "isMarried":false
     }
  }' -v -i 'https://api.gameball.co/api/v2.0/integrations/event'

Remarks

  • API consumer can provide any number of events given that each event name is not replicated

  • API consumer can provide from 0 to all event metadata keys, however the keys must not be replicated. If the consumer has multiple values for a single metadata key it should be provide as an array of strings as follows “key”: [“value1”, “value2”, “value3”, …]

Last updated