@pipedream/zoom 0.3.1 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +0 -4
  2. package/actions/add-meeting-registrant/add-meeting-registrant.mjs +143 -0
  3. package/actions/add-webinar-registrant/add-webinar-registrant.mjs +143 -0
  4. package/actions/create-meeting/create-meeting.mjs +96 -0
  5. package/actions/create-user/create-user.mjs +48 -0
  6. package/actions/delete-user/delete-user.mjs +68 -0
  7. package/actions/get-meeting-details/get-meeting-details.mjs +38 -0
  8. package/actions/get-webinar-details/get-webinar-details.mjs +38 -0
  9. package/actions/list-channels/list-channels.mjs +43 -0
  10. package/actions/list-past-meeting-participants/list-past-meeting-participants.mjs +36 -0
  11. package/actions/list-past-webinar-qa/list-past-webinar-qa.mjs +31 -0
  12. package/actions/send-chat-message/send-chat-message.mjs +46 -0
  13. package/actions/update-meeting/update-meeting.mjs +101 -0
  14. package/actions/update-webinar/update-webinar.mjs +101 -0
  15. package/actions/view-user/view-user.mjs +24 -0
  16. package/package.json +19 -16
  17. package/sources/common/common.mjs +25 -0
  18. package/sources/common/constants.mjs +110 -0
  19. package/sources/custom-event/custom-event.mjs +33 -0
  20. package/sources/meeting-created/meeting-created.mjs +55 -0
  21. package/sources/meeting-deleted/meeting-deleted.mjs +38 -0
  22. package/sources/meeting-ended/meeting-ended.mjs +65 -0
  23. package/sources/meeting-started/meeting-started.mjs +59 -0
  24. package/sources/meeting-updated/meeting-updated.mjs +55 -0
  25. package/sources/phone-event/phone-event.mjs +33 -0
  26. package/sources/recording-completed/recording-completed.mjs +129 -0
  27. package/sources/webinar-created/webinar-created.mjs +55 -0
  28. package/sources/webinar-deleted/webinar-deleted.mjs +38 -0
  29. package/sources/webinar-ended/webinar-ended.mjs +60 -0
  30. package/sources/webinar-started/webinar-started.mjs +58 -0
  31. package/sources/webinar-updated/webinar-updated.mjs +55 -0
  32. package/zoom.app.mjs +99 -0
  33. package/sources/custom-event/custom-event.js +0 -91
  34. package/sources/meeting-created/meeting-created.js +0 -30
  35. package/sources/meeting-deleted/meeting-deleted.js +0 -30
  36. package/sources/meeting-ended/meeting-ended.js +0 -26
  37. package/sources/meeting-started/meeting-started.js +0 -27
  38. package/sources/meeting-updated/meeting-updated.js +0 -26
  39. package/sources/recording-completed/recording-completed.js +0 -110
  40. package/sources/webinar-created/webinar-created.js +0 -30
  41. package/sources/webinar-deleted/webinar-deleted.js +0 -30
  42. package/sources/webinar-ended/webinar-ended.js +0 -29
  43. package/sources/webinar-started/webinar-started.js +0 -30
  44. package/sources/webinar-updated/webinar-updated.js +0 -29
  45. package/zoom.app.js +0 -4
