Quick Start Guide

SpeakPrecisely offers two integration methods: our recommended SDK for the simplest integration, or direct WebSocket connection for more control. Choose the approach that best fits your needs.

Sample Apps

Check out our sample apps for different use cases:

1. Installation

NPM

npm install speak-precisely-sdk

CDN

<script src="https://unpkg.com/speak-precisely-sdk"></script>

2. Initialize and Connect

Import the SDK and create a new client instance with your API key.

import { SpeakPrecisely, TranscriptionEvents } from 'speak-precisely-sdk';

const client = new SpeakPrecisely('your-public-key');

client.on(TranscriptionEvents.Connected, () => {
  console.log('Connected to service');
});

client.on(TranscriptionEvents.Transcript, (result) => {
  console.log('Received transcript:', result);
});

await client.start({
  spokenLanguage: 'en-US',
  targetLanguages: ['es', 'fr']
});

3. Handle Events

The SDK provides several events you can listen to:

  • TranscriptionEvents.Connected - Connection established
  • TranscriptionEvents.Disconnected - Connection closed
  • TranscriptionEvents.Error - Error occurred
  • TranscriptionEvents.Transcript - New transcript received
  • TranscriptionEvents.MaxConnectionsReached - Connection limit reached

Example Response

{
  "type": "Results",
  "spokenLanguage": "Hello, how are you today?",
  "targetLanguages": {
    "es": "Hola, ¿cómo estás hoy?",
    "fr": "Bonjour, comment allez-vous aujourd'hui?",
    "de": "Hallo, wie geht es dir heute?"
  }
}

Next Steps

Check out the Authentication guide for more details about securing your connection, or see the Sample Request/Response section for more complex examples.