Skip to content

Zoom new action #14157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "zoom-add-meeting-registrant",
name: "Add Meeting Registrant",
description: "Registers a participant for a meeting. [See the docs here](https://marketplace.zoom.us/docs/api-reference/zoom-api/methods/#operation/meetingRegistrantCreate)",
version: "0.3.2",
version: "0.3.3",
type: "action",
props: {
app,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "zoom-add-webinar-registrant",
name: "Add Webinar Registrant",
description: "Registers a participant for a webinar. [See the docs here](https://marketplace.zoom.us/docs/api-reference/zoom-api/webinars/webinarregistrantcreate).",
version: "0.3.2",
version: "0.3.3",
type: "action",
props: {
app,
Expand Down
2 changes: 1 addition & 1 deletion components/zoom/actions/create-meeting/create-meeting.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "zoom-create-meeting",
name: "Create Meeting",
description: "Creates a meeting for a user. A maximum of 100 meetings can be created for a user in a day.",
version: "0.1.3",
version: "0.1.4",
type: "action",
props: {
zoom: {
Expand Down
2 changes: 1 addition & 1 deletion components/zoom/actions/create-user/create-user.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "zoom-create-user",
name: "Create User",
description: "Creates a new user in your account.",
version: "0.2.3",
version: "0.2.4",
type: "action",
props: {
zoom: {
Expand Down
2 changes: 1 addition & 1 deletion components/zoom/actions/delete-user/delete-user.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "zoom-delete-user",
name: "Delete User",
description: "Disassociates (unlinks) a user from the associated account or permanently deletes a user.",
version: "0.2.3",
version: "0.2.4",
type: "action",
props: {
zoom: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "zoom-get-meeting-details",
name: "Get Meeting Details",
description: "Retrieves the details of a meeting.",
version: "0.3.3",
version: "0.3.4",
type: "action",
props: {
zoom: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "zoom-get-webinar-details",
name: "Get Webinar Details",
description: "Gets details of a scheduled webinar. [See the docs here](https://marketplace.zoom.us/docs/api-reference/zoom-api/methods/#operation/webinar).",
version: "0.3.2",
version: "0.3.3",
type: "action",
props: {
app,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import zoom from "../../zoom.app.mjs";

export default {
name: "List Call Recordings",
description: "Get your account's call recordings. [See the documentation](https://developers.zoom.us/docs/api/rest/reference/phone/methods/#operation/getPhoneRecordings)",
key: "zoom-list-call-recordings",
version: "0.0.1",
type: "action",
props: {
zoom,
infoBox: {
type: "alert",
alertType: "info",
content: "The Zoom API returns calls from the last 30 days by default. You can use the `Start Date` and `End Date` props to change this.",
},
startDate: {
type: "string",
label: "Start Date",
description: "The start date/time in `yyyy-mm-dd` or `yyyy-MM-ddTHH:mm:ssZ` format. If `End Date` is not specified, calls made within a 30-day period starting on `Start Date` will be retrieved.",
optional: true,
},
endDate: {
type: "string",
label: "End Date",
description: "The end date/time in `yyyy-mm-dd` or `yyyy-MM-ddTHH:mm:ssZ` format. Calls made after `Start Date` and before `End Date` will be retrieved. Date range should be a maximum of 30 days.",
optional: true,
},
max: {
propDefinition: [
zoom,
"max",
],
default: 30,
min: 1,
max: 300,
},
},
async run ({ $ }) {
const {
zoom, startDate, endDate, max,
} = this;
let to = endDate;
if (startDate && !endDate) {
const date = new Date(startDate);
if (isNaN(date.valueOf())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Use Number.isNaN() Instead of isNaN()

The isNaN() function is unsafe as it attempts type coercion. It's recommended to use Number.isNaN() which doesn't coerce the value, ensuring accurate validation.

Apply this diff to fix the issue:

-        if (isNaN(date.valueOf())) {
+        if (Number.isNaN(date.valueOf())) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (isNaN(date.valueOf())) {
if (Number.isNaN(date.valueOf())) {
🧰 Tools
🪛 Biome

[error] 45-45: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.

See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.

(lint/suspicious/noGlobalIsNan)

throw new Error("Invalid format for `Start Date`. Please use `yyyy-mm-dd` or `yyyy-MM-ddTHH:mm:ssZ`.");
}
date.setDate(date.getDate() - 30);
to = date.toISOString();
if (!startDate.split("T")[1]) {
to = to.split("T")[0];
}
}
Comment on lines +43 to +53
Copy link
Contributor

@coderabbitai coderabbitai bot Oct 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix Logic for Calculating the to Date

There's a logical error when calculating the to date. Subtracting 30 days from startDate results in a to date earlier than startDate, which may lead to incorrect or empty results since from would be after to.

According to your description, if End Date is not specified, calls made within a 30-day period starting on Start Date should be retrieved. Therefore, you should add 30 days to startDate to set the to date.

Apply this diff to correct the logic:

        const date = new Date(startDate);
        if (Number.isNaN(date.valueOf())) {
          throw new Error("Invalid format for `Start Date`. Please use `yyyy-mm-dd` or `yyyy-MM-ddTHH:mm:ssZ`.");
        }
-        date.setDate(date.getDate() - 30);
+        date.setDate(date.getDate() + 30);
         to = date.toISOString();
         if (!startDate.split("T")[1]) {
           to = to.split("T")[0];
         }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (startDate && !endDate) {
const date = new Date(startDate);
if (isNaN(date.valueOf())) {
throw new Error("Invalid format for `Start Date`. Please use `yyyy-mm-dd` or `yyyy-MM-ddTHH:mm:ssZ`.");
}
date.setDate(date.getDate() - 30);
to = date.toISOString();
if (!startDate.split("T")[1]) {
to = to.split("T")[0];
}
}
if (startDate && !endDate) {
const date = new Date(startDate);
if (Number.isNaN(date.valueOf())) {
throw new Error("Invalid format for `Start Date`. Please use `yyyy-mm-dd` or `yyyy-MM-ddTHH:mm:ssZ`.");
}
date.setDate(date.getDate() + 30);
to = date.toISOString();
if (!startDate.split("T")[1]) {
to = to.split("T")[0];
}
}
🧰 Tools
🪛 Biome

[error] 45-45: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.

See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.

(lint/suspicious/noGlobalIsNan)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if what coderabbitai says here is relevant, otherwise omit this comment!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jcortes, the comment by coderabbitai is indeed relevant. There's a logical error in the current code where you're subtracting 30 days from startDate to compute to when endDate is not specified. This results in a to date that is earlier than startDate, which could lead to incorrect or empty results.

According to your description, if End Date is not specified, calls made within a 30-day period starting on Start Date should be retrieved. Therefore, you should add 30 days to startDate to set the to date.

Here's the corrected code:

if (startDate && !endDate) {
  const date = new Date(startDate);
  if (Number.isNaN(date.valueOf())) {
    throw new Error("Invalid format for `Start Date`. Please use `yyyy-mm-dd` or `yyyy-MM-ddTHH:mm:ssZ`.");
  }
  date.setDate(date.getDate() + 30);
  to = date.toISOString();
  if (!startDate.includes("T")) {
    to = to.split("T")[0];
  }
}

Additionally, regarding the Biome warning, it's recommended to use Number.isNaN instead of isNaN to avoid type coercion issues. Updating your code as shown above addresses this concern.

Let me know if you have any questions or need further assistance.

const { recordings } = await zoom.listCallRecordings({
step: $,
params: {
page_size: max,
from: startDate,
to,
},
Comment on lines +42 to +60
Copy link
Contributor

@coderabbitai coderabbitai bot Oct 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Validate Date Range Does Not Exceed 30 Days

The Zoom API requires the date range between from and to to not exceed 30 days. Currently, there's no validation to enforce this limit when both startDate and endDate are provided.

Consider adding a validation check to ensure the date range does not exceed 30 days and throw an error if it does.

Apply this diff to add date range validation:

      const { zoom, startDate, endDate, max } = this;
      let to = endDate;
      if (startDate && !endDate) {
        const date = new Date(startDate);
        if (Number.isNaN(date.valueOf())) {
          throw new Error("Invalid format for `Start Date`. Please use `yyyy-mm-dd` or `yyyy-MM-ddTHH:mm:ssZ`.");
        }
        date.setDate(date.getDate() + 30);
        to = date.toISOString();
        if (!startDate.split("T")[1]) {
          to = to.split("T")[0];
        }
      }
+     if (startDate && to) {
+       const start = new Date(startDate);
+       const end = new Date(to);
+       const diffTime = Math.abs(end - start);
+       const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
+       if (diffDays > 30) {
+         throw new Error("The date range between `Start Date` and `End Date` cannot exceed 30 days.");
+       }
+     }
      const { recordings } = await zoom.listCallRecordings({
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
let to = endDate;
if (startDate && !endDate) {
const date = new Date(startDate);
if (isNaN(date.valueOf())) {
throw new Error("Invalid format for `Start Date`. Please use `yyyy-mm-dd` or `yyyy-MM-ddTHH:mm:ssZ`.");
}
date.setDate(date.getDate() - 30);
to = date.toISOString();
if (!startDate.split("T")[1]) {
to = to.split("T")[0];
}
}
const { recordings } = await zoom.listCallRecordings({
step: $,
params: {
page_size: max,
from: startDate,
to,
},
let to = endDate;
if (startDate && !endDate) {
const date = new Date(startDate);
if (Number.isNaN(date.valueOf())) {
throw new Error("Invalid format for `Start Date`. Please use `yyyy-mm-dd` or `yyyy-MM-ddTHH:mm:ssZ`.");
}
date.setDate(date.getDate() + 30);
to = date.toISOString();
if (!startDate.split("T")[1]) {
to = to.split("T")[0];
}
}
if (startDate && to) {
const start = new Date(startDate);
const end = new Date(to);
const diffTime = Math.abs(end - start);
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
if (diffDays > 30) {
throw new Error("The date range between `Start Date` and `End Date` cannot exceed 30 days.");
}
}
const { recordings } = await zoom.listCallRecordings({
step: $,
params: {
page_size: max,
from: startDate,
to,
},
🧰 Tools
🪛 Biome

[error] 45-45: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.

See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.

(lint/suspicious/noGlobalIsNan)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jcortes I'm leaving this validation up to their API, since they do not mention it as a strictly enforced limit (i.e. that will throw an error) but rather state that the response is limited to up to 30 days of data.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

});

$.export("$summary", `Successfully fetched ${recordings.length} call recordings`);

return recordings;
},
};
2 changes: 1 addition & 1 deletion components/zoom/actions/list-channels/list-channels.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "zoom-list-channels",
name: "List Channels",
description: "List a user's chat channels.",
version: "0.1.3",
version: "0.1.4",
type: "action",
props: {
zoom: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "zoom-list-past-meeting-participants",
name: "List Past Meeting Participants",
description: "Retrieve information on participants from a past meeting. [See the docs here](https://marketplace.zoom.us/docs/api-reference/zoom-api/methods/#operation/pastMeetingParticipants).",
version: "0.2.2",
version: "0.2.3",
type: "action",
props: {
app,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "zoom-list-past-webinar-qa",
name: "List Past Webinar Q&A",
description: "The feature for Webinars allows attendees to ask questions during the Webinar and for the panelists, co-hosts and host to answer their questions. Use this API to list Q&A of a specific Webinar.",
version: "0.1.3",
version: "0.1.4",
type: "action",
props: {
zoom: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
name: "List User's Call Logs",
description: "Gets a user's Zoom phone call logs. [See the documentation](https://developers.zoom.us/docs/zoom-phone/apis/#operation/phoneUserCallLogs)",
key: "zoom-list-user-call-logs",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
zoom,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "zoom-list-webinar-participants-report",
name: "List Webinar Participants Report",
description: "Retrieves detailed report on each webinar attendee. You can get webinar participant reports for the last 6 months. [See the docs here](https://marketplace.zoom.us/docs/api-reference/zoom-api/methods/#operation/reportWebinarParticipants).",
version: "0.0.3",
version: "0.0.4",
type: "action",
props: {
app,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "zoom-send-chat-message",
name: "Send Chat Message",
description: "Send chat messages on Zoom to either an individual user who is in your contact list or to a of which you are a member.",
version: "0.1.3",
version: "0.1.4",
type: "action",
props: {
zoom: {
Expand Down
2 changes: 1 addition & 1 deletion components/zoom/actions/update-meeting/update-meeting.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "zoom-update-meeting",
name: "Update Meeting",
description: "Updates an existing Zoom meeting",
version: "0.1.3",
version: "0.1.4",
type: "action",
props: {
zoom: {
Expand Down
2 changes: 1 addition & 1 deletion components/zoom/actions/update-webinar/update-webinar.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "zoom-update-webinar",
name: "Update Webinar",
description: "Update a webinar's topic, start time, or other settings",
version: "0.1.3",
version: "0.1.4",
type: "action",
props: {
zoom: {
Expand Down
2 changes: 1 addition & 1 deletion components/zoom/actions/view-user/view-user.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "zoom-view-user",
name: "View User",
description: "View your user information",
version: "0.1.3",
version: "0.1.4",
type: "action",
props: {
zoom: {
Expand Down
2 changes: 1 addition & 1 deletion components/zoom/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/zoom",
"version": "0.5.1",
"version": "0.6.0",
"description": "Pipedream Zoom Components",
"main": "zoom.app.mjs",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion components/zoom/sources/custom-event/custom-event.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "zoom-custom-event",
name: "Custom Events (Instant)",
description: "Emit new events tied to your Zoom user or resources you own",
version: "0.1.2",
version: "0.1.3",
type: "source",
dedupe: "unique",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "zoom-meeting-created",
name: "Meeting Created (Instant)",
description: "Emit new event each time a meeting is created where you're the host",
version: "0.1.2",
version: "0.1.3",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Version increment needs justification.

The version has been incremented from "0.1.2" to "0.1.3", which suggests a patch-level change according to semantic versioning. However, there are no visible functional changes in this file that would justify a version increment.

Please provide justification for this version change. If there are no functional changes, consider reverting the version update or including the intended changes that warrant this increment.

type: "source",
dedupe: "unique",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "zoom-meeting-deleted",
name: "Meeting Deleted (Instant)",
description: "Emit new event each time a meeting is deleted where you're the host",
version: "0.1.2",
version: "0.1.3",
type: "source",
dedupe: "unique",
props: {
Expand Down
2 changes: 1 addition & 1 deletion components/zoom/sources/meeting-ended/meeting-ended.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "zoom-meeting-ended",
name: "Meeting Ended (Instant)",
description: "Emit new event each time a meeting ends where you're the host",
version: "0.1.2",
version: "0.1.3",
type: "source",
dedupe: "unique",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "zoom-meeting-started",
name: "Meeting Started (Instant)",
description: "Emit new event each time a meeting starts where you're the host",
version: "0.1.3",
version: "0.1.4",
type: "source",
dedupe: "unique",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "zoom-meeting-updated",
name: "Meeting Updated (Instant)",
description: "Emit new event each time a meeting is updated where you're the host",
version: "0.1.2",
version: "0.1.3",
type: "source",
dedupe: "unique",
props: {
Expand Down
2 changes: 1 addition & 1 deletion components/zoom/sources/phone-event/phone-event.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "zoom-phone-event",
name: "Zoom Phone Events (Instant)",
description: "Emit new Zoom Phone event tied to your Zoom user or resources you own",
version: "0.1.2",
version: "0.1.3",
type: "source",
props: {
...common.props,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "zoom-recording-completed",
name: "Recording Completed (Instant)",
description: "Emit new event each time a new recording completes for a meeting or webinar where you're the host",
version: "0.1.2",
version: "0.1.3",
type: "source",
dedupe: "unique",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "zoom-webinar-created",
name: "Webinar Created (Instant)",
description: "Emit new event each time a webinar is created where you're the host",
version: "0.1.2",
version: "0.1.3",
type: "source",
dedupe: "unique",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "zoom-webinar-deleted",
name: "Webinar Deleted (Instant)",
description: "Emit new event each time a webinar is deleted where you're the host",
version: "0.1.2",
version: "0.1.3",
type: "source",
dedupe: "unique",
props: {
Expand Down
2 changes: 1 addition & 1 deletion components/zoom/sources/webinar-ended/webinar-ended.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "zoom-webinar-ended",
name: "Webinar Ended (Instant)",
description: "Emit new event each time a webinar ends where you're the host",
version: "0.1.2",
version: "0.1.3",
type: "source",
dedupe: "unique",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "zoom-webinar-started",
name: "Webinar Started (Instant)",
description: "Emit new event each time a webinar starts where you're the host",
version: "0.1.2",
version: "0.1.3",
type: "source",
dedupe: "unique",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default {
key: "zoom-webinar-updated",
name: "Webinar Updated (Instant)",
description: "Emit new event each time a webinar is updated where you're the host",
version: "0.1.2",
version: "0.1.3",
type: "source",
dedupe: "unique",
props: {
Expand Down
6 changes: 6 additions & 0 deletions components/zoom/zoom.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,12 @@ export default {
...args,
});
},
listCallRecordings(args = {}) {
return this._makeRequest({
path: "/phone/recordings",
...args,
});
},
async *getResourcesStream({
resourceFn,
resourceFnArgs,
Expand Down
Loading