@unboundcx/sdk 4.8.4 → 4.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboundcx/sdk",
3
- "version": "4.8.4",
3
+ "version": "4.8.6",
4
4
  "description": "Official JavaScript SDK for the Unbound API - A comprehensive toolkit for integrating with Unbound's communication, AI, and data management services",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/services/ai.js CHANGED
@@ -642,6 +642,32 @@ export class SpeechToTextService {
642
642
  return result;
643
643
  }
644
644
 
645
+ /**
646
+ * Synchronously transcribe a stored audio file (batch STT).
647
+ * Counterpart to stream(): give it a storage file id, get the transcript
648
+ * back in the response (typically ~1-3s for voicemail-length audio).
649
+ *
650
+ * @param {Object} options
651
+ * @param {string} options.storageId - Storage file id of the audio (WAV by default).
652
+ * @param {string} [options.language] - Language hint (default 'en').
653
+ * @param {string} [options.encoding] - Audio encoding (default 'WAV').
654
+ * @returns {Promise<{transcription: string|null, language: string|null, duration: number|null}>}
655
+ */
656
+ async file({ storageId, language, encoding } = {}) {
657
+ this.sdk.validateParams(
658
+ { storageId, language, encoding },
659
+ {
660
+ storageId: { type: 'string', required: true },
661
+ language: { type: 'string', required: false },
662
+ encoding: { type: 'string', required: false },
663
+ },
664
+ );
665
+ const body = { storageId };
666
+ if (language !== undefined) body.language = language;
667
+ if (encoding !== undefined) body.encoding = encoding;
668
+ return await this.sdk._fetch('/ai/stt/file', 'POST', { body });
669
+ }
670
+
645
671
  /**
646
672
  * Create a real-time streaming transcription session
647
673
  * Returns an EventEmitter-based stream for sending audio and receiving transcripts
package/services/inbox.js CHANGED
@@ -91,4 +91,24 @@ export class InboxService {
91
91
  const result = await this.sdk._fetch('/inbox/stats', 'GET');
92
92
  return result;
93
93
  }
94
+
95
+ /**
96
+ * Trigger transcription for a voicemail that has a recording but no
97
+ * transcript (fire-and-forget server-side; poll the record for the
98
+ * resulting `transcription` / `transcriptionStatus`).
99
+ *
100
+ * @param {string} voicemailMessageId
101
+ * @returns {Promise<{accepted?: boolean, skipped?: boolean}>}
102
+ */
103
+ async transcribeVoicemail(voicemailMessageId) {
104
+ this.sdk.validateParams(
105
+ { voicemailMessageId },
106
+ { voicemailMessageId: { type: 'string', required: true } },
107
+ );
108
+ return await this.sdk._fetch(
109
+ `/inbox/voicemail/${voicemailMessageId}/transcribe`,
110
+ 'POST',
111
+ { body: {} },
112
+ );
113
+ }
94
114
  }