The Node.js SDK is continually evolving, with new endpoints being added for notifications, events, and more. Stay tuned for updates!

Overview

The Roark Node.js SDK provides a streamlined way to interact with the Roark API. This guide will help you quickly set up the SDK and start analyzing call recordings in your application.

Prerequisites

Before you begin, ensure you have:

Installation

Choose your preferred package manager:

npm install @roarkanalytics/sdk

Quick Start

1

Import the SDK

import Roark from '@roarkanalytics/sdk';
2

Initialize the Client

const client = new Roark({
  bearerToken: 'YOUR_ROARK_API_KEY'
});

Replace YOUR_ROARK_API_KEY with your actual API key from Roark.

3

Create an evaluation job for one or many calls

// Create an evaluation for a single call
const response = await client.evaluation.createJob({
  /**
   * You can find the evaluator slug from the Evaluators section on the dashboard
   * Or you can use 'all' to evaluate with all available evaluators.
   * 
   * Evaluators to evaluate the call
   * Usage examples:
   * - Specific evaluators: ['evaluator-slug-1', 'evaluator-slug-2']
   * - All evaluators: 'all'
   */
  evaluators: ['evaluator-slug-1', 'evaluator-slug-2'],
  call: {
    recordingUrl: 'https://example.com/recording.wav',
    callDirection: 'INBOUND' as CallDirectionEnum,
    interfaceType: 'WEB' as CallInterfaceTypeEnum,
    startedAt: new Date(),
    isTest: false,
    participants: [
      {
        name: 'Sales Agent',
        phoneNumber: '+15551234567',
        role: 'AGENT' as CallParticipantRoleEnum,
        spokeFirst: true,
      },
      {
        name: 'John Doe',
        phoneNumber: '+15557654321',
        role: 'CUSTOMER' as CallParticipantRoleEnum,
        spokeFirst: false,
      },
    ],
    // Custom metadata and properties
    properties: {
      business_name: 'customer-business-name',
      business_id: 'customer-business-id',
    },
    toolInvocations: [
      {
        name: 'getDentalAppointments',
        description: 'Get available dental appointments',
        startOffsetMs: 2000,
        endTimeOffsetMs: 3000,
        parameters: {},
        result: { appointments: ['cleaning', 'whitening', 'rootCanal'] },
      },
    ],
  },
});

console.log('Evaluation created:', response.data);
4

You're All Set

That’s it! You can now use the SDK to create evaluations

Additional Resources