SpeechToText.Command

WebSocket event schema, payload, and examples

Properties

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",
      "format": "float"
    },
    "alternatives": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/definitions/AlternativePhrase"
      }
    }
  },
  "definitions": {
    "AlternativePhrase": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "text": {
          "type": [
            "null",
            "string"
          ]
        },
        "confidence": {
          "type": "number",
          "format": "float"
        }
      }
    }
  }
}

JSON Payload

An example JSON payload for the event, automatically generated using JSONSchemaFaker
example.json
{
  "alternatives": [
    {
      "confidence": -65003076.24257882,
      "text": "laborum veniam culpa adipisicing"
    },
    {
      "confidence": 99628774.08512804,
      "text": null
    },
    {
      "confidence": -67104965.0871951,
      "text": null
    },
    {
      "confidence": 54845522.02633169,
      "text": null
    },
    {
      "confidence": 96670441.68786883,
      "text": null
    }
  ],
  "confidence": -61013346.785148844,
  "text": null
}

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);
});