Get Started

This short tutorial will teach you the basics of using the Rev AI Node SDK. It demonstrates how to produce a transcript of an audio file submitted by you using the SDK.

Assumptions

This tutorial assumes that:

  • You have a Rev AI account and access token. If not, sign up for a free account and generate an access token .
  • You have a properly configured Node development environment with a current version of Node. The Node SDK supports v8, v10, v12, v14, v16 and v17.

Step 1: Install the SDK

Begin by installing the SDK:

Copy
Copied
npm install revai-node-sdk

Step 2: Submit a file for transcription and retrieve the result

The following example demonstrates how to submit a local audio file for transcription.

To use this example, replace the <FILEPATH> placeholder with the path to the file you wish to transcribe and the <REVAI_ACCESS_TOKEN> placeholder with your Rev AI account's access token.

Copy
Copied
// create a client
import { RevAiApiClient } from 'revai-node-sdk';

var accessToken = '<REVAI_ACCESS_TOKEN>';
var filePath = '<FILEPATH>';

// initialize the client with your access token
var client = new RevAiApiClient(accessToken);

// submit a local file
var job = await client.submitJobLocalFile(filePath);

// retrieve transcript
// as plain text
var transcriptText = await client.getTranscriptText(job.id);

// or as an object
var transcriptObject = await client.getTranscriptObject(job.id);

You can also submit a remote file or an audio stream.

The text output is a string containing just the text of your transcript. The object form of the transcript contains all the information outlined in the response of the transcript retrieval endpoint of the Asynchronous Speech-to-Text API when using the JSON response schema.

Any of these outputs can also be retrieved as a stream for easy file writing:

Copy
Copied
var textStream = await client.getTranscriptTextStream(job.id);
var transcriptStream = await client.getTranscriptObjectStream(job.id);

Next steps

You should now have a basic understanding of how to use the Node SDK. To learn more, refer to the SDK documentation and code samples.