Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
How to create a meeting with the zoom API in Python?
Zoom is a video conferencing platform that provides an API for developers to programmatically interact with its features. Python offers a simple way to create Zoom meetings through API calls using the requests library and JWT authentication.
This guide demonstrates how to create a Zoom meeting using Python and the Zoom API. You can automate meeting creation and integrate it with other applications or workflows.
Prerequisites and Setup
To use the Zoom API, you must first create a Zoom app by following these steps:
Go to https://marketplace.zoom.us/ and sign in to your Zoom account.
Click on the "Develop" tab and select "Build App".
Agree to Zoom's API License and Terms of Use.
Choose "JWT" as the app type (note: JWT apps are deprecated; use OAuth 2.0 for new applications).
Enter your app name and click "Create".
Fill in mandatory details and click "Continue".
Go to the "App Credentials" tab and copy your API key and secret.
Required Packages
Install the following Python packages ?
PyJWT For creating JSON Web Tokens for authentication
requests For making HTTP requests to the Zoom API
pip install PyJWT requests
Creating a Zoom Meeting
Here's a complete example that creates a Zoom meeting ?
import jwt
import requests
import json
from time import time
# Replace with your actual API credentials
API_KEY = 'your_api_key_here'
API_SECRET = 'your_api_secret_here'
def generate_token():
"""Generate JWT token for Zoom API authentication"""
# Create token payload with API key and expiration time
token_payload = {
'iss': API_KEY,
'exp': time() + 5000
}
# Encode the token using HS256 algorithm
token = jwt.encode(token_payload, API_SECRET, algorithm='HS256')
# Return token (newer PyJWT versions return string directly)
return token if isinstance(token, str) else token.decode('utf-8')
def create_zoom_meeting():
"""Create a new Zoom meeting"""
# Meeting configuration
meeting_details = {
"topic": "Python API Meeting",
"type": 2, # Scheduled meeting
"start_time": "2024-12-15T14:00:00Z",
"duration": 60, # Duration in minutes
"timezone": "UTC",
"agenda": "Meeting created via Python API",
"settings": {
"host_video": True,
"participant_video": True,
"join_before_host": False,
"mute_upon_entry": True,
"watermark": True,
"audio": "voip",
"auto_recording": "none"
}
}
# Set request headers
headers = {
'Authorization': 'Bearer ' + generate_token(),
'Content-Type': 'application/json'
}
# Make API request to create meeting
response = requests.post(
'https://api.zoom.us/v2/users/me/meetings',
headers=headers,
data=json.dumps(meeting_details)
)
print("Creating Zoom meeting...")
if response.status_code == 201:
# Parse response and extract meeting details
meeting_info = response.json()
join_url = meeting_info["join_url"]
meeting_id = meeting_info["id"]
password = meeting_info.get("password", "No password required")
print(f"\nMeeting created successfully!")
print(f"Meeting ID: {meeting_id}")
print(f"Join URL: {join_url}")
print(f"Password: {password}")
return meeting_info
else:
print(f"Error creating meeting: {response.status_code}")
print(response.text)
return None
# Create the meeting
if __name__ == "__main__":
create_zoom_meeting()
Key Components Explained
Token Generation Creates a JWT token using your API credentials for authentication
Meeting Details Defines meeting configuration including topic, time, duration, and settings
API Request Sends a POST request to Zoom's API endpoint with the meeting data
Response Handling Processes the API response and extracts meeting information
Meeting Configuration Options
| Parameter | Type | Description |
|---|---|---|
| topic | String | Meeting title/name |
| type | Integer | 1=Instant, 2=Scheduled, 3=Recurring |
| start_time | String | Meeting start time (ISO 8601 format) |
| duration | Integer | Meeting duration in minutes |
Error Handling
The code includes basic error handling to check the response status. A successful meeting creation returns status code 201. Common errors include invalid credentials (401) or malformed requests (400).
Conclusion
Creating Zoom meetings via Python API involves JWT authentication and HTTP requests. This approach allows you to automate meeting creation and integrate Zoom functionality into your applications. Remember to handle API responses and errors appropriately in production code.