@@ -0,0 +1,59 @@
1
+ import common from "../common/common.mjs";
2
+
3
+ export default {
4
+ ...common,
5
+ key: "zoom-meeting-started",
6
+ name: "Meeting Started (Instant)",
7
+ description: "Emit new event each time a meeting starts where you're the host",
8
+ version: "0.0.4",
9
+ type: "source",
10
+ dedupe: "unique", // Dedupe based on meeting ID
11
+ props: {
12
+ ...common.props,
13
+ zoomApphook: {
14
+ type: "$.interface.apphook",
15
+ appProp: "zoom",
16
+ eventNames: [
17
+ "meeting.started",
18
+ ],
19
+ },
20
+ },
21
+ hooks: {
22
+ async deploy() {
23
+ const { meetings } = await this.zoom.listMeetings({
24
+ page_size: 25,
25
+ type: "previous_meetings",
26
+ });
27
+ if (!meetings || meetings.length === 0) {
28
+ return;
29
+ }
30
+ const objects = this.sortByDate(meetings, "start_time");
31
+ for (const object of objects) {
32
+ const startTime = Date.parse(object.start_time);
33
+ if (startTime < Date.now()) {
34
+ this.emitEvent({
35
+ object,
36
+ time_stamp: Date.now(),
37
+ }, object);
38
+ }
39
+ }
40
+ },
41
+ },
42
+ methods: {
43
+ ...common.methods,
44
+ emitEvent(payload, object) {
45
+ const meta = this.generateMeta(object);
46
+ this.$emit({
47
+ event: "meeting.started",
48
+ payload,
49
+ }, meta);
50
+ },
51
+ generateMeta(object) {
52
+ return {
53
+ id: object.uuid,
54
+ summary: `Meeting ${object.topic} started`,
55
+ ts: +new Date(object.start_time),
56
+ };
57
+ },
58
+ },
59
+ };
@@ -0,0 +1,55 @@
1
+ import common from "../common/common.mjs";
2
+
3
+ export default {
4
+ ...common,
5
+ key: "zoom-meeting-updated",
6
+ name: "Meeting Updated (Instant)",
7
+ description: "Emit new event each time a meeting is updated where you're the host",
8
+ version: "0.0.4",
9
+ type: "source",
10
+ dedupe: "unique", // dedupe on the meeting ID + timestamp
11
+ props: {
12
+ ...common.props,
13
+ zoomApphook: {
14
+ type: "$.interface.apphook",
15
+ appProp: "zoom",
16
+ eventNames: [
17
+ "meeting.updated",
18
+ ],
19
+ },
20
+ },
21
+ hooks: {
22
+ async deploy() {
23
+ const { meetings } = await this.zoom.listMeetings({
24
+ page_size: 25,
25
+ });
26
+ if (!meetings || meetings.length === 0) {
27
+ return;
28
+ }
29
+ const objects = this.sortByDate(meetings, "created_at");
30
+ for (const object of objects) {
31
+ this.emitEvent({
32
+ object,
33
+ time_stamp: +new Date(object.start_time),
34
+ }, object);
35
+ }
36
+ },
37
+ },
38
+ methods: {
39
+ ...common.methods,
40
+ emitEvent(payload, object) {
41
+ const meta = this.generateMeta(payload, object);
42
+ this.$emit({
43
+ event: "meeting.updated",
44
+ payload,
45
+ }, meta);
46
+ },
47
+ generateMeta(payload, object) {
48
+ return {
49
+ id: `${object.id}-${payload.time_stamp}`,
50
+ summary: `Meeting ${object.id} updated`,
51
+ ts: +new Date(object.start_time),
52
+ };
53
+ },
54
+ },
55
+ };
@@ -0,0 +1,33 @@
1
+ import zoom from "../../zoom.app.mjs";
2
+ import constants from "../common/constants.mjs";
3
+
4
+ export default {
5
+ key: "zoom-phone-event",
6
+ name: "Zoom Phone Events (Instant)",
7
+ description: "Listen for any Zoom Phone events tied to your Zoom user or resources you own",
8
+ version: "0.0.2",
9
+ type: "source",
10
+ props: {
11
+ zoom,
12
+ eventNameOptions: {
13
+ label: "Zoom Events",
14
+ type: "string[]",
15
+ options: constants.PHONE_EVENT_TYPES,
16
+ },
17
+ zoomApphook: {
18
+ type: "$.interface.apphook",
19
+ appProp: "zoom",
20
+ async eventNames() {
21
+ return this.eventNameOptions;
22
+ },
23
+ },
24
+ },
25
+ async run(event) {
26
+ console.log(event);
27
+ this.$emit(event, {
28
+ id: event.payload?.object?.id,
29
+ summary: event.event,
30
+ ts: Date.now(),
31
+ });
32
+ },
33
+ };
@@ -0,0 +1,129 @@
1
+ import zoom from "../../zoom.app.mjs";
2
+ import common from "../common/common.mjs";
3
+
4
+ export default {
5
+ key: "zoom-recording-completed",
6
+ name: "Recording Completed (Instant)",
7
+ description: "Emit new event each time a new recording completes for a meeting or webinar where you're the host",
8
+ version: "0.0.6",
9
+ type: "source",
10
+ dedupe: "unique",
11
+ props: {
12
+ ...common.props,
13
+ zoomApphook: {
14
+ type: "$.interface.apphook",
15
+ appProp: "zoom",
16
+ eventNames: [
17
+ "recording.completed",
18
+ ],
19
+ },
20
+ meetingIds: {
21
+ propDefinition: [
22
+ zoom,
23
+ "meetingIds",
24
+ ],
25
+ },
26
+ includeAudioRecordings: {
27
+ propDefinition: [
28
+ zoom,
29
+ "includeAudioRecordings",
30
+ ],
31
+ },
32
+ includeChatTranscripts: {
33
+ propDefinition: [
34
+ zoom,
35
+ "includeChatTranscripts",
36
+ ],
37
+ },
38
+ },
39
+ hooks: {
40
+ async deploy() {
41
+ const { meetings } = await this.zoom.listRecordings({
42
+ from: this.monthAgo(),
43
+ to: new Date().toISOString()
44
+ .slice(0, 10),
45
+ page_size: 25,
46
+ });
47
+ if (!meetings || meetings.length === 0) {
48
+ return;
49
+ }
50
+ for (const meeting of meetings) {
51
+ if (!this.isMeetingRelevant(meeting)) {
52
+ continue;
53
+ }
54
+ for (const file of meeting.recording_files) {
55
+ if (!this.isFileRelevant(file)) {
56
+ continue;
57
+ }
58
+ this.emitEvent(file, meeting);
59
+ }
60
+ }
61
+ },
62
+ },
63
+ methods: {
64
+ ...common.methods,
65
+ isMeetingRelevant(meeting) {
66
+ const {
67
+ id, recording_files,
68
+ } = meeting;
69
+
70
+ if (!recording_files || recording_files.length === 0) {
71
+ console.log("No files in recording. Exiting");
72
+ return false;
73
+ }
74
+
75
+ if (this.meetingIds && this.meetingIds.length > 0 && !this.meetingIds.includes(id)) {
76
+ console.log("Meeting ID does not match the filter rules.");
77
+ return false;
78
+ }
79
+ return true;
80
+ },
81
+ isFileRelevant(file) {
82
+ return !((file.status !== "completed")
83
+ || (file.file_type === "M4A" && !this.includeAudioRecordings)
84
+ || (file.file_type === "CHAT" && !this.includeChatTranscripts));
85
+ },
86
+ emitEvent(file, meeting, downloadToken = null) {
87
+ this.$emit(
88
+ {
89
+ download_url_with_token: `${file.download_url}?access_token=${downloadToken}`,
90
+ download_token: downloadToken,
91
+ ...file,
92
+ meeting_id_long: meeting.id, // Long ID is necessary for certain API operations
93
+ meeting_topic: meeting.topic,
94
+ host_id: meeting.host_id,
95
+ host_email: meeting.host_email,
96
+ },
97
+ {
98
+ id: file.id,
99
+ summary: `${meeting.topic} — ${file.file_type}`,
100
+ ts: +new Date(file.recording_end),
101
+ },
102
+ );
103
+ },
104
+ },
105
+ async run(event) {
106
+ if (event.event !== "recording.completed") {
107
+ console.log("Not a recording.completed event. Exiting");
108
+ return;
109
+ }
110
+ const { payload } = event;
111
+ const {
112
+ object,
113
+ download_token: downloadToken,
114
+ } = payload;
115
+ const { recording_files: recordingFiles } = object;
116
+
117
+ if (!this.isMeetingRelevant(object)) {
118
+ return;
119
+ }
120
+
121
+ for (const file of recordingFiles) {
122
+ if (!this.isFileRelevant(file)) {
123
+ continue;
124
+ }
125
+
126
+ this.emitEvent(file, object, downloadToken);
127
+ }
128
+ },
129
+ };
@@ -0,0 +1,55 @@
1
+ import common from "../common/common.mjs";
2
+
3
+ export default {
4
+ ...common,
5
+ key: "zoom-webinar-created",
6
+ name: "Webinar Created (Instant)",
7
+ description: "Emit new event each time a webinar is created where you're the host",
8
+ version: "0.0.4",
9
+ type: "source",
10
+ dedupe: "unique", // Dedupe based on webinar ID
11
+ props: {
12
+ ...common.props,
13
+ zoomApphook: {
14
+ type: "$.interface.apphook",
15
+ appProp: "zoom",
16
+ eventNames: [
17
+ "webinar.created.by_me",
18
+ "webinar.created.for_me",
19
+ ],
20
+ },
21
+ },
22
+ hooks: {
23
+ async deploy() {
24
+ const { webinars } = await this.zoom.listWebinars({
25
+ page_size: 25,
26
+ });
27
+ if (!webinars || webinars.length === 0) {
28
+ return;
29
+ }
30
+ const objects = this.sortByDate(webinars, "created_at");
31
+ for (const object of objects) {
32
+ this.emitEvent({
33
+ object,
34
+ }, object);
35
+ }
36
+ },
37
+ },
38
+ methods: {
39
+ ...common.methods,
40
+ emitEvent(payload, object) {
41
+ const meta = this.generateMeta(object);
42
+ this.$emit({
43
+ event: "webinar.created",
44
+ payload,
45
+ }, meta);
46
+ },
47
+ generateMeta(object) {
48
+ return {
49
+ id: object.uuid,
50
+ summary: object.topic,
51
+ ts: +new Date(object.start_time),
52
+ };
53
+ },
54
+ },
55
+ };
@@ -0,0 +1,38 @@
1
+ import common from "../common/common.mjs";
2
+
3
+ export default {
4
+ ...common,
5
+ key: "zoom-webinar-deleted",
6
+ name: "Webinar Deleted",
7
+ description: "Emit new event each time a webinar is deleted where you're the host",
8
+ version: "0.0.4",
9
+ type: "source",
10
+ dedupe: "unique", // Dedupe based on webinar ID
11
+ props: {
12
+ ...common.props,
13
+ zoomApphook: {
14
+ type: "$.interface.apphook",
15
+ appProp: "zoom",
16
+ eventNames: [
17
+ "webinar.deleted.by_me",
18
+ "webinar.deleted.for_me",
19
+ ],
20
+ },
21
+ },
22
+ methods: {
23
+ emitEvent(payload, object) {
24
+ const meta = this.generateMeta(object);
25
+ this.$emit({
26
+ event: "webinar.deleted",
27
+ payload,
28
+ }, meta);
29
+ },
30
+ generateMeta(object) {
31
+ return {
32
+ id: object.uuid,
33
+ summary: object.topic,
34
+ ts: +new Date(object.start_time),
35
+ };
36
+ },
37
+ },
38
+ };
@@ -0,0 +1,60 @@
1
+ import common from "../common/common.mjs";
2
+
3
+ export default {
4
+ ...common,
5
+ key: "zoom-webinar-ended",
6
+ name: "Webinar Ended (Instant)",
7
+ description: "Emit new event each time a webinar ends where you're the host",
8
+ version: "0.0.4",
9
+ type: "source",
10
+ dedupe: "unique", // Dedupe based on webinar ID
11
+ props: {
12
+ ...common.props,
13
+ zoomApphook: {
14
+ type: "$.interface.apphook",
15
+ appProp: "zoom",
16
+ eventNames: [
17
+ "webinar.ended",
18
+ ],
19
+ },
20
+ },
21
+ hooks: {
22
+ async deploy() {
23
+ const { webinars } = await this.zoom.listWebinarMetrics({
24
+ from: this.monthAgo(),
25
+ to: new Date().toISOString()
26
+ .slice(0, 10),
27
+ page_size: 25,
28
+ });
29
+ if (!webinars || webinars.length === 0) {
30
+ return;
31
+ }
32
+ const objects = this.sortByDate(webinars, "end_time");
33
+ for (const object of objects) {
34
+ const endTime = Date.parse(object.end_time);
35
+ if (endTime < Date.now()) {
36
+ this.emitEvent({
37
+ object,
38
+ }, object);
39
+ }
40
+ }
41
+ },
42
+ },
43
+ methods: {
44
+ ...common.methods,
45
+ emitEvent(payload, object) {
46
+ const meta = this.generateMeta(object);
47
+ this.$emit({
48
+ event: "webinar.ended",
49
+ payload,
50
+ }, meta);
51
+ },
52
+ generateMeta(object) {
53
+ return {
54
+ id: object.uuid,
55
+ summary: object.topic,
56
+ ts: +new Date(object.end_time),
57
+ };
58
+ },
59
+ },
60
+ };
@@ -0,0 +1,58 @@
1
+ import common from "../common/common.mjs";
2
+
3
+ export default {
4
+ ...common,
5
+ key: "zoom-webinar-started",
6
+ name: "Webinar Started (Instant)",
7
+ description: "Emit new event each time a webinar starts where you're the host",
8
+ version: "0.0.4",
9
+ type: "source",
10
+ dedupe: "unique", // Dedupe based on webinar ID
11
+ props: {
12
+ ...common.props,
13
+ zoomApphook: {
14
+ type: "$.interface.apphook",
15
+ appProp: "zoom",
16
+ eventNames: [
17
+ "webinar.started",
18
+ ],
19
+ },
20
+ },
21
+ hooks: {
22
+ async deploy() {
23
+ const { webinars } = await this.zoom.listWebinars({
24
+ page_size: 25,
25
+ });
26
+ if (!webinars || webinars.length === 0) {
27
+ return;
28
+ }
29
+ const objects = this.sortByDate(webinars, "start_time");
30
+ for (const object of objects) {
31
+ const startTime = Date.parse(object.start_time);
32
+ if (startTime < Date.now()) {
33
+ this.emitEvent({
34
+ object,
35
+ time_stamp: startTime,
36
+ }, object);
37
+ }
38
+ }
39
+ },
40
+ },
41
+ methods: {
42
+ ...common.methods,
43
+ emitEvent(payload, object) {
44
+ const meta = this.generateMeta(object);
45
+ this.$emit({
46
+ event: "webinar.started",
47
+ payload,
48
+ }, meta);
49
+ },
50
+ generateMeta(object) {
51
+ return {
52
+ id: object.uuid,
53
+ summary: object.topic,
54
+ ts: +new Date(object.start_time),
55
+ };
56
+ },
57
+ },
58
+ };
@@ -0,0 +1,55 @@
1
+ import common from "../common/common.mjs";
2
+
3
+ export default {
4
+ ...common,
5
+ key: "zoom-webinar-updated",
6
+ name: "Webinar Updated (Instant)",
7
+ description: "Emit new event each time a webinar is updated where you're the host",
8
+ version: "0.0.4",
9
+ type: "source",
10
+ dedupe: "unique", // Dedupe based on webinar ID & timestamp
11
+ props: {
12
+ ...common.props,
13
+ zoomApphook: {
14
+ type: "$.interface.apphook",
15
+ appProp: "zoom",
16
+ eventNames: [
17
+ "webinar.updated",
18
+ ],
19
+ },
20
+ },
21
+ hooks: {
22
+ async deploy() {
23
+ const { webinars } = await this.zoom.listWebinars({
24
+ page_size: 25,
25
+ });
26
+ if (!webinars || webinars.length === 0) {
27
+ return;
28
+ }
29
+ const objects = this.sortByDate(webinars, "created_at");
30
+ for (const object of objects) {
31
+ this.emitEvent({
32
+ object,
33
+ time_stamp: +new Date(object.start_time),
34
+ }, object);
35
+ }
36
+ },
37
+ },
38
+ methods: {
39
+ ...common.methods,
40
+ emitEvent(payload, object) {
41
+ const meta = this.generateMeta(payload, object);
42
+ this.$emit({
43
+ event: "webinar.updated",
44
+ payload,
45
+ }, meta);
46
+ },
47
+ generateMeta(payload, object) {
48
+ return {
49
+ id: `${object.id}-${payload.time_stamp}`,
50
+ summary: `Webinar ${object.id} updated`,
51
+ ts: +new Date(object.start_time),
52
+ };
53
+ },
54
+ },
55
+ };
package/zoom.app.mjs ADDED
@@ -0,0 +1,99 @@
1
+ import { axios } from "@pipedream/platform";
2
+
3
+ export default {
4
+ type: "app",
5
+ app: "zoom",
6
+ propDefinitions: {
7
+ meetingIds: {
8
+ type: "integer[]",
9
+ label: "Meeting Filter",
10
+ description: "Optionally filter for events for one or more meetings",
11
+ async options({ page }) {
12
+ const { meetings } = await this.listMeetings({
13
+ page_number: page + 1,
14
+ });
15
+ return meetings.map((meeting) => ({
16
+ label: `${meeting.topic} (${meeting.id})`,
17
+ value: meeting.id,
18
+ }));
19
+ },
20
+ optional: true,
21
+ },
22
+ includeAudioRecordings: {
23
+ type: "boolean",
24
+ label: "Include Audio Recordings",
25
+ description:
26
+ "This source emits video (MP4) recordings only by default. Set this prop to true to include audio recordings",
27
+ optional: true,
28
+ default: false,
29
+ },
30
+ includeChatTranscripts: {
31
+ type: "boolean",
32
+ label: "Include Chat Transcripts",
33
+ description:
34
+ "This source emits video (MP4) recordings only by default. Set this prop to `true` to include chat transcripts",
35
+ optional: true,
36
+ default: false,
37
+ },
38
+ },
39
+ methods: {
40
+ _baseUrl() {
41
+ return "https://api.zoom.us/v2/";
42
+ },
43
+ _getHeaders() {
44
+ return {
45
+ "Authorization": `Bearer ${this.$auth.oauth_access_token}`,
46
+ "Content-Type": "application/json",
47
+ };
48
+ },
49
+ async _makeRequest(args = {}) {
50
+ const {
51
+ method = "GET",
52
+ headers,
53
+ path,
54
+ $ = this,
55
+ ...otherArgs
56
+ } = args;
57
+ const config = {
58
+ method,
59
+ headers: {
60
+ ...headers,
61
+ ...this._getHeaders(),
62
+ },
63
+ url: `${this._baseUrl()}${path}`,
64
+ ...otherArgs,
65
+ };
66
+ return axios($, config);
67
+ },
68
+ async getPastMeetingDetails(meetingId, params) {
69
+ return this._makeRequest({
70
+ path: `past_meetings/${meetingId}`,
71
+ params,
72
+ });
73
+ },
74
+ async listMeetings(params) {
75
+ return this._makeRequest({
76
+ path: "users/me/meetings",
77
+ params,
78
+ });
79
+ },
80
+ async listWebinars(params) {
81
+ return this._makeRequest({
82
+ path: "users/me/webinars",
83
+ params,
84
+ });
85
+ },
86
+ async listWebinarMetrics(params) {
87
+ return this._makeRequest({
88
+ path: "metrics/webinars",
89
+ params,
90
+ });
91
+ },
92
+ async listRecordings(params) {
93
+ return this._makeRequest({
94
+ path: "users/me/recordings",
95
+ params,
96
+ });
97
+ },
98
+ },
99
+ };