Quick Start Guide
Integrate Slotty Labs games into your platform in 15 minutes.
Prerequisites
- Node.js 18+
- An API key (contact office@slottylabs.com)
Step 1: Install the SDK
bash
npm install @slottylabs/sdkStep 2: Initialize the Client
typescript
import { SlottyClient } from '@slottylabs/sdk';
const client = new SlottyClient({
apiKey: 'sk_sandbox_abc123...',
webhookSecret: 'whsec_xyz789...',
});Step 3: Create an SSO Launch Token
typescript
const { launchToken } = await client.auth.createSSOToken({
playerId: 'player-123',
currency: 'USD',
jurisdiction: 'CW',
locale: 'en',
});Step 4: Generate a Launch URL
typescript
const launchUrl = client.games.getLaunchUrl('slotty-slots', launchToken, {
lang: 'en',
lobby: 'https://yourcasino.com/lobby',
});Step 5: Embed the Game
html
<div style="width: 100%; max-width: 1200px; aspect-ratio: 16/9;">
<iframe
src="{launchUrl}"
style="width: 100%; height: 100%; border: none;"
allow="autoplay; fullscreen"
sandbox="allow-scripts allow-same-origin allow-popups allow-forms"
></iframe>
</div>Step 6: Handle Webhooks
typescript
import { WebhookVerifier } from '@slottylabs/sdk';
const verifier = new WebhookVerifier('whsec_xyz789...');
app.post('/webhooks/slotty', (req, res) => {
try {
const event = verifier.constructEvent(
req.rawBody,
req.headers['x-slotty-signature'],
req.headers['x-slotty-timestamp'],
);
switch (event.type) {
case 'round.completed':
console.log('Round completed:', event.data);
break;
case 'wallet.deposit_confirmed':
console.log('Deposit:', event.data);
break;
}
res.status(200).json({ received: true });
} catch (err) {
res.status(400).json({ error: 'Invalid signature' });
}
});