Files
WeHub Mirror 6bf8bebf51
CI / Test and Build (push) Failing after 1s
CI / Migrate Dev DB (push) Has been skipped
CI / Migrate DB (push) Has been skipped
CodeQL / Analyze actions (push) Has been cancelled
CodeQL / Analyze javascript-typescript (push) Has been cancelled
CI / Detect Version (push) Has been cancelled
CI / Detect Desktop Changes (push) Has been cancelled
CI / Build AMD64 (blacksmith-2vcpu-ubuntu-2404, ./docker/cron.Dockerfile, ubuntu-latest, ghcr.io/simstudioai/cron) (push) Has been cancelled
CI / Build AMD64 (blacksmith-2vcpu-ubuntu-2404, ./docker/db.Dockerfile, ECR_MIGRATIONS, ubuntu-latest, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (blacksmith-4vcpu-ubuntu-2404, ./docker/pii.Dockerfile, ECR_PII, ubuntu-latest, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (blacksmith-4vcpu-ubuntu-2404, ./docker/realtime.Dockerfile, ECR_REALTIME, ubuntu-latest, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build AMD64 (blacksmith-8vcpu-ubuntu-2404, ./docker/app.Dockerfile, ECR_APP, linux-x64-8-core, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (blacksmith-4vcpu-ubuntu-2404-arm, ./docker/cron.Dockerfile, ubuntu-24.04-arm, ghcr.io/simstudioai/cron) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (blacksmith-4vcpu-ubuntu-2404-arm, ./docker/db.Dockerfile, ubuntu-24.04-arm, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (blacksmith-4vcpu-ubuntu-2404-arm, ./docker/pii.Dockerfile, ubuntu-24.04-arm, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (blacksmith-4vcpu-ubuntu-2404-arm, ./docker/realtime.Dockerfile, ubuntu-24.04-arm, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (blacksmith-8vcpu-ubuntu-2404-arm, ./docker/app.Dockerfile, linux-arm64-8-core, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
Helm Chart / Lint, test, and validate chart (push) Has been cancelled
Helm Chart / Chart version bumped (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
CI / Build Dev ECR (blacksmith-8vcpu-ubuntu-2404, ./docker/app.Dockerfile, ECR_APP, linux-x64-8-core) (push) Has been cancelled
CI / Promote Images (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/cron) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build Dev ECR (blacksmith-2vcpu-ubuntu-2404, ./docker/db.Dockerfile, ECR_MIGRATIONS, ubuntu-latest) (push) Has been cancelled
CI / Build Dev ECR (blacksmith-4vcpu-ubuntu-2404, ./docker/pii.Dockerfile, ECR_PII, ubuntu-latest) (push) Has been cancelled
CI / Build Dev ECR (blacksmith-4vcpu-ubuntu-2404, ./docker/realtime.Dockerfile, ECR_REALTIME, ubuntu-latest) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Check Desktop Signing Secrets (push) Has been cancelled
CI / Desktop Release (push) Has been cancelled
CI / Create Desktop Prerelease (push) Has been cancelled
CI / Desktop Prerelease Build (push) Has been cancelled
CI / Publish Desktop Prerelease (push) Has been cancelled
CI / Prune Desktop Prereleases (push) Has been cancelled
Helm Chart / Install on kind and run helm test (push) Has been cancelled
WeHub snapshot of cb28d14c6f2c081de7a0d8729a8c816c9adef67a
2026-08-10 11:17:50 +08:00

161 lines
5.1 KiB
TypeScript

import type { GongGetCallTranscriptParams, GongGetCallTranscriptResponse } from '@/tools/gong/types'
import { getGongErrorMessage, parseGongIdList } from '@/tools/gong/utils'
import type { ToolConfig } from '@/tools/types'
export const getCallTranscriptTool: ToolConfig<
GongGetCallTranscriptParams,
GongGetCallTranscriptResponse
> = {
id: 'gong_get_call_transcript',
name: 'Gong Get Call Transcript',
description: 'Retrieve transcripts of calls from Gong by call IDs or date range.',
version: '1.0.0',
params: {
accessKey: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Gong API Access Key',
},
accessKeySecret: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Gong API Access Key Secret',
},
callIds: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Comma-separated list of call IDs to retrieve transcripts for',
},
fromDateTime: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Start date/time filter in ISO-8601 format',
},
toDateTime: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'End date/time filter in ISO-8601 format',
},
workspaceId: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Gong workspace ID to filter calls',
},
cursor: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Pagination cursor from a previous response',
},
},
request: {
url: 'https://api.gong.io/v2/calls/transcript',
method: 'POST',
headers: (params) => ({
'Content-Type': 'application/json',
Authorization: `Basic ${btoa(`${params.accessKey}:${params.accessKeySecret}`)}`,
}),
body: (params) => {
const filter: Record<string, unknown> = {}
const callIds = parseGongIdList(params.callIds)
if (callIds) filter.callIds = callIds
if (params.fromDateTime?.trim()) filter.fromDateTime = params.fromDateTime.trim()
if (params.toDateTime?.trim()) filter.toDateTime = params.toDateTime.trim()
if (params.workspaceId?.trim()) filter.workspaceId = params.workspaceId.trim()
const body: Record<string, unknown> = { filter }
if (params.cursor?.trim()) body.cursor = params.cursor.trim()
return body
},
},
transformResponse: async (response: Response) => {
const data = await response.json()
if (!response.ok) {
throw new Error(getGongErrorMessage(data, 'Failed to get call transcript'))
}
const callTranscripts = (data.callTranscripts ?? []).map((ct: Record<string, unknown>) => ({
callId: ct.callId ?? '',
transcript: ((ct.transcript as Record<string, unknown>[]) ?? []).map((t) => ({
speakerId: t.speakerId ?? null,
topic: t.topic ?? null,
sentences: ((t.sentences as Record<string, unknown>[]) ?? []).map((s) => ({
start: s.start ?? 0,
end: s.end ?? 0,
text: s.text ?? '',
})),
})),
}))
return {
success: true,
output: {
requestId: data.requestId ?? null,
callTranscripts,
cursor: data.records?.cursor ?? null,
},
}
},
outputs: {
requestId: {
type: 'string',
description: 'A Gong request reference ID for troubleshooting purposes',
optional: true,
},
callTranscripts: {
type: 'array',
description: 'List of call transcripts with speaker turns and sentences',
items: {
type: 'object',
properties: {
callId: { type: 'string', description: "Gong's unique numeric identifier for the call" },
transcript: {
type: 'array',
description: 'List of monologues in the call',
items: {
type: 'object',
properties: {
speakerId: {
type: 'string',
description: 'Unique ID of the speaker, cross-reference with parties',
},
topic: { type: 'string', description: 'Name of the topic being discussed' },
sentences: {
type: 'array',
description: 'List of sentences spoken in the monologue',
items: {
type: 'object',
properties: {
start: {
type: 'number',
description: 'Start time of the sentence in milliseconds from call start',
},
end: {
type: 'number',
description: 'End time of the sentence in milliseconds from call start',
},
text: { type: 'string', description: 'The sentence text' },
},
},
},
},
},
},
},
},
},
cursor: {
type: 'string',
description: 'Pagination cursor for the next page',
optional: true,
},
},
}