import { defineLogicFunction } from 'twenty-sdk/define'; import { GRANOLA_CRON_INTERVAL_MINUTES } from 'src/logic-functions/constants/granola-sync'; import { GRANOLA_SYNC_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers'; import { granolaSyncHandler } from 'src/logic-functions/handlers/granola-sync-handler'; export default defineLogicFunction({ universalIdentifier: GRANOLA_SYNC_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER, name: 'granola-sync', description: 'Polls the Granola REST API on a schedule for notes updated within the overlap window (and once per day re-sweeps the last 24h), upserting a Note + NoteTargets on participants and a CallRecording with the summary and transcript for each meeting.', timeoutSeconds: 300, cronTriggerSettings: { pattern: `*/${GRANOLA_CRON_INTERVAL_MINUTES} * * * *`, }, handler: granolaSyncHandler, });