fix: revert assignmentReason breaking change in webhook payloads (#27891)

* fix: revert assignmentReason breaking change in webhook payloads

Remove the new { category, details } format from EventPayloadType to
maintain backward compatibility for webhook consumers. The new format
is stripped at all webhook payload construction sites by destructuring
assignmentReason out of CalendarEvent before spreading into the payload.

A sanitizeAssignmentReasonForWebhook function provides an additional
safety net in sendPayload itself. Emails and booking single view
continue to use the new format via CalendarEvent.

Co-Authored-By: [email protected] <[email protected]>

* fix: strip assignmentReason from handlePaymentSuccess webhook payload

Co-Authored-By: [email protected] <[email protected]>

* fix: strip assignmentReason from triggerWebhooks and handleSeats webhook payloads

Co-Authored-By: [email protected] <[email protected]>

* refactor: use zod safeParse instead of type assertion in sanitizeAssignmentReasonForWebhook

Co-Authored-By: [email protected] <[email protected]>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-02-16 21:55:10 -03:00
1 parent 21d28c9747
commit 3a7122d613
11 files changed
+225 -67

No files matched your search

@@ -54,8 +54,9 @@ export const triggerRecordingReadyWebhook = async ({
})
);
const { assignmentReason: _emailAssignmentReason, ...evtWithoutAssignmentReason } = evt;
const payload: EventPayloadType = {
...evt,
...evtWithoutAssignmentReason,
downloadLink,
};
@@ -94,8 +95,9 @@ export const triggerTranscriptionGeneratedWebhook = async ({
})
);
const { assignmentReason: _emailAssignmentReason2, ...evtWithoutAssignmentReason2 } = evt;
const payload: EventPayloadType = {
...evt,
...evtWithoutAssignmentReason2,
downloadLinks,
};