Loading
Visual Studio Code Based Modeler for Consumer Goods Cloud
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          VoiceManager::launchSpeechToTextAsync

          VoiceManager::launchSpeechToTextAsync

          Launches the Speech-to-Text user interface in the mobile app allowing users to start speech recognition manually.

          Required Editions

          Available in: Enterprise and Unlimited Editions where Consumer Goods Cloud is enabled

          Parameters

          This method takes a single object as a parameter. The object can include these optional parameters:

          • titleLabelId: Optional. The string ID of the title label to display in the speech user interface.
          • infoTextHeaderLabelId: Optional. The string ID of the info or help text header displayed in the speech interface.
          • infoTextBodyLabelId: Optional. The string ID of the info or help text body displayed in the speech interface.
          • maxDurationSec: Integer, optional. Maximum speech duration in seconds. Stops automatically when exceeded. Default is 180 seconds (3 minutes). Allowed range: 1 – 180 seconds.
          • silenceTimeoutSec: Number, optional. Continuous silence duration (in seconds) after which transcription stops automatically. Default is 15 seconds. Allowed range: 1 – 30 seconds.

          Returns

          Promise: The method returns a promise that resolves on success and rejects on error or cancellation.

          Resolves with: A JSON object containing:

          • status (enum) = SPEECH_RECOGNITION_STATUS.SUCCESS
          • text (string): The transcribed speech text.

          Rejects with: A JSON object containing one of these:

          • On error:
            • status (enum) = SPEECH_RECOGNITION_STATUS.ERROR
            • error (object): Error details.
          • On cancellation:
            • status (enum) = SPEECH_RECOGNITION_STATUS.CANCELLED
          Sample Code
          Sample Code

          Here are a few sample definitions for using the launchSpeechToTextAsync method:

          Sample GET request:

          VoiceManager.launchSpeechToTextAsync({
              titleLabelId: ’Start Recording’,
              infoTextHeaderLabelId: ’Recording Information’,
              infoTextBodyLabelId: ’Click to start recording your speech.’,
              maxDurationSec: 120,
              silenceTimeoutSec: 10
              })
              .then(response => {
              console.log(’Transcription successful:’, response.text);
              })
              .catch(error => {
              console.error(’Transcription failed:’, error);
              });

          Sample POST request:

          VoiceManager.launchSpeechToTextAsync({
              titleLabelId: ’Start Recording’,
              infoTextHeaderLabelId: ’Recording Information’,
              infoTextBodyLabelId: ’Click to start recording your speech.’,
              maxDurationSec: 180,
              silenceTimeoutSec: 15
              })
              .then(response => {
              console.log(’Transcription successful:’, response.text);
              })
              .catch(error => {
              console.error(’Transcription failed:’, error);
              });
           
          Loading
          Salesforce Help | Article