Skip to content

Commit 47519e3

Browse files
waleedlatif1claude
andauthored
fix(fireflies): support V2 webhook payload format for meetingId mapping (#4221)
* fix(fireflies): support V2 webhook payload format for meetingId mapping Fireflies V2 webhooks use snake_case field names (meeting_id, event, client_reference_id) instead of camelCase (meetingId, eventType, clientReferenceId). The formatInput handler now auto-detects V1 vs V2 payloads and maps fields correctly, fixing empty meetingId on V2 webhooks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(fireflies): guard against NaN timestamp, use stricter V2 detection Address PR review feedback: - Use Number.isFinite guard to prevent NaN timestamp propagation - Use AND instead of OR for V2 detection since both meeting_id and event are required fields in every V2 payload Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2f93205 commit 47519e3

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

apps/sim/blocks/blocks/fireflies.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,10 @@ Return ONLY the summary text - no quotes, no labels.`,
595595
meetingId: { type: 'string', description: 'Meeting/transcript ID from webhook' },
596596
eventType: { type: 'string', description: 'Webhook event type' },
597597
clientReferenceId: { type: 'string', description: 'Custom reference ID if set during upload' },
598+
timestamp: {
599+
type: 'number',
600+
description: 'Unix timestamp in milliseconds when the event was fired',
601+
},
598602
},
599603
triggers: {
600604
enabled: true,

apps/sim/lib/webhooks/providers/fireflies.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,23 @@ function validateFirefliesSignature(secret: string, signature: string, body: str
4545
export const firefliesHandler: WebhookProviderHandler = {
4646
async formatInput({ body }: FormatInputContext): Promise<FormatInputResult> {
4747
const b = body as Record<string, unknown>
48+
49+
// Fireflies V2 webhooks use snake_case field names and "event" instead of "eventType".
50+
// Both meeting_id and event are required in every V2 payload, so AND is the correct check.
51+
const isV2 = typeof b.meeting_id === 'string' && typeof b.event === 'string'
52+
53+
const meetingId = ((isV2 ? b.meeting_id : b.meetingId) || '') as string
54+
const eventType = ((isV2 ? b.event : b.eventType) || 'Transcription completed') as string
55+
const clientReferenceId = ((isV2 ? b.client_reference_id : b.clientReferenceId) || '') as string
56+
const rawTimestamp = b.timestamp != null ? Number(b.timestamp) : null
57+
const timestamp = rawTimestamp !== null && Number.isFinite(rawTimestamp) ? rawTimestamp : null
58+
4859
return {
4960
input: {
50-
meetingId: (b.meetingId || '') as string,
51-
eventType: (b.eventType || 'Transcription completed') as string,
52-
clientReferenceId: (b.clientReferenceId || '') as string,
61+
meetingId,
62+
eventType,
63+
clientReferenceId,
64+
...(timestamp !== null ? { timestamp } : {}),
5365
},
5466
}
5567
},

apps/sim/triggers/fireflies/transcription_complete.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ export const firefliesTranscriptionCompleteTrigger: TriggerConfig = {
3838
defaultValue: [
3939
'Go to <a href="https://app.fireflies.ai/settings" target="_blank" rel="noopener noreferrer">app.fireflies.ai/settings</a>',
4040
'Navigate to the <strong>Developer settings</strong> tab',
41-
'In the <strong>Webhook</strong> section, paste the Webhook URL above',
41+
'In the <strong>Webhook</strong> or <strong>Webhooks V2</strong> section, paste the Webhook URL above',
4242
'Enter a <strong>Secret</strong> (16-32 characters) and save it here as well',
4343
'Click <strong>Save</strong> in Fireflies to activate the webhook',
44-
'Your workflow will now trigger when any meeting transcription completes',
44+
'Both Webhook V1 and V2 formats are supported automatically',
4545
]
4646
.map(
4747
(instruction, index) =>
@@ -59,12 +59,16 @@ export const firefliesTranscriptionCompleteTrigger: TriggerConfig = {
5959
},
6060
eventType: {
6161
type: 'string',
62-
description: 'The type of event (Transcription completed)',
62+
description: 'The type of event (e.g. Transcription completed, meeting.transcribed)',
6363
},
6464
clientReferenceId: {
6565
type: 'string',
6666
description: 'Custom reference ID if set during upload',
6767
},
68+
timestamp: {
69+
type: 'number',
70+
description: 'Unix timestamp in milliseconds when the event was fired (V2 webhooks)',
71+
},
6872
},
6973

7074
webhook: {

0 commit comments

Comments
 (0)