Skip to content

SDK Overview

The official Slotty Labs Node.js SDK for integrating iGaming services into your platform.

Package Info

PropertyValue
Package@slottylabs/sdk
Version1.0.0
DependenciesZero (no external dependencies)
RuntimeNode.js 18+
TypeScript5.0+ (full type definitions included)
LicenseMIT

Installation

bash
npm install @slottylabs/sdk
bash
yarn add @slottylabs/sdk
bash
pnpm add @slottylabs/sdk

Initialization

typescript
import { SlottyClient } from '@slottylabs/sdk';

const client = new SlottyClient({
  apiKey: 'sk_sandbox_abc123...',
  webhookSecret: 'whsec_xyz789...',       // Optional, for webhook verification
  baseUrl: 'https://api.slottylabs.com',   // Optional, defaults to production
  timeout: 10000,                           // Optional, request timeout in ms
});

Exports

The SDK exports the following modules and types:

Classes

ExportDescription
SlottyClientMain client class with all API modules
WebhookVerifierWebhook signature verification utility
SlottyApiErrorCustom error class for API errors
WebhookVerificationErrorError thrown on verification failure

Type Definitions

ExportDescription
SlottyClientConfigClient constructor options
CreateSSOTokenRequestSSO token creation parameters
CreateSSOTokenResponseSSO token creation result
LaunchUrlOptionsGame launch URL options
GameListResponseGame catalog response
GameDetailsSingle game details
WalletBalancePlayer wallet balance
CreateTestPlayerRequestTest player creation params
CreateTestPlayerResponseTest player creation result
ForceOutcomeRequestForced outcome configuration
HealthCheckResponsePlatform health check result
VerifiedEventVerified webhook event
WebhookEnvelopeRaw webhook payload structure

Enums

ExportDescription
EnvironmentSANDBOX or PRODUCTION
GameTypeSINGLE_STEP, MULTI_STEP, SESSION_BASED
RtpVariantRTP_92, RTP_94, RTP_96, RTP_97

Quick Example

typescript
import { SlottyClient, WebhookVerifier } from '@slottylabs/sdk';

// Initialize the client
const client = new SlottyClient({
  apiKey: process.env.SLOTTY_API_KEY!,
  webhookSecret: process.env.SLOTTY_WEBHOOK_SECRET,
});

// Create an SSO token for a player
const { launchToken } = await client.auth.createSSOToken({
  playerId: 'player-123',
  currency: 'USD',
  jurisdiction: 'CW',
  locale: 'en',
});

// Generate a launch URL
const url = client.games.getLaunchUrl('slotty-slots', launchToken, {
  lang: 'en',
  lobby: 'https://yourcasino.com/lobby',
});

// List available games
const games = await client.games.list();

// Check player balance
const balance = await client.wallet.getBalance('player-123');

// Verify incoming webhooks
const verifier = new WebhookVerifier(process.env.SLOTTY_WEBHOOK_SECRET!);

Error Handling

All API errors are thrown as SlottyApiError instances:

typescript
import { SlottyApiError } from '@slottylabs/sdk';

try {
  await client.auth.createSSOToken({ ... });
} catch (err) {
  if (err instanceof SlottyApiError) {
    console.error(`API Error: ${err.code} — ${err.message}`);
    console.error(`HTTP Status: ${err.statusCode}`);
    console.error(`Request ID: ${err.requestId}`);
  }
}

Next Steps