Talking to the Zoom API using Powershell (or your favorite language)

This will be a quick post for folks who are finding out that Zoom has extremely limited capabilities to do things in bulk in the admin console. Want to delete 20 users? You’ll be clicking individually, then clicking dialogs that have fade in and fade out visual effects making it take 5 seconds or more for each user. Say you want to change a setting on all existing meetings, and you have 8K of them to go through? Yeah, good luck with that.

This isn’t something that I’ve done a lot of, so feel free to poke fun at me 🙂 I’m just going to throw out how I got up and running in case others would like to work off that. I was going to try “Install-Module -Name ADAL.PS” and see if I could get my OAuth token that way, but I found out that Zoom’s API will generate one for you AND give you the PS code, so I went with that.

Creating the OAuth App in the Zoom Marketplace

To get started, head on over to the Zoom Marketplace and “Build an app”:

You should see an option for OAuth, and you’ll want to click the blue Create button:

Next we’ll want to give it a name, set it to Account-level app if we want it to be able to manage users, meetings, or other settings, and ensure it is not set to be published to the Marketplace:

This should bring us to a new page, and I could have done this completely wrong, but since I don’t actually have a web app that I’m talking to, I couldn’t redirect it anywhere. A common thing in Azure is to use https://localhost, so that’s what I did here and it worked when others didn’t seem to.

Click Continue at the bottom, and on the next page you have to fill out the following boxes: App Name, Short Description, Long Description, Company Name, Name, and Email Address. If you’re like me and skip some of these, it will warn you at the end to go back and fill them out. Once done, click Continue, and on the Features tab, I left it alone and clicked Continue again.

On the Scopes page, we are basically granting permissions to our Powershell session, so a couple of examples would be giving the ability to view and manage users and meetings:

Once you’ve added the scopes you want, click Continue, and then I clicked Install which won’t work, but I’m not entirely sure if it matters or not. Go back to the App Credentials section and leave the tab open, because you’ll need it to request a token from Zoom’s API reference which I’ll cover next.

Obtaining the OAuth token and Powershell code from the Zoom API

To get started, I went to the Zoom API and clicked the bright orange Get Access Token button. It asked for the Client ID and Client Secret from the App Credentials page, and then I click Get Access Token:

You should now see a huge key in the oauth_access_token field, and you’ll just fill in a user ID, and then click Send to test:

If successful, you should get a response below this box, and you’ll know everything is working. To get the code for Powershell (or whatever your favorite language is), click the Code Generation tab like in the screenshot above, and you should see something like below (Note: I changed the drop down from Bash to Powershell):

Now you can copy that content out, put it in a script, and you are good to go. The OAuth token is not valid for long periods of time, so if you are trying to automate this or have really long running tasks, you will want to find a better way to grab the tokens. For me, I’m just looking for use with an interactive shell so I can mass change settings as needed.

Let me know if you have any questions, and as always, those working in education can feel free to request an invite to our OpsecEdu Slack by sending an email to board@opsecedu.com.

1 thought on “Talking to the Zoom API using Powershell (or your favorite language)

  1. Thanks for this write-up Nathan. When I tried to get the access token, I was getting an Invalid Redirect error. To resolve or at least work around it, I had to put https://zoom.us in the Redirect URL for OAuth field. I also added it to the Whitelist URL field but that may not have been necessary. Once I did that, I was able to get my access token.

Leave a Reply

Your email address will not be published. Required fields are marked *