The following blog post is a continuation from the connecting to the Zoom API via OAuth one here (please familiarise yourself with it before proceeding).
Now that we are able to successfully get an Access Token after authenticating our account we can use it to call various Zoom APIs. Here we will access user settings in your Zoom account, specifically the meeting settings, and log the results in a Google Sheet. This provides both a way of confirming we have made a successful connection and will allow us to create subsequent Zoom meetings using these settings.
The Function in the Google Apps Script we will focus on is called 'getMySettings' into which we pass the Access Token we previously generated. We start by setting the HTTP headers and then calling the user settings Zoom API:
// set the HTTP headers
var options = {
'method': "get",
'headers': {"Authorization": "Bearer " + accessToken},
};
// make Zoom API call
var response = UrlFetchApp.fetch("https://api.zoom.us/v2/users/me/settings", options);
Next we break down the response into something more readable:
// gather data from response
var resultText = response.getContentText();
var resultObj = JSON.parse(resultText);
From this point forward the code is very much a repeat of itself where we call the label for each piece of data we want and then run a quick Function to paste this into our Google Sheet:
var scheduleMeetingSettings = resultObj['schedule_meeting'];
saveIntoSheet(scheduleMeetingSettings, 4);
var host_video = scheduleMeetingSettings['host_video'];
saveIntoSheet(host_video, 5);
File Download
Download the Zoom meeting settings via the API sheet here. Please use 'File' > 'Make a copy' for your own version.
No comments:
Post a Comment