Turn meetings into live agent loops. Record, transcribe, and analyze meetings with real-time AI intelligence — before, during, and after calls.
fix: webhook triggers
Om Gate99895b35d0d3
diff --git a/src/main/services/copilot/sales-copilot.service.ts b/src/main/services/copilot/sales-copilot.service.tsindex 49a5742..e2a305d 100644--- a/src/main/services/copilot/sales-copilot.service.ts+++ b/src/main/services/copilot/sales-copilot.service.ts@@ -605,10 +605,6 @@ export class MeetingCopilotService extends EventEmitter {duration,});- // Trigger workflow webhooks (fire and forget)- this.triggerWorkflowWebhooks(recordingId, summary, duration, segments).catch((err) => {- log.error({ err }, 'Failed to trigger workflow webhooks');- });// Cleanupthis.transcriptBuffer.clear(sessionId);@@ -618,53 +614,6 @@ export class MeetingCopilotService extends EventEmitter {return summary;}- /**- * Trigger workflow webhooks with meeting data- */- private async triggerWorkflowWebhooks(- recordingId: number,- summary: PostMeetingSummary,- duration: number,- segments: TranscriptSegmentData[]- ): Promise<void> {- const { triggerWorkflowWebhooks } = await import('../workflow-webhook.service');-- // Fetch recording data for video details- const recording = getRecordingById(recordingId);- if (!recording) {- log.warn({ recordingId }, 'Recording not found for workflow webhooks');- return;- }-- // Prepare transcript data- const transcript = segments.map((seg) => ({- speaker: seg.channel as 'me' | 'them',- text: seg.text,- timestamp: seg.startTime,- }));-- // Trigger webhooks- await triggerWorkflowWebhooks({- recordingId,- title: (recording as any).meetingName || 'Meeting Recording',- description: (recording as any).meetingDescription,- startedAt: recording.createdAt,- endedAt: new Date().toISOString(),- durationSeconds: Math.round(duration),- exportedVideoId: recording.videoId || '',- playerUrl: recording.playerUrl || '',- streamId: (recording as any).streamUrl,- summary: summary.shortOverview,- topics: summary.keyPoints.map((kp) => kp.topic),- actionItems: summary.keyPoints.flatMap((kp) => kp.points),- checklist: summary.postMeetingChecklist.map((item) => ({- text: item,- completed: false,- })),- transcript,- });- }-/*** Export meeting to markdown file in ~/.notter/*/diff --git a/src/main/services/export-poller.service.ts b/src/main/services/export-poller.service.tsindex b4072b6..550008a 100644--- a/src/main/services/export-poller.service.ts+++ b/src/main/services/export-poller.service.ts@@ -6,8 +6,9 @@*/import { createChildLogger } from '../lib/logger';-import { updateRecordingBySessionId } from '../db';+import { updateRecordingBySessionId, getRecordingBySessionId, getTranscriptSegmentsBySession } from '../db';import { checkSessionExport, recoverExportedRecording } from './recording-export.service';+import { triggerWorkflowWebhooks, type MeetingCompletionData } from './workflow-webhook.service';const logger = createChildLogger('export-poller');@@ -75,6 +76,11 @@ export function startExportPoller(if (!recovery.success) {logger.error({ sessionId, error: recovery.error }, 'Failed to recover recording');+ } else {+ // Trigger workflow webhooks now that we have the video data+ triggerPostExportWorkflows(sessionId).catch((err) => {+ logger.error({ sessionId, error: err }, 'Failed to trigger workflow webhooks');+ });}} else if (result.status === 'failed') {logger.error({ sessionId }, 'Session failed on VideoDB');@@ -128,3 +134,86 @@ export function isPollerActive(sessionId: string): boolean {export function getActivePollerCount(): number {return activePollers.size;}++/**+ * Trigger workflow webhooks after export completes+ * This is called AFTER the recording has been updated with videoId/playerUrl+ */+async function triggerPostExportWorkflows(sessionId: string): Promise<void> {+ const recording = getRecordingBySessionId(sessionId);+ if (!recording) {+ logger.warn({ sessionId }, 'Recording not found for workflow webhooks');+ return;+ }++ // Check we have the video data+ if (!recording.videoId || !recording.playerUrl) {+ logger.warn({ sessionId }, 'Recording missing video data for workflow webhooks');+ return;+ }++ // Get transcript segments+ const segments = getTranscriptSegmentsBySession(sessionId);+ const transcript = segments.map((seg) => ({+ speaker: seg.channel as 'me' | 'them',+ text: seg.text,+ timestamp: seg.startTime,+ }));++ // Parse stored summary data+ let summary: string | undefined;+ let topics: string[] | undefined;+ let actionItems: string[] | undefined;+ let checklist: Array<{ text: string; completed: boolean }> | undefined;++ if ((recording as any).shortOverview) {+ summary = (recording as any).shortOverview;+ }++ if ((recording as any).keyPoints) {+ try {+ const keyPoints = JSON.parse((recording as any).keyPoints);+ if (Array.isArray(keyPoints)) {+ topics = keyPoints.map((kp: any) => kp.topic);+ actionItems = keyPoints.flatMap((kp: any) => kp.points || []);+ }+ } catch {+ // ignore parse errors+ }+ }++ if ((recording as any).postMeetingChecklist) {+ try {+ const items = JSON.parse((recording as any).postMeetingChecklist);+ if (Array.isArray(items)) {+ checklist = items.map((item: string) => ({ text: item, completed: false }));+ }+ } catch {+ // ignore parse errors+ }+ }++ const meetingData: MeetingCompletionData = {+ recordingId: recording.id,+ title: (recording as any).meetingName || 'Meeting Recording',+ description: (recording as any).meetingDescription,+ startedAt: recording.createdAt,+ endedAt: new Date().toISOString(),+ durationSeconds: recording.duration || 0,+ exportedVideoId: recording.videoId,+ playerUrl: recording.playerUrl,+ streamId: recording.streamUrl || undefined,+ summary,+ topics,+ actionItems,+ checklist,+ transcript,+ };++ logger.info(+ { sessionId, recordingId: recording.id, hasPlayerUrl: !!recording.playerUrl },+ 'Triggering workflow webhooks after export'+ );++ await triggerWorkflowWebhooks(meetingData);+}