Skip to content

Commit 44000c7

Browse files
committed
new components
1 parent acf9687 commit 44000c7

File tree

6 files changed

+269
-4
lines changed

6 files changed

+269
-4
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import zoom from "../../zoom.app.mjs";
2+
3+
export default {
4+
key: "zoom-get-meeting-transcript",
5+
name: "Get Meeting Transcript",
6+
description: "Get the transcript of a meeting. [See the documentation](https://developers.zoom.us/docs/api/meetings/#tag/cloud-recording/get/meetings/{meetingId}/transcript)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
zoom,
11+
meetingId: {
12+
propDefinition: [
13+
zoom,
14+
"meetingId",
15+
],
16+
description: "The meeting ID to get the transcript for",
17+
optional: false,
18+
},
19+
},
20+
methods: {
21+
getMeetingTranscript({
22+
meetingId, ...opts
23+
}) {
24+
return this.zoom._makeRequest({
25+
path: `/meetings/${meetingId}/transcript`,
26+
...opts,
27+
});
28+
},
29+
},
30+
async run({ $: step }) {
31+
const transcript = await this.getMeetingTranscript({
32+
step,
33+
meetingId: this.meetingId,
34+
});
35+
36+
step.export("$summary", `Retrieved transcript for meeting ${this.meetingId}`);
37+
return transcript;
38+
},
39+
};

components/zoom/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/zoom",
3-
"version": "0.6.0",
3+
"version": "0.7.0",
44
"description": "Pipedream Zoom Components",
55
"main": "zoom.app.mjs",
66
"keywords": [
@@ -14,6 +14,6 @@
1414
"access": "public"
1515
},
1616
"dependencies": {
17-
"@pipedream/platform": "^1.3.0"
17+
"@pipedream/platform": "^3.1.0"
1818
}
1919
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
import common from "../common/common.mjs";
2+
import constants from "../common/constants.mjs";
3+
4+
export default {
5+
...common,
6+
key: "zoom-new-recording-transcript-completed",
7+
name: "New Recording Transcript Completed (Instant)",
8+
description: "Emit new event each time a recording transcript is completed",
9+
version: "0.0.1",
10+
type: "source",
11+
dedupe: "unique",
12+
props: {
13+
...common.props,
14+
// eslint-disable-next-line pipedream/props-label, pipedream/props-description
15+
apphook: {
16+
type: "$.interface.apphook",
17+
appProp: "app",
18+
eventNames() {
19+
return [
20+
constants.CUSTOM_EVENT_TYPES.RECORDING_TRANSCRIPT_COMPLETED,
21+
];
22+
},
23+
},
24+
},
25+
hooks: {
26+
async deploy() {
27+
const { meetings } = await this.app.listMeetings({
28+
params: {
29+
from: this.monthAgo(),
30+
to: new Date().toISOString()
31+
.slice(0, 10),
32+
page_size: 25,
33+
},
34+
});
35+
if (!meetings || meetings.length === 0) {
36+
return;
37+
}
38+
for (const meeting of meetings) {
39+
if (!this.isMeetingRelevant(meeting)) {
40+
continue;
41+
}
42+
for (const file of meeting.recording_files) {
43+
if (!this.isFileRelevant(file)) {
44+
continue;
45+
}
46+
this.emitEvent(file, meeting);
47+
}
48+
}
49+
},
50+
},
51+
methods: {
52+
...common.methods,
53+
isMeetingRelevant(meeting) {
54+
return meeting.recording_files && meeting.recording_files.length > 0;
55+
},
56+
isFileRelevant(file) {
57+
return file.file_type === "TRANSCRIPT" && file.status === "completed";
58+
},
59+
emitEvent(file, meeting) {
60+
this.$emit({
61+
meeting,
62+
file,
63+
}, this.generateMeta(file, meeting));
64+
},
65+
generateMeta(file, meeting) {
66+
return {
67+
id: file.id,
68+
summary: `Transcript completed for ${meeting.topic}`,
69+
ts: +new Date(file.recording_end),
70+
};
71+
},
72+
},
73+
async run(event) {
74+
if (event.event !== constants.CUSTOM_EVENT_TYPES.RECORDING_TRANSCRIPT_COMPLETED) {
75+
console.log("Not a recording.transcript.completed event. Exiting");
76+
return;
77+
}
78+
const { payload } = event;
79+
const { object } = payload;
80+
const { recording_files: recordingFiles } = object;
81+
82+
if (!this.isMeetingRelevant(object)) {
83+
return;
84+
}
85+
86+
for (const file of recordingFiles) {
87+
if (!this.isFileRelevant(file)) {
88+
continue;
89+
}
90+
91+
this.emitEvent(file, object);
92+
}
93+
},
94+
};
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import zoomAdmin from "../../zoom_admin.app.mjs";
2+
3+
export default {
4+
key: "zoom_admin-get-meeting-transcript",
5+
name: "Get Meeting Transcript",
6+
description: "Get the transcript of a meeting. [See the documentation](https://developers.zoom.us/docs/api/meetings/#tag/cloud-recording/get/meetings/{meetingId}/transcript)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
zoomAdmin,
11+
meetingId: {
12+
propDefinition: [
13+
zoomAdmin,
14+
"meeting",
15+
],
16+
description: "The meeting ID to get the transcript for",
17+
},
18+
},
19+
methods: {
20+
getMeetingTranscript({
21+
meetingId, ...opts
22+
}) {
23+
return this.zoomAdmin._makeRequest({
24+
path: `/meetings/${meetingId}/transcript`,
25+
...opts,
26+
});
27+
},
28+
},
29+
async run({ $ }) {
30+
const { data: transcript } = await this.getMeetingTranscript({
31+
$,
32+
meetingId: this.meetingId.value || this.meetingId,
33+
});
34+
35+
$.export("$summary", `Retrieved transcript for meeting ${this.meetingId}`);
36+
return transcript;
37+
},
38+
};

