SpeechToText.Command
WebSocket event schema, payload, and examples
text
string
confidence
number required
alternatives
AlternativePhrase[]
Schema
The JSON Schema for the event payload, if available.
schema.json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "SpeechToTextEvent",
"type": "object",
"additionalProperties": false,
"properties": {
"text": {
"type": [
"null",
"string"
]
},
"confidence": {
"type": "number"
},
"alternatives": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/$defs/AlternativePhrase"
}
}
},
"$defs": {
"AlternativePhrase": {
"type": "object",
"additionalProperties": false,
"properties": {
"text": {
"type": [
"null",
"string"
]
},
"confidence": {
"type": "number"
}
}
}
}
}
JSON Payload
An example JSON payload for the event, automatically generated using JSONSchemaFaker
example.json
{
"text": null,
"confidence": 264.22408130019903,
"alternatives": [
{
"text": "ZaRmf90DTd",
"confidence": -95.25130270048976
},
{
"text": "0o",
"confidence": -618.4508176520467
},
{
"text": null,
"confidence": 430.5688855238259
},
{
"text": "V34OYRntG3",
"confidence": 903.6806812509894
},
{
"text": "4my",
"confidence": 604.5758933760226
}
]
}
Client Example
Example code showing how to subscribe to this event using the Streamer.bot WebSocket Client
index.js
// Initialize the Streamer.bot WebSocket Client
const client = new StreamerbotClient();
// Subscribe to "SpeechToText.Command" events and register a callback
client.on('SpeechToText.Command', ({ event, data }) => {
// Code here will run every time the event is received!
console.log('Received event:', event.source, event.type);
console.log('Event data:', data);
});
 Â