This page will guide you through the steps for sending game events using our web SDK.

Using the Helika Web-SDK

  1. To gain access to our services, you should have an active account with Helika associated with your organization. If you haven't created an account with us yet, you can register here.
  2. Then to ensure secure authentication for your requests, please reach out to our support team at [email protected] to obtain a unique API key.
  3. Before proceeding, make sure you have Node.js and npm installed. Open your terminal or command prompt and run the following command to install our web-sdk from npm:
npm install helika-sdk
  1. You're all set to try it out! The following is a basic example of how to integrate our web-sdk into your application. Use it as a reference and build upon it by replacing 'YOUR_API_KEY'with your own API key and adapting the event information to fit your needs.
import Helika, { EventsBaseURL } from "helika-sdk"

// Initialize the Helika SDK
const helika = new Helika.Events(
  'YOUR_API_KEY',
  EventsBaseURL.EVENTS_DEV
);

// Start a session/create a new session which initiates the SDK instance with a
// sessionId which is required to fire events. This should only be called when 
// the user lands on the page. We store and re-use the session_id from the local
// storage, if present.
await helikaSDK.startSession();

// Instantiate events based on your game's event taxonomy
const events = [{
    game_id: 'my_game',           // required
    event_type: 'user_register',  // required
    event: {                      // required
      user_id: 'user_1',
      win_number: 1,
      wallet: '0x4kd....',
      discord_id: 'discord id'
    }
  },
  {
    game_id: 'my_game',           // required
    event_type: 'user_download',  // required
    event: {                      // required
      user_id: 'user_1',
      twitter_id: 'twitterid'
    }
  }
];

// Asynchronously
// await helika.createEvent(events);

// Send an Event to Helika
helika.createEvent(events)
  .then(response => {
    console.log(response);
  })
  .catch(error => {
    console.error(error);
  });

Using Helika API

In addition to using our SDK, you have the option to send game events directly to our API. This method can allow for more flexibility and can be more useful in certain scenarios. To help you get started, we've provided a demo script below. You can use this as a reference to understand the process of interacting with our API.

import requests

url = "https://api.helika.io/v1/game/game-event"

payload = {
  "events": [
    {
      "game_id": "demo_game_id",
      "event_type": "user_register"
      "event": 
      {
        "userId": "test_user_id",
        "email": "[email protected]"
      }
    }
  ]
}
headers = {
    "accept": "application/json",
    "x-api-key": "YOUR_API_KEY",
    "content-type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const sdk = require('api')('@helika/v1.0#28o82rlocye9rf');

sdk.create_game_event_v1_game_game_event_post({
  events: [
    {
      event: {
        userId: 'test_user_id',
        email: '[email protected]'
      },
      game_id: 'demo_game_id',
      event_type: 'user_register'
    }
  ]
}, {'x-api-key': 'YOUR_API_KEY'})
  .then(({ data }) => console.log(data))
  .catch(err => console.error(err));
CURL *hnd = curl_easy_init();

curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://api.helika.io/v1/game/game-event");

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "accept: application/json");
headers = curl_slist_append(headers, "x-api-key: YOUR_API_KEY");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);

curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\"events\":[{\"event\":{\"userId\":\"test_user_id\",\"email\":\"[email protected]\"},\"game_id\":\"demo_game_id\",\"event_type\":\"user_register\"}]}");

CURLcode ret = curl_easy_perform(hnd);
using RestSharp;


var options = new RestClientOptions("https://api.helika.io/v1/game/game-event");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json");
request.AddHeader("x-api-key", "YOUR_API_KEY");
request.AddJsonBody("{\"events\":[{\"event\":{\"userId\":\"test_user_id\",\"email\":\"[email protected]\"},\"game_id\":\"demo_game_id\",\"event_type\":\"user_register\"}]}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);

For more details, go to Create Game Event.