How to create a meeting with zoom API in Python?
In this article, we will discuss how to create a zoom meeting with the help of zoom API using Python. To integrate zoom API, we need to create it. Follow the given steps for the same:
- To use the zoom API first visit https://marketplace.zoom.us/ and either sign up or sign in with your zoom account.
- Now click Develop and then click on build app.
- Click agree to Zoom’s API License and Terms of Use.
- Choose the app type as JWT, because JWT is easy to use.
- Enter the name of your app and click create.
- Now fill in some mandatory details such as Your company name, Developer’s name, and email address, for company name you may enter your name, and after the completion click continue.
- Now go to the App credential tab copy your API key and your API Secret and save it somewhere.
Before you start, you need to install these two python packages:
- Requests library is an integral part of Python for making HTTP requests to a specified URL. Whether it be REST APIs or Web Scrapping, requests is must be learned for proceeding further with these technologies. When one makes a request to a URI, it returns a response. Python requests provide inbuilt functionalities for managing both the request and response.
- A JSON web token(JWT) is JSON Object which is used to securely transfer information over the web(between two parties). It can be used for an authentication system and can also be used for information exchange.The token is mainly composed of header, payload, signature.
Here we are going to create two functions: the first function generateToken() will generate a JWT token, so we can authenticate and later use this token in the second function createMeeting(), which will make a POST request to create the meeting.
Since we are creating a meeting, we would need to send some extra information to the zoom API like meeting title and start time, etc., that’s why here we have created some JSON data with the name meetingdetails.
Python3
import jwt import requests import json from time import time # Enter your API key and your API secret API_KEY = 'Your API key' API_SEC = 'Your API secret' # create a function to generate a token # using the pyjwt library def generateToken(): token = jwt.encode( # Create a payload of the token containing # API Key & expiration time { 'iss' : API_KEY, 'exp' : time() + 5000 }, # Secret used to generate token signature API_SEC, # Specify the hashing alg algorithm = 'HS256' ) return token.decode( 'utf-8' ) # create json data for post requests meetingdetails = { "topic" : "The title of your zoom meeting" , "type" : 2 , "start_time" : "2019-06-14T10: 21: 57" , "duration" : "45" , "timezone" : "Europe/Madrid" , "agenda" : "test" , "recurrence" : { "type" : 1 , "repeat_interval" : 1 }, "settings" : { "host_video" : "true" , "participant_video" : "true" , "join_before_host" : "False" , "mute_upon_entry" : "False" , "watermark" : "true" , "audio" : "voip" , "auto_recording" : "cloud" } } # send a request with headers including # a token and meeting details def createMeeting(): headers = { 'authorization' : 'Bearer ' + generateToken(), 'content-type' : 'application/json' } r = requests.post( headers = headers, data = json.dumps(meetingdetails)) print ( "\n creating zoom meeting ... \n" ) # print(r.text) # converting the output into json and extracting the details y = json.loads(r.text) join_URL = y[ "join_url" ] meetingPassword = y[ "password" ] print ( f'\n here is your zoom meeting link {join_URL} and your \ password: "{meetingPassword}" \n') # run the create meeting function createMeeting() |
Output:
creating zoom meeting …
here is your zoom meeting link https://us04web.zoom.us/j/73327261770?pwd=aUxvYUIwNjZEa2oxOXY5VEM0YzlaUT09 and your password: “WS0wwu”