Skip to content

Commit 37b2ed2

Browse files
committed
List Call Recordings action
1 parent a3c822c commit 37b2ed2

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import zoom from "../../zoom.app.mjs";
2+
3+
export default {
4+
name: "List Call Recordings",
5+
description: "Get your account's call recordings. [See the documentation](https://developers.zoom.us/docs/api/rest/reference/phone/methods/#operation/getPhoneRecordings)",
6+
key: "zoom-list-call-recordings",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
zoom,
11+
infoBox: {
12+
type: "alert",
13+
alertType: "info",
14+
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.",
15+
},
16+
startDate: {
17+
type: "string",
18+
label: "Start Date",
19+
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.",
20+
optional: true,
21+
},
22+
endDate: {
23+
type: "string",
24+
label: "End Date",
25+
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.",
26+
optional: true,
27+
},
28+
max: {
29+
propDefinition: [
30+
zoom,
31+
"max",
32+
],
33+
default: 30,
34+
min: 1,
35+
max: 300,
36+
},
37+
},
38+
async run ({ $ }) {
39+
const {
40+
zoom, startDate, endDate, max,
41+
} = this;
42+
let to = endDate;
43+
if (startDate && !endDate) {
44+
const date = new Date(startDate);
45+
if (isNaN(date.valueOf())) {
46+
throw new Error("Invalid format for `Start Date`. Please use `yyyy-mm-dd` or `yyyy-MM-ddTHH:mm:ssZ`.");
47+
}
48+
date.setDate(date.getDate() - 30);
49+
to = date.toISOString();
50+
if (startDate.split("T")[1]) {
51+
to = to.split("T")[0];
52+
}
53+
}
54+
const { recordings } = await zoom.listCallRecordings({
55+
step: $,
56+
params: {
57+
page_size: max,
58+
from: startDate,
59+
to,
60+
},
61+
});
62+
63+
$.export("$summary", `Successfully fetched ${recordings.length} call recordings`);
64+
65+
return recordings;
66+
},
67+
};

components/zoom/zoom.app.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,12 @@ export default {
290290
...args,
291291
});
292292
},
293+
listCallRecordings(args = {}) {
294+
return this._makeRequest({
295+
path: "/phone/recordings",
296+
...args,
297+
});
298+
},
293299
async *getResourcesStream({
294300
resourceFn,
295301
resourceFnArgs,

0 commit comments

Comments
 (0)