/** * Gong API Client * https://gong.app.gong.io/settings/api/documentation */ import { type CallDetails, type CallDetailsResponse, type CallsResponse, type GetLibraryFolderCallsRequest, type GetTrackersRequest, type LibraryFolderCallsResponse, type LibraryFoldersResponse, type ListCallsRequest, type ListLibraryFoldersRequest, type ListUsersRequest, type SearchCallsByAccountRequest, type SearchCallsByOpportunityRequest, type SearchTranscriptsRequest, type SearchTranscriptsResult, type SearchUsersRequest, type SingleCallResponse, type SingleUserResponse, type TrackersSettingsResponse, type TranscriptsResponse, type UsersResponse, type WorkspacesResponse } from './schemas.js'; /** * Build a contentSelector object for the Gong API calls/extensive endpoint. * Always includes parties, brief, and topics as defaults. * The include array adds additional content fields. */ export declare function buildContentSelector(include?: string[]): Record; export declare const MAX_SEARCH_PAGES = 50; /** * Filter calls to those where any participant has a matching userId. */ export declare function filterByParticipantUserIds(calls: CallDetails[], userIds: string[]): CallDetails[]; /** * Filter calls to those hosted by a user whose email matches the provided list. * Looks up the primary user inside the parties array by matching primaryUserId, * then compares the email case-insensitively. */ export declare function filterByPrimaryUserEmails(calls: CallDetails[], emails: string[]): CallDetails[]; /** * Filter out calls where any participant has a userId in the excluded set. * Calls with no parties are kept (no excluded participant, so no match). */ export declare function filterByExcludeParticipantUserIds(calls: CallDetails[], userIds: string[]): CallDetails[]; /** * Filter out calls where any participant has an email in the excluded set. * Comparison is case-insensitive. Calls with no parties are kept. */ export declare function filterByExcludeParticipantEmails(calls: CallDetails[], emails: string[]): CallDetails[]; /** * Filter out calls whose primaryUserId is in the excluded set. * Calls with no primaryUserId are kept (nothing to match against). */ export declare function filterByExcludePrimaryUserIds(calls: CallDetails[], userIds: string[]): CallDetails[]; /** * Filter calls to those where any participant has a matching email address. * Comparison is case-insensitive. */ export declare function filterByParticipantEmails(calls: CallDetails[], emails: string[]): CallDetails[]; /** * Filter calls by scope (Internal, External, Unknown). * Calls with null/missing scope are excluded. */ export declare function filterByScope(calls: CallDetails[], scope: string): CallDetails[]; /** * Filter calls by minimum duration in seconds. * Calls with null/missing duration are excluded. */ export declare function filterByMinDuration(calls: CallDetails[], minSeconds: number): CallDetails[]; /** * Filter calls by maximum duration in seconds. * Calls with null/missing duration are excluded. */ export declare function filterByMaxDuration(calls: CallDetails[], maxSeconds: number): CallDetails[]; /** * Filter calls by direction (Inbound, Outbound, Conference, Unknown). * Calls with null/missing direction are excluded. */ export declare function filterByDirection(calls: CallDetails[], direction: string): CallDetails[]; /** * Filter calls by conferencing system (e.g., "Zoom", "Google Meet"). * Case-insensitive substring match. Calls with null/missing system excluded. */ export declare function filterBySystem(calls: CallDetails[], system: string): CallDetails[]; /** * Filter calls by language code (e.g., "eng", "jpn"). * Case-insensitive exact match. Calls with null/missing language excluded. */ export declare function filterByLanguage(calls: CallDetails[], language: string): CallDetails[]; /** * Filter calls whose title contains the given substring (case-insensitive). * Calls with null/missing title are excluded. */ export declare function filterByTitleContains(calls: CallDetails[], needle: string): CallDetails[]; /** * Filter calls to those where at least one named tracker fired (count > 0). * Matches tracker names by case-insensitive substring. A call is included * when any requested name matches any tracker with a non-zero count. */ export declare function filterByTrackers(calls: CallDetails[], trackerNames: string[]): CallDetails[]; /** * Filter calls by customer/account name. * Case-insensitive substring match against: * 1. CRM context Account Name fields * 2. External participant email domains * 3. Call title */ export declare function filterByCustomerName(calls: CallDetails[], name: string): CallDetails[]; export interface GongConfig { accessKey: string; accessKeySecret: string; } export type { Call, CallDetails, CallDetailsResponse, CallsResponse, CallTranscript, LibraryFolderCallsResponse, LibraryFoldersResponse, SingleCallResponse, SingleUserResponse, TrackersSettingsResponse, TranscriptEntry, TranscriptsResponse, User, UsersResponse, WorkspacesResponse, } from './schemas.js'; export declare class GongClient { private authHeader; constructor(config: GongConfig); private request; private get; /** * List calls with optional filtering (GET /v2/calls) */ listCalls(options?: ListCallsRequest): Promise; /** * Get detailed information about specific calls (POST /v2/calls/extensive) * Includes AI-generated summaries (brief, keyPoints, outline, topics, actionItems) */ getCallDetails(callIds: string[]): Promise; /** * Get transcripts for specific calls (POST /v2/calls/transcript) */ getTranscripts(callIds: string[]): Promise; /** * Search calls with advanced filters (POST /v2/calls/extensive) * Supports filtering by date range, workspace, primary users (hosts), and specific call IDs. * Always includes parties, brief, and topics in the response. * Use the include parameter to request additional content fields. */ searchCalls(options: { fromDateTime?: string; toDateTime?: string; workspaceId?: string; primaryUserIds?: string[]; callIds?: string[]; include?: string[]; cursor?: string; }): Promise; /** * Fetch all pages of search results via auto-pagination. * Returns accumulated calls and the total count before any client-side filtering. */ searchCallsAll(options: { fromDateTime?: string; toDateTime?: string; workspaceId?: string; primaryUserIds?: string[]; callIds?: string[]; include?: string[]; primaryUserEmails?: string[]; excludePrimaryUserIds?: string[]; participantUserIds?: string[]; excludeParticipantUserIds?: string[]; participantEmails?: string[]; excludeParticipantEmails?: string[]; customerName?: string; titleContains?: string; trackers?: string[]; scope?: string; direction?: string; system?: string; language?: string; minDuration?: number; maxDuration?: number; }): Promise<{ response: CallDetailsResponse; totalBeforeFilter: number; }>; /** * List all users (GET /v2/users) */ listUsers(options?: ListUsersRequest): Promise; /** * Get a single call's metadata (GET /v2/calls/{id}) */ getCall(callId: string): Promise; /** * Get a specific user's profile (GET /v2/users/{id}) */ getUser(userId: string): Promise; /** * Search users with filters (POST /v2/users/extensive) */ searchUsers(options: SearchUsersRequest): Promise; /** * List keyword trackers (GET /v2/settings/trackers) */ getTrackers(options?: GetTrackersRequest): Promise; /** * List all workspaces (GET /v2/workspaces) */ listWorkspaces(): Promise; /** * List public library folders (GET /v2/library/folders) */ listLibraryFolders(options?: ListLibraryFoldersRequest): Promise; /** * Get calls in a specific library folder (GET /v2/library/folder-content) */ getLibraryFolderCalls(options: GetLibraryFolderCallsRequest): Promise; /** * Auto-paginating /v2/calls/extensive fetch with parties + Extended context. * Stops at maxCalls or when the API returns no cursor. */ private fetchCallsExtensiveWithContext; /** * Search calls by account/company via email-domain match on parties. * Optionally also matches on CRM Account context object names. */ searchCallsByAccount(options: SearchCallsByAccountRequest): Promise<{ calls: CallDetailsResponse['calls']; totalScanned: number; matched: number; limitedByMaxCalls: boolean; }>; /** * Search calls linked to specific CRM Opportunities. * Requires Gong-CRM integration; calls without CRM linkage will not match. */ searchCallsByOpportunity(options: SearchCallsByOpportunityRequest): Promise<{ calls: CallDetailsResponse['calls']; totalScanned: number; matched: number; limitedByMaxCalls: boolean; }>; /** * Free-text keyword search across transcripts within a bounded date range. * Two phases: (1) narrow call set with extensive, (2) fetch transcripts and * post-filter sentences. Use Gong Trackers for known recurring terms instead. */ searchTranscripts(options: SearchTranscriptsRequest): Promise; }