Chanl

Calls Module

Import, query, and manage calls with the SDK

The Calls module handles the full lifecycle of call records: import transcripts or audio, query with filters, retrieve details, and clean up when done.

Installation

npm install @chanl/sdk

Setup

import { Chanl } from '@chanl/sdk';

const chanl = new Chanl({
  apiKey: process.env.CHANL_API_KEY,
});

import

Import call data from a transcript, audio URL, audio file reference, or S3 bucket. Only one input source per import.

From a transcript

const result = await chanl.calls.import({
  transcript: `
    Agent: Thank you for calling Acme Support, this is Sarah.
    Customer: Hi, I have a question about my bill.
    Agent: I'd be happy to help with that. Can you provide your account number?
  `,
  customerName: 'John Doe',
  customerPhone: '+1234567890',
  agentName: 'Sarah',
  direction: 'inbound',
  externalReferenceIds: {
    orderId: 'ORDER-12345',
    customerId: 'cust_abc123',
  },
});

console.log('Call ID:', result.callId);
console.log('Status:', result.processingStatus);

From an audio URL

const result = await chanl.calls.import({
  audioUrl: 'https://storage.example.com/recordings/call-123.mp3',
  customerName: 'Jane Smith',
});

With analysis and evaluation

const result = await chanl.calls.import({
  transcript: '...',
  analysisFields: ['sentiment', 'topics', 'quality', 'followups'],
  scorecardId: 'scorecard_abc123',
  customExtractions: [
    {
      key: 'order_number',
      description: 'Extract any order numbers mentioned',
      type: 'string',
    },
  ],
});

Parameters:

ParameterTypeRequiredDescription
transcriptstringOne source requiredPlain text transcript
transcriptSegmentsarrayOne source requiredStructured transcript with speakers and timestamps
audioUrlstringOne source requiredURL to audio file (MP3, WAV, M4A, FLAC, OGG, WEBM)
audioIdstringOne source requiredReference to uploaded audio
customerNamestringNoCustomer name
customerPhonestringNoCustomer phone number
agentNamestringNoAgent name
directionstringNoinbound, outbound, or web
externalReferenceIdsobjectNoKey-value pairs for linking to your systems
analysisFieldsstring[]NoWhich analyses to run (sentiment, topics, quality, etc.)
scorecardIdstringNoAuto-evaluate with this scorecard
customExtractionsarrayNoCustom data fields to extract
webhookUrlstringNoOverride webhook URL for completion notification

Returns: Promise<CallImportResponse>

list

Query calls with filters and pagination.

// Basic list
const { calls, pagination } = await chanl.calls.list();

// With filters
const { calls } = await chanl.calls.list({
  status: 'ended',
  direction: 'inbound',
  startDate: '2026-01-01',
  endDate: '2026-01-31',
  limit: 50,
});

// Filter by external reference
const { calls } = await chanl.calls.list({
  externalRefs: { orderId: 'ORDER-12345' },
});

// Combine multiple external refs
const { calls } = await chanl.calls.list({
  externalRefs: {
    customerId: 'cust_abc123',
    campaignId: 'camp_2026',
  },
});

Parameters:

ParameterTypeRequiredDescription
statusstringNoFilter by call status
directionstringNoinbound, outbound, or web
customerNamestringNoFilter by customer name
startDatestringNoStart of date range (ISO 8601)
endDatestringNoEnd of date range (ISO 8601)
externalRefsobjectNoFilter by external reference IDs
pagenumberNoPage number (1-indexed)
limitnumberNoItems per page (max 100)
sortBystringNoField to sort by
sortOrderstringNoasc or desc

Returns: Promise<{ calls: Call[]; pagination: Pagination }>

get

Retrieve detailed information for a single call, including analysis results and transcript.

const call = await chanl.calls.get('695d6957e21c0ceb325c394d');

console.log('Duration:', call.duration);
console.log('Sentiment:', call.summary?.sentiment);
console.log('Topics:', call.summary?.topics);

// Access transcript segments
call.transcript?.segments.forEach((segment) => {
  console.log(`${segment.speaker}: ${segment.text}`);
});

Parameters:

ParameterTypeRequiredDescription
callIdstringYesThe call ID to retrieve

Returns: Promise<Call>

delete

Remove a single call record.

await chanl.calls.delete('695d6957e21c0ceb325c394d');

Parameters:

ParameterTypeRequiredDescription
callIdstringYesThe call ID to delete

Returns: Promise<void>

bulkDelete

Remove multiple calls in one operation.

const result = await chanl.calls.bulkDelete({
  callIds: [
    '695d6957e21c0ceb325c394d',
    '695d6957e21c0ceb325c394e',
    '695d6957e21c0ceb325c394f',
  ],
  deleteStorageFiles: true,
});

console.log('Deleted:', result.deletedCount);

Parameters:

ParameterTypeRequiredDescription
callIdsstring[]YesCall IDs to delete
deleteStorageFilesbooleanNoAlso delete associated audio files

Returns: Promise<BulkDeleteResponse>

Types

import type {
  Call,
  CallImportOptions,
  CallImportResponse,
  CallListOptions,
  CallDirection,
  CallStatus,
  TranscriptSegment,
  BulkDeleteOptions,
  BulkDeleteResponse,
} from '@chanl/sdk';

Next steps

On this page