Code Samples

Use the code samples below to integrate your applications with the API.


Get aligned transcript using a webhook


This example requires the Express framework.

The following example demonstrates how to implement a webhook handler that receives and parses the HTTP POST message from the Rev AI API and sends an email notification using Express and the Twilio SendGrid API client.

To use this example, you must first replace three placeholders:

  • <SENDER_EMAIL_ADDRESS> and <RECIPIENT_EMAIL_ADDRESS> for the sender and recipient email addresses; and
  • <SENDGRID_API_KEY> for the Twilio SendGrid API key.
const bodyParser = require('body-parser');
const express = require('express');
const sendgrid = require('@sendgrid/mail');

// Twilio SendGrid API key
const sendgridKey = '<SENDGRID_API_KEY>';
// sender email address
const senderEmail = '<SENDER_EMAIL>';
// recipient email address
const receiverEmail = '<RECEIVER_EMAIL>';

// set API key for SendGrid

// create Express application
const app = express();

// handle requests to webhook endpoint'/hook', async req => {
  const job = req.body.job;
  console.log(`Received status for job id ${}: ${job.status}`);    

  const message = {
    from: senderEmail,
    to: receiverEmail,
    subject: `Job ${} is COMPLETE`,
    text: job.status === 'completed'
        ? `Forced alignment job is completed`
        : `An error occurred`

  try {
    await sendgrid.send(message);
    console.log('Email successfully sent');
  } catch (e) {


//  start application on port 3000
app.listen(3000, () => {
  console.log('Webhook listening');