@@ -2,6 +2,7 @@ const _ = require('lodash')
22const axios = require ( 'axios' )
33const jwt = require ( 'jsonwebtoken' )
44const config = require ( 'config' )
5+ const moment = require ( 'moment' )
56
67// get & parse all Zoom account credentials in an in-memory array
78const ALL_ZOOM_ACCOUNTS = _ . split ( config . ZOOM_ACCOUNTS , ',' )
@@ -66,18 +67,16 @@ async function generateZoomJWTBearerAccessToken (apiKey) {
6667 *
6768 * @param {Date } startTime the start time of the meeting
6869 * @param {Integer } duration the duration of the meeting
69- * @param {String } timezone the timezone of the meeting
7070 * @returns Zoom API response
7171 */
72- async function createZoomMeeting ( startTime , duration , timezone ) {
72+ async function createZoomMeeting ( startTime , duration ) {
7373 const { accessToken, zoomAccountApiKey } = await generateZoomJWTBearerAccessToken ( )
7474
7575 // POST request details in Zoom API docs:
7676 // https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingcreate
7777 const res = await axios . post ( 'https://api.zoom.us/v2/users/me/meetings' , {
7878 type : 2 ,
79- start_time : startTime . toISOString ( ) ,
80- timezone,
79+ start_time : moment ( startTime ) . utc ( ) . format ( ) ,
8180 duration
8281 } , {
8382 headers : {
@@ -96,12 +95,11 @@ async function createZoomMeeting (startTime, duration, timezone) {
9695 *
9796 * @param {Date } startTime the start time of the meeting
9897 * @param {Integer } duration the duration of the meeting
99- * @param {String } timezone the timezone of the meeting
10098 * @returns The meeting urls for the Zoom meeting
10199 */
102- async function generateZoomMeetingLink ( startTime , duration , timezone ) {
100+ async function generateZoomMeetingLink ( startTime , duration ) {
103101 try {
104- const { meeting, zoomAccountApiKey } = await createZoomMeeting ( startTime , duration , timezone )
102+ const { meeting, zoomAccountApiKey } = await createZoomMeeting ( startTime , duration )
105103
106104 // learn more: https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingcreate#responses
107105 console . log ( meeting . start_url , 'Zoom meeting link for host' )
@@ -121,16 +119,14 @@ async function generateZoomMeetingLink (startTime, duration, timezone) {
121119 * @param {Integer } duration the duration of the meeting
122120 * @param {String } apiKey zoom account api key
123121 * @param {Integer } zoomMeetingId zoom meeting id
124- * @param {String } timezone the timezone of the meeting
125122 * @returns {undefined }
126123 */
127- async function updateZoomMeeting ( startTime , duration , zoomAccountApiKey , zoomMeetingId , timezone ) {
124+ async function updateZoomMeeting ( startTime , duration , zoomAccountApiKey , zoomMeetingId ) {
128125 const { accessToken } = await generateZoomJWTBearerAccessToken ( zoomAccountApiKey )
129126 // PATCH request details in Zoom API docs:
130127 // https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/meetingupdate
131128 await axios . patch ( `https://api.zoom.us/v2/meetings/${ zoomMeetingId } ` , {
132- start_time : startTime . toISOString ( ) ,
133- timezone,
129+ start_time : moment ( startTime ) . utc ( ) . format ( ) ,
134130 duration
135131 } , {
136132 headers : {
0 commit comments