SDK Overview
The official Slotty Labs Node.js SDK for integrating iGaming services into your platform.
Package Info
| Property | Value |
|---|---|
| Package | @slottylabs/sdk |
| Version | 1.0.0 |
| Dependencies | Zero (no external dependencies) |
| Runtime | Node.js 18+ |
| TypeScript | 5.0+ (full type definitions included) |
| License | MIT |
Installation
bash
npm install @slottylabs/sdkbash
yarn add @slottylabs/sdkbash
pnpm add @slottylabs/sdkInitialization
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
| Export | Description |
|---|---|
SlottyClient | Main client class with all API modules |
WebhookVerifier | Webhook signature verification utility |
SlottyApiError | Custom error class for API errors |
WebhookVerificationError | Error thrown on verification failure |
Type Definitions
| Export | Description |
|---|---|
SlottyClientConfig | Client constructor options |
CreateSSOTokenRequest | SSO token creation parameters |
CreateSSOTokenResponse | SSO token creation result |
LaunchUrlOptions | Game launch URL options |
GameListResponse | Game catalog response |
GameDetails | Single game details |
WalletBalance | Player wallet balance |
CreateTestPlayerRequest | Test player creation params |
CreateTestPlayerResponse | Test player creation result |
ForceOutcomeRequest | Forced outcome configuration |
HealthCheckResponse | Platform health check result |
VerifiedEvent | Verified webhook event |
WebhookEnvelope | Raw webhook payload structure |
Enums
| Export | Description |
|---|---|
Environment | SANDBOX or PRODUCTION |
GameType | SINGLE_STEP, MULTI_STEP, SESSION_BASED |
RtpVariant | RTP_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
- SlottyClient Reference — Full API reference for all client methods
- WebhookVerifier Reference — Webhook verification guide
- Quick Start Guide — End-to-end integration tutorial