Skip to content

The open alternative to Salesforce, designed for AI.

1.1 KB
Raw Blame
import { defineLogicFunction } from 'twenty-sdk/define';

import { FATHOM_GENERATE_CALL_RECORDING_TITLE_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
import { fathomGenerateCallRecordingTitlePayloadSchema } from 'src/logic-functions/schemas/fathom-generate-call-recording-title-payload.schema';
import { createFathomCoreApiClient } from 'src/logic-functions/utils/create-fathom-core-api-client.util';
import { renameFathomCallRecording } from 'src/logic-functions/utils/rename-fathom-call-recording.util';

export const fathomGenerateCallRecordingTitleHandler = async (
  payload: unknown,
) =>
  renameFathomCallRecording({
    coreApiClient: createFathomCoreApiClient(),
    payload: fathomGenerateCallRecordingTitlePayloadSchema.parse(payload),
  });

export default defineLogicFunction({
  universalIdentifier:
    FATHOM_GENERATE_CALL_RECORDING_TITLE_UNIVERSAL_IDENTIFIER,
  name: 'fathom-generate-call-recording-title',
  description:
    'Adds a summary topic to an impromptu recording if its saved title is unchanged.',
  timeoutSeconds: 300,
  handler: fathomGenerateCallRecordingTitleHandler,
});