Scheduling infrastructure for absolutely everyone.
chore: add webhook in payload (#17468)
Udit Takkardd944bace1b2
diff --git a/packages/features/tasker/tasks/triggerNoShow/common.ts b/packages/features/tasker/tasks/triggerNoShow/common.tsindex 1bf8fc0c372..0f338cd3ddd 100644--- a/packages/features/tasker/tasks/triggerNoShow/common.ts+++ b/packages/features/tasker/tasks/triggerNoShow/common.ts@@ -60,14 +60,22 @@ export function sendWebhookPayload(createdAt: new Date().toISOString(),webhook,data: {+ title: booking.title,bookingId: booking.id,bookingUid: booking.uid,startTime: booking.startTime,+ attendees: booking.attendees,endTime: booking.endTime,- ...(triggerEvent === WebhookTriggerEvents.AFTER_HOSTS_CAL_VIDEO_NO_SHOW ? { email: hostEmail } : {}),+ ...(!!hostEmail ? { hostEmail } : {}),eventType: {...booking.eventType,id: booking.eventTypeId,+ hosts: undefined,+ users: undefined,+ },+ webhook: {+ ...webhook,+ secret: undefined,},message:triggerEvent === WebhookTriggerEvents.AFTER_GUESTS_CAL_VIDEO_NO_SHOW@@ -122,7 +130,8 @@ export const prepareNoShowTrigger = async (return;}- const dailyVideoReference = booking.references.find((reference) => reference.type === "daily_video");+ const dailyVideoReference =+ booking.references?.filter((reference) => reference.type === "daily_video")?.pop() ?? null;if (!dailyVideoReference) {log.error(diff --git a/packages/features/tasker/tasks/triggerNoShow/triggerHostNoShow.test.ts b/packages/features/tasker/tasks/triggerNoShow/triggerHostNoShow.test.tsindex c6daa17c0d4..a4c7c15dc0c 100644--- a/packages/features/tasker/tasks/triggerNoShow/triggerHostNoShow.test.ts+++ b/packages/features/tasker/tasks/triggerNoShow/triggerHostNoShow.test.ts@@ -126,21 +126,23 @@ describe("Trigger Host No Show:", () => {vi.mocked(getMeetingSessionsFromRoomName).mockResolvedValue(EMPTY_MEETING_SESSIONS);+ const TEST_WEBHOOK = {+ id: "22",+ eventTriggers: [WebhookTriggerEvents.AFTER_HOSTS_CAL_VIDEO_NO_SHOW],+ subscriberUrl,+ active: true,+ eventTypeId: 1,+ appId: null,+ time: 5,+ timeUnit: TimeUnit.MINUTE,+ payloadTemplate: null,+ secret: null,+ };+const payload = JSON.stringify({triggerEvent: WebhookTriggerEvents.AFTER_HOSTS_CAL_VIDEO_NO_SHOW,bookingId: 222,- webhook: {- id: "22",- eventTriggers: [WebhookTriggerEvents.AFTER_HOSTS_CAL_VIDEO_NO_SHOW],- subscriberUrl,- active: true,- eventTypeId: 1,- appId: null,- time: 5,- timeUnit: TimeUnit.MINUTE,- payloadTemplate: null,- secret: null,- },+ webhook: TEST_WEBHOOK,} satisfies TSendNoShowWebhookPayloadSchema);await triggerHostNoShow(payload);@@ -150,17 +152,23 @@ describe("Trigger Host No Show:", () => {await expectWebhookToHaveBeenCalledWith(subscriberUrl, {triggerEvent: WebhookTriggerEvents.AFTER_HOSTS_CAL_VIDEO_NO_SHOW,payload: {+ title: "Test Booking Title",+ attendees: [],bookingId: 222,bookingUid: uidOfBooking,- email: "[email protected]",+ hostEmail: "[email protected]",startTime: `${plus1DateString}T05:00:00.000Z`,endTime: `${plus1DateString}T05:15:00.000Z`,eventType: {id: 1,teamId: null,parentId: null,- hosts: [],- users: [{ id: organizer.id, email: organizer.email }],+ },+ webhook: {+ ...TEST_WEBHOOK,+ secret: undefined,+ active: undefined,+ eventTypeId: undefined,},message: `Host with email ${organizer.email} didn't join the call or didn't join before ${maxStartTimeHumanReadable}`,},@@ -278,21 +286,23 @@ describe("Trigger Host No Show:", () => {vi.mocked(getMeetingSessionsFromRoomName).mockResolvedValue(MOCKED_MEETING_SESSIONS);+ const TEST_WEBHOOK = {+ id: "22",+ eventTriggers: [WebhookTriggerEvents.AFTER_HOSTS_CAL_VIDEO_NO_SHOW],+ subscriberUrl,+ active: true,+ eventTypeId: 1,+ appId: null,+ time: 5,+ timeUnit: TimeUnit.MINUTE,+ payloadTemplate: null,+ secret: null,+ };+const payload = JSON.stringify({triggerEvent: WebhookTriggerEvents.AFTER_HOSTS_CAL_VIDEO_NO_SHOW,bookingId: 222,- webhook: {- id: "22",- eventTriggers: [WebhookTriggerEvents.AFTER_HOSTS_CAL_VIDEO_NO_SHOW],- subscriberUrl,- active: true,- eventTypeId: 1,- appId: null,- time: 5,- timeUnit: TimeUnit.MINUTE,- payloadTemplate: null,- secret: null,- },+ webhook: TEST_WEBHOOK,} satisfies TSendNoShowWebhookPayloadSchema);await triggerHostNoShow(payload);@@ -303,17 +313,23 @@ describe("Trigger Host No Show:", () => {await expectWebhookToHaveBeenCalledWith(subscriberUrl, {triggerEvent: WebhookTriggerEvents.AFTER_HOSTS_CAL_VIDEO_NO_SHOW,payload: {+ title: "Test Booking Title",+ attendees: [],bookingId: 222,bookingUid: uidOfBooking,- email: "[email protected]",+ hostEmail: "[email protected]",startTime: `${plus1DateString}T05:00:00.000Z`,endTime: `${plus1DateString}T05:15:00.000Z`,eventType: {id: 1,teamId: null,parentId: null,- hosts: [],- users: [{ id: organizer.id, email: organizer.email }],+ },+ webhook: {+ ...TEST_WEBHOOK,+ secret: undefined,+ active: undefined,+ eventTypeId: undefined,},message: `Host with email ${organizer.email} didn't join the call or didn't join before ${maxStartTimeHumanReadable}`,},