Configuration

Config#

FieldRequiredSupported valueDefault ValueDescription
confidenceThresholdfalse0.0 - 1.00.5Minimum Confidence score that should be met for API to consider it as valid insight, if not provided defaults to 0.5 i.e. 50% or more
languageCodefalseen-USThe language code as per the BCP 47 specification
speechRecognitionfalseSpeaker identity to use for audio in this WebSocket connection. If omitted, no speaker identification will be used for processing. See below.

Main Message Body#

FieldRequiredSupported ValueDescription
typetruestart_request, stop_requestType of message
insightTypesfalseaction_item, questionTypes of insights to return. If not provided, no insights will be returned.
configfalseConfiguration for this request. See the config section below for more details.
speakerfalseSpeaker identity to use for audio in this WebSocket connection. If omitted, no speaker identification will be used for processing. See below.

Speech Recognition#

FieldRequiredSupported valueDefault ValueDescription
encodingfalseLINEAR16, FLAC, MULAWLINEAR16Audio Encoding in which the audio will be sent over the WebSocket.
sampleRateHertz false16000The rate of the incoming audio stream.

Speaker#

FieldRequiredSupported Value
userIdfalseAny user identifier for the user.
namefalseDisplay name of the user.

Create a websocket client instance

const ws = new WebSocketClient();
ws.on('connectFailed', (err) => {
console.error('Connection Failed.', err);
});
ws.on('connect', (connection) => {
// Start the microphone
micInstance.start();
connection.on('close', () => {
console.log('WebSocket closed.')
});
connection.on('error', (err) => {
console.log('WebSocket error.', err)
});
connection.on('message', (data) => {
if (data.type === 'utf8') {
const {
utf8Data
} = data;
console.log(utf8Data); // Print the data for illustration purposes
}
});
console.log('Connection established.');
connection.send(JSON.stringify({
"type": "start_request",
"insightTypes": ["question", "action_item"],
"config": {
"confidenceThreshold": 0.9,
// "timezoneOffset": 480, // Your timezone offset from UTC in minutes
"languageCode": "en-US",
"speechRecognition": {
"encoding": "LINEAR16",
"sampleRateHertz": 44100 // Make sure the correct sample rate is provided for best results
},
"meetingTitle": "Client Meeting"
},
"speaker": {
"userId": "jane.doe@example.com",
"name": "Jane"
}
}));
micInputStream.on('data', (data) => {
connection.send(data);
});
});

For this example, we timeout our call after 2 minutes but you would most likely want to make the stop_request call when your websocket connection ends

// Schedule the stop of the client after 2 minutes (120 sec)
setTimeout(() => {
micInstance.stop();
// Send stop request
connection.sendUTF(JSON.stringify({
"type": "stop_request"
}));
connection.close();
}, 120000);