JavaScript SDK V2 to V3 Migration Guide
Migrating from Deepgram Node SDK v2 to the Deepgram JavaScript SDK v3.
This guide is for users with experience using the Deepgram Node SDK v2 who want to migrate to the Deepgram JavaScript SDK v3. This is not an end-to-end guide, but a reference for people using our existing Node SDK to migrate to our newest version.
Notable Changes
- ESM and UMD support
- WebVTT and SRT captions published as a standalone package
- Separate async and sync transcription methods.
- JavaScript and Node.js friendly (isomorphic)
- Improved live transcription events
- Switch from
request
tofetch
- Initialization by function instead of class
- Scoped constructor config
- Better errors
- Support for future products
- Support for self-hosted (formerly called on-prem) deployments
UMD
You can now use plain <script>
s to import deepgram from CDNs, like:
or even:
Then you can use it from a global deepgram variable:
ESM
You can now use type=“module” <script>
s to import deepgram from CDNs, like:
Migration Guide
Installation
Initialization
Scoped Configuration
A new feature is scoped configuration. You’ll be able to configure various aspects of the SDK from the initialization.
Transcription Methods (Synchronous)
We have separated the callback
feature into its own method. The functionality below is not valid with the callback feature.
Local File Transcription
Transcribe a local file on the same filesystem as the app is running.
or
URL File Transcription
Transcribe a remote file by sending us a publicly accessible URL to it.
Transcription Methods (Asynchronous)
The below are examples of using a callback endpoint with our new SDK. You’ll need additionally need the CallbackUrl
class from the Deepgram SDK.
Local File Transcription
Transcribe a local file on the same filesystem as the app is running.
or
URL File Transcription
Transcribe a remote file by sending us a publicly accessible URL to it.
Transcription Methods (Live)
Our live transcription uses a WebSocket to receive audio data, and return results.
Live Transcription
Transcribe live audio streams.
Management API
get all projects for a user
See our API reference for more info.
get a project
See our API reference for more info.
update a project
See our API reference for more info.
delete a project
See our API reference for more info.
get all project key details
See our API reference for more info.
get a project key
See our API reference for more info.
create a project key
See our API reference for more info.
delete a project key
See our API reference for more info.
get all project members
See our API reference for more info.
remove a project member
See our API reference for more info.
get all scopes for a project member
See our API reference for more info.
update a scope for a project member
See our API reference for more info.
get all project invites
See our API reference for more info.
send a project invite
See our API reference for more info.
delete a project invite
See our API reference for more info.
leave a project
See our API reference for more info.
get all usage requests for a project
See our API reference for more info.
get a usage request for a project
See our API reference for more info.
get the project usage summary
See our API reference for more info.
get project usage fields
See our API reference for more info.
get all project balances
See our API reference for more info.
get a project balance
See our API reference for more info.
Self-Hosted (on-prem) APIs (new)
list self-hosted credentials
Newly available functionality.
See our API reference for more info.
get self-hosted credentials
Newly available functionality.
See our API reference for more info.
create self-hosted credentials
Newly available functionality.
See our API reference for more info.
delete self-hosted credentials
Newly available functionality.