components/zoom_admin/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/zoom_admin",
3-
"version": "0.10.0",
3+
"version": "0.11.0",
44
"description": "Pipedream Zoom_admin Components",
55
"main": "zoom_admin.app.mjs",
66
"keywords": [
@@ -14,7 +14,7 @@
1414
"access": "public"
1515
},
1616
"dependencies": {
17-
"@pipedream/platform": "^1.4.0",
17+
"@pipedream/platform": "^3.1.0",
1818
"lodash": "^4.17.21",
1919
"uuid": "^8.3.2"
2020
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
import zoomAdmin from "../../zoom_admin.app.mjs";
2+
3+
export default {
4+
key: "zoom_admin-new-recording-transcript-completed",
5+
name: "New Recording Transcript Completed (Instant)",
6+
description: "Emit new event each time a recording transcript is completed",
7+
version: "0.0.1",
8+
type: "source",
9+
dedupe: "unique",
10+
props: {
11+
zoomAdmin,
12+
zoomApphook: {
13+
type: "$.interface.apphook",
14+
appProp: "zoomAdmin",
15+
eventNames: [
16+
"recording.transcript.completed",
17+
],
18+
},
19+
},
20+
hooks: {
21+
async deploy() {
22+
const { meetings } = await this.zoomAdmin.listMeetings({
23+
params: {
24+
from: this.monthAgo(),
25+
to: new Date().toISOString()
26+
.slice(0, 10),
27+
page_size: 25,
28+
},
29+
});
30+
if (!meetings || meetings.length === 0) {
31+
return;
32+
}
33+
for (const meeting of meetings) {
34+
if (!this.isMeetingRelevant(meeting)) {
35+
continue;
36+
}
37+
for (const file of meeting.recording_files) {
38+
if (!this.isFileRelevant(file)) {
39+
continue;
40+
}
41+
this.emitEvent(file, meeting);
42+
}
43+
}
44+
},
45+
},
46+
methods: {
47+
monthAgo() {
48+
const now = new Date();
49+
const monthAgo = new Date(now.getTime());
50+
monthAgo.setMonth(monthAgo.getMonth() - 1);
51+
return monthAgo.toISOString().slice(0, 10);
52+
},
53+
isMeetingRelevant(meeting) {
54+
return meeting.recording_files && meeting.recording_files.length > 0;
55+
},
56+
isFileRelevant(file) {
57+
return file.file_type === "TRANSCRIPT" && file.status === "completed";
58+
},
59+
emitEvent(file, meeting) {
60+
this.$emit({
61+
meeting,
62+
file,
63+
}, this.generateMeta(file, meeting));
64+
},
65+
generateMeta(file, meeting) {
66+
return {
67+
id: file.id,
68+
summary: `Transcript completed for ${meeting.topic}`,
69+
ts: +new Date(file.recording_end),
70+
};
71+
},
72+
},
73+
async run(event) {
74+
if (event.event !== "recording.transcript.completed") {
75+
console.log("Not a recording.transcript.completed event. Exiting");
76+
return;
77+
}
78+
const { payload } = event;
79+
const { object } = payload;
80+
const { recording_files: recordingFiles } = object;
81+
82+
if (!this.isMeetingRelevant(object)) {
83+
return;
84+
}
85+
86+
for (const file of recordingFiles) {
87+
if (!this.isFileRelevant(file)) {
88+
continue;
89+
}
90+
91+
this.emitEvent(file, object);
92+
}
93+
},
94+
};

0 commit comments

Comments
 (0)