From 1cf584872c4f5ef6d454769cdc5e5c09f574be4e Mon Sep 17 00:00:00 2001 From: Jay Padaliya Date: Wed, 7 Aug 2024 13:40:44 +0000 Subject: [PATCH 1/2] added NewPresFileAvailableEvtMsg event --- src/process/event.js | 46 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 5 deletions(-) diff --git a/src/process/event.js b/src/process/event.js index 4e0b2c1..af93e77 100644 --- a/src/process/event.js +++ b/src/process/event.js @@ -14,6 +14,7 @@ export default class WebhooksEvent { "meeting-screenshare-started", "meeting-screenshare-stopped", "meeting-presentation-changed", + "presentation-annotated-pdf-ready", "user-joined", "user-left", "user-audio-voice-enabled", @@ -59,6 +60,9 @@ export default class WebhooksEvent { "SetCurrentPresentationEvtMsg", "RecordingStatusChangedEvtMsg", ], + PRESENTATION_EVENTS: [ + "NewPresFileAvailableEvtMsg", + ], USER_EVENTS: [ "UserJoinedMeetingEvtMsg", "UserLeftMeetingEvtMsg", @@ -120,6 +124,8 @@ export default class WebhooksEvent { if (this.inputEvent) { if (this.mappedEvent(this.inputEvent, WebhooksEvent.RAW.MEETING_EVENTS)) { this.meetingTemplate(this.inputEvent); + } else if (this.mappedEvent(this.inputEvent, WebhooksEvent.RAW.PRESENTATION_EVENTS)) { + this.presentationTemplate(this.inputEvent); } else if (this.mappedEvent(this.inputEvent, WebhooksEvent.RAW.USER_EVENTS)) { this.userTemplate(this.inputEvent); } else if (this.mappedEvent(this.inputEvent, WebhooksEvent.RAW.CHAT_EVENTS)) { @@ -157,6 +163,10 @@ export default class WebhooksEvent { return true; } + if (messageObj?.core?.header?.name === event) { + return true; + } + if (messageObj?.envelope?.name === event) { return true; } @@ -365,6 +375,33 @@ export default class WebhooksEvent { }; } + presentationTemplate(messageObj) { + const meetingId = messageObj.core.header.meetingId; + const userId = messageObj.core.header.userId; + const extId = UserMapping.get().getExternalUserID(userId) || ""; + const data = messageObj.core.body; + this.outputEvent = { + data: { + "type": "event", + "id": this.mapInternalMessage(messageObj), + "attributes": { + "meeting": { + "internal-meeting-id": meetingId, + "external-meeting-id": IDMapping.get().getExternalMeetingID(meetingId) + }, + "user":{ + "internal-user-id": userId, + "external-user-id": extId, + }, + "annotated-file-uri": data.annotatedFileURI, + "pres-id": data.presId, + }, + "event": { + "ts": Date.now() + } + } + }; + } rapTemplate(messageObj) { const data = messageObj.core.body; this.outputEvent = { @@ -524,9 +561,7 @@ export default class WebhooksEvent { } mapInternalMessage(message) { - const name = message?.envelope?.name || message?.header?.name; - - const mappedMsg = (() => { switch (name) { + const mappedMsg = (name) => { switch (name) { case "MeetingCreatedEvtMsg": return "meeting-created"; case "MeetingDestroyedEvtMsg": return "meeting-ended"; case "RecordingStatusChangedEvtMsg": return this.handleRecordingStatusChanged(message); @@ -552,6 +587,7 @@ export default class WebhooksEvent { case "PadContentEvtMsg": return "pad-content"; case "PollStartedEvtMsg": return "poll-started"; case "UserRespondedToPollRespMsg": return "poll-responded"; + case "NewPresFileAvailableEvtMsg": return "presentation-annotated-pdf-ready"; // RAP case "archive_started": return "rap-archive-started"; case "archive_ended": return "rap-archive-ended"; @@ -570,8 +606,8 @@ export default class WebhooksEvent { case "deleted": return "rap-deleted"; case "post_publish_started": return "rap-post-publish-started"; case "post_publish_ended": return "rap-post-publish-ended"; - } })(); + } }; - return mappedMsg; + return mappedMsg(message?.envelope?.name) || mappedMsg(message?.header?.name) || mappedMsg(message?.core?.header?.name); } } From df9bd657f7f89946f10ffaf0c9a5c91cc0670466 Mon Sep 17 00:00:00 2001 From: Jay Padaliya Date: Thu, 8 Aug 2024 16:02:45 +0000 Subject: [PATCH 2/2] added presentation-uploaded event --- src/process/event.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/process/event.js b/src/process/event.js index af93e77..b6524c8 100644 --- a/src/process/event.js +++ b/src/process/event.js @@ -14,6 +14,7 @@ export default class WebhooksEvent { "meeting-screenshare-started", "meeting-screenshare-stopped", "meeting-presentation-changed", + "presentation-uploaded", "presentation-annotated-pdf-ready", "user-joined", "user-left", @@ -61,6 +62,7 @@ export default class WebhooksEvent { "RecordingStatusChangedEvtMsg", ], PRESENTATION_EVENTS: [ + "PresentationConversionCompletedEvtMsg", "NewPresFileAvailableEvtMsg", ], USER_EVENTS: [ @@ -380,6 +382,7 @@ export default class WebhooksEvent { const userId = messageObj.core.header.userId; const extId = UserMapping.get().getExternalUserID(userId) || ""; const data = messageObj.core.body; + this.outputEvent = { data: { "type": "event", @@ -392,15 +395,21 @@ export default class WebhooksEvent { "user":{ "internal-user-id": userId, "external-user-id": extId, - }, - "annotated-file-uri": data.annotatedFileURI, - "pres-id": data.presId, + } }, "event": { "ts": Date.now() } } }; + + if (this.outputEvent.data.id === "presentation-uploaded") { + this.outputEvent.data.attributes["pres-id"] = data.presentation.id; + this.outputEvent.data.attributes["name"] = data.presentation.name; + } else if (this.outputEvent.data.id === "presentation-annotated-pdf-ready") { + this.outputEvent.data.attributes["pres-id"] = data.presId; + this.outputEvent.data.attributes["annotated-file-uri"] = data.annotatedFileURI; + } } rapTemplate(messageObj) { const data = messageObj.core.body; @@ -587,6 +596,7 @@ export default class WebhooksEvent { case "PadContentEvtMsg": return "pad-content"; case "PollStartedEvtMsg": return "poll-started"; case "UserRespondedToPollRespMsg": return "poll-responded"; + case "PresentationConversionCompletedEvtMsg": return "presentation-uploaded"; case "NewPresFileAvailableEvtMsg": return "presentation-annotated-pdf-ready"; // RAP case "archive_started": return "rap-archive-started";