Quickstart Guide

Learn how to integrate real-time video into your React, Next.js, or vanilla JS application using the Talksphere SDK.

Prerequisites

1. Install the SDK

Install the talksphere-sdk package from npm:

npm install talksphere-sdk

2. Initialize the Consumer

In your client-side code, import the SDK and initialize it with your API Key.

import { TalksphereSDK } from 'talksphere-sdk';

// Initialize with your API Key
const sdk = new TalksphereSDK({
    apiKey: 'pk_live_your_api_key_here' 
});

// Join a room (or create one if it doesn't exist)
// Rooms are just unique strings!
const roomName = 'my-first-room';

async function startCall() {
    try {
        const room = await sdk.join(roomName, {
            video: true, // Request camera
            audio: true  // Request microphone
        });
        
        console.log('Connected to room:', room.id);

        // Handle new participants
        room.on('participant-joined', (participant) => {
            console.log('User joined:', participant.id);
        });

    } catch (error) {
        console.error('Failed to join:', error);
    }
}

startCall();

3. Next Steps

Now that you are connected, dive deeper into the core concepts